Browse Source

训练作业版本权限管理

pull/962/head
liuzx 3 years ago
parent
commit
c9f1c34c2a
1 changed files with 9 additions and 5 deletions
  1. +9
    -5
      routers/repo/modelarts.go

+ 9
- 5
routers/repo/modelarts.go View File

@@ -1320,12 +1320,16 @@ func canUserCreateTrainJob(uid int64) (bool, error) {
return org.IsOrgMember(uid)
}
func canUserCreateTrainJobVersion(ctx *context.Context, userID int64) (bool, error) {
if ctx.User.ID == userID || ctx.User.IsAdmin {
canNewJob := true
return canNewJob, nil
if ctx == nil || ctx.User == nil {
log.Error("user unlogin!")
return false, nil
}
if userID != ctx.User.ID || !ctx.User.IsAdmin {
log.Error("Only user itself and admin can new trainjob!")
// ctx.ServerError("Only user itself and admin can new trainjob!", nil)
return false, nil
} else {
canNewJob := false
return canNewJob, nil
return true, nil
}
}



Loading…
Cancel
Save