Browse Source

协作者权限控制问题

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.12.1^2
zouap 2 years ago
parent
commit
e0ceda486b
1 changed files with 5 additions and 15 deletions
  1. +5
    -15
      routers/repo/ai_model_manage.go

+ 5
- 15
routers/repo/ai_model_manage.go View File

@@ -1058,23 +1058,13 @@ func isAdminRight(ctx *context.Context) bool {
if ctx.Repo.IsOwner() {
return true
}
if ctx.Repo.Owner.IsOrganization() {
isOwner, err := ctx.Repo.Owner.IsOwnedBy(ctx.User.ID)
if err != nil {
return false
} else if isOwner {
return true
}
}
isCollaborator, err := ctx.Repo.Repository.IsCollaborator(ctx.User.ID)
permission, err := models.GetUserRepoPermission(ctx.Repo.Repository, ctx.User)
if err != nil {
log.Info("query IsCollaborator error." + err.Error())
log.Error("GetUserRepoPermission failed:%v", err.Error())
return false
}
if isCollaborator {
mode := ctx.Repo.Repository.GetCollaboratorMode(ctx.User.ID)
if mode >= 3 {
return true
}
if permission.AccessMode >= models.AccessModeAdmin {
return true
}
return false
}


Loading…
Cancel
Save