Browse Source

Merge pull request '优化:游客下载数据集跳转到登录页面' (#1706) from fix-1650 into V20220328

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/1706
Reviewed-by: ychao_1983 <ychao_1983@sina.com>
avadesian-patch-1
ychao_1983 3 years ago
parent
commit
5e47c97dfb
1 changed files with 13 additions and 7 deletions
  1. +13
    -7
      routers/repo/attachment.go

+ 13
- 7
routers/repo/attachment.go View File

@@ -241,14 +241,20 @@ func GetAttachment(ctx *context.Context) {
}

if dataSet != nil {
isPermit, err := models.GetUserDataSetPermission(dataSet, ctx.User)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserDataSetPermission", err.Error())
return
}
if !isPermit {
ctx.Error(http.StatusNotFound)
if !ctx.IsSigned {
ctx.SetCookie("redirect_to", setting.AppSubURL+ctx.Req.URL.RequestURI(), 0, setting.AppSubURL)
ctx.Redirect(setting.AppSubURL + "/user/login")
return
} else {
isPermit, err := models.GetUserDataSetPermission(dataSet, ctx.User)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserDataSetPermission", err.Error())
return
}
if !isPermit {
ctx.Error(http.StatusNotFound)
return
}
}
}



Loading…
Cancel
Save