#5421 下载和使用公开数据集和模型,不需要登录,类似代码仓

Merged
chenyifan01 merged 2 commits from doc-129 into V20240423 3 weeks ago
  1. +2
    -0
      models/dataset_permission.go
  2. +3
    -0
      routers/repo/ai_model_manage.go
  3. +1
    -1
      routers/repo/attachment.go

+ 2
- 0
models/dataset_permission.go View File

@@ -25,6 +25,8 @@ func GetUserDataSetPermission(dataSet *Dataset, user *User) (isPermit bool, err
default:
log.Error("the status of data_set is wrong")
}
} else if !dataSet.IsPrivate() {
isPermit = true
}

return isPermit, nil


+ 3
- 0
routers/repo/ai_model_manage.go View File

@@ -1170,6 +1170,9 @@ func isQueryRight(ctx *context.Context) bool {
}

func isCanDownload(ctx *context.Context, task *models.AiModelManage) bool {
if !task.IsPrivate {
return true
}
if ctx.User == nil {
return false
}


+ 1
- 1
routers/repo/attachment.go View File

@@ -284,7 +284,7 @@ func GetAttachment(ctx *context.Context) {
}

if dataSet != nil {
if !ctx.IsSigned {
if !ctx.IsSigned && dataSet.IsPrivate() {
ctx.SetCookie("redirect_to", setting.AppSubURL+ctx.Req.URL.RequestURI(), 0, setting.AppSubURL)
ctx.Redirect(setting.AppSubURL + "/user/login")
return


Loading…
Cancel
Save