| @@ -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) | ||||