Browse Source

fix issue

tags/v1.21.12.1^2
zhoupzh 4 years ago
parent
commit
89ebdb6d6a
2 changed files with 14 additions and 3 deletions
  1. +6
    -1
      routers/repo/ai_model_manage.go
  2. +8
    -2
      web_src/js/components/Model.vue

+ 6
- 1
routers/repo/ai_model_manage.go View File

@@ -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() || ctx.Repo.CanRead(models.UnitTypeCloudBrain) {
if ctx.Repo.CanRead(models.UnitTypeCloudBrain) || ctx.User.IsAdmin || ctx.Repo.IsAdmin() || ctx.Repo.IsOwner() {
return true
}
return false
@@ -414,6 +414,9 @@ func isQueryRight(ctx *context.Context) bool {
}

func isOper(ctx *context.Context, modelUserId int64) bool {
if ctx.User == nil {
return false
}
if ctx.User.IsAdmin || ctx.Repo.IsAdmin() || ctx.Repo.IsOwner() || ctx.User.ID == modelUserId {
return true
}
@@ -447,6 +450,8 @@ func ShowModelPageInfo(ctx *context.Context) {
}

for _, model := range modelResult {
log.Info("model=" + model.Name)
log.Info("model.UserId=" + fmt.Sprint(model.UserId))
model.IsCanOper = isOper(ctx, model.UserId)
}



+ 8
- 2
web_src/js/components/Model.vue View File

@@ -103,9 +103,9 @@
<el-table-column label="操作" min-width="18%" align="center">
<template slot-scope="scope">
<div class="space-around">
<a :style="{visibility:!scope.row.Children ? 'visible':'hidden'}" @click="showcreateVue(scope.row.Name,scope.row.Version)">创建新版本</a>
<a :style="{visibility:!scope.row.Children ? 'visible':'hidden'}" :class="{'disabled':scope.row.Children.IsCanOper}" @click="showcreateVue(scope.row.Name,scope.row.Version)">创建新版本</a>
<a :href="loadhref+scope.row.ID">下载</a>
<a @click="deleteModel(scope.row.ID)">删除</a>
<a :class="{'disabled':scope.row.Children.IsCanOper}" @click="deleteModel(scope.row.ID)">删除</a>
</div>
</template>
@@ -385,5 +385,11 @@ export default {
display: flex;
justify-content: space-around;
}
.disabled {
cursor: default;
pointer-events: none;
color: rgba(0,0,0,.6) !important;
opacity: .45 !important;
}

</style>

Loading…
Cancel
Save