|
|
|
@@ -404,7 +404,7 @@ func ShowModelTemplate(ctx *context.Context) { |
|
|
|
|
|
|
|
func isQueryRight(ctx *context.Context) bool { |
|
|
|
if ctx.Repo.Repository.IsPrivate { |
|
|
|
if ctx.User.IsAdmin || ctx.Repo.IsAdmin() || ctx.Repo.IsOwner() { |
|
|
|
if ctx.User.IsAdmin || ctx.Repo.IsAdmin() || ctx.Repo.IsOwner() || ctx.Repo.CanAccess(models.UnitTypeCloudBrain) { |
|
|
|
return true |
|
|
|
} |
|
|
|
return false |
|
|
|
@@ -413,6 +413,13 @@ func isQueryRight(ctx *context.Context) bool { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func isOper(ctx *context.Context, modelUserId int64) bool { |
|
|
|
if ctx.User.IsAdmin || ctx.Repo.IsAdmin() || ctx.Repo.IsOwner() || ctx.User.ID == modelUserId { |
|
|
|
return true |
|
|
|
} |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
func ShowModelPageInfo(ctx *context.Context) { |
|
|
|
log.Info("ShowModelInfo start.") |
|
|
|
if !isQueryRight(ctx) { |
|
|
|
@@ -439,6 +446,10 @@ func ShowModelPageInfo(ctx *context.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
for _, model := range modelResult { |
|
|
|
model.IsCanOper = isOper(ctx, model.UserId) |
|
|
|
} |
|
|
|
|
|
|
|
mapInterface := make(map[string]interface{}) |
|
|
|
mapInterface["data"] = modelResult |
|
|
|
mapInterface["count"] = count |
|
|
|
|