Browse Source

提交代码

pull/1693/head
yanchao 3 years ago
parent
commit
843130c838
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      routers/repo/dataset.go

+ 11
- 2
routers/repo/dataset.go View File

@@ -110,8 +110,17 @@ func DatasetIndex(ctx *context.Context) {
repo := ctx.Repo.Repository repo := ctx.Repo.Repository


dataset, err := models.GetDatasetByRepo(repo) dataset, err := models.GetDatasetByRepo(repo)
ctx.Data["CanRead"]=ctx.Repo.CanRead(models.UnitTypeDatasets)
ctx.Data["CanWrite"]=ctx.Repo.CanWrite(models.UnitTypeDatasets)
canRead := false
if ctx.IsSigned {
isCollaborator, err := repo.IsCollaborator(ctx.User.ID)
if err != nil {
canRead = false
} else if ctx.User.IsAdmin || isCollaborator {
canRead = true
}
}
ctx.Data["CanRead"] = canRead
ctx.Data["CanWrite"] = ctx.Repo.CanWrite(models.UnitTypeDatasets)
if err != nil { if err != nil {
log.Warn("query dataset, not found.") log.Warn("query dataset, not found.")
ctx.HTML(200, tplIndex) ctx.HTML(200, tplIndex)


Loading…
Cancel
Save