Browse Source

Merge pull request 'fix-2823 修复关联数据集权限问题' (#2824) from fix-2392 into V20220830

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/2824
Reviewed-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.8.2^2
zouap 3 years ago
parent
commit
07b3c06b7c
1 changed files with 4 additions and 6 deletions
  1. +4
    -6
      models/dataset.go

+ 4
- 6
models/dataset.go View File

@@ -121,8 +121,10 @@ func (datasets DatasetList) loadAttachmentAttributes(opts *SearchDatasetOptions)

for i := range datasets {
if attachment.DatasetID == datasets[i].ID {
if opts.StarByMe {

if !attachment.IsPrivate{
datasets[i].Attachments = append(datasets[i].Attachments, attachment)
}else{
permission, ok := permissionMap[datasets[i].ID]
if !ok {

@@ -136,7 +138,7 @@ func (datasets DatasetList) loadAttachmentAttributes(opts *SearchDatasetOptions)
}
if !permission {
isCollaborator, _ := datasets[i].Repo.IsCollaborator(opts.User.ID)
if isCollaborator {
if isCollaborator ||datasets[i].Repo.IsOwnedBy(opts.User.ID){
log.Info("Collaborator user may visit the attach.")
permission = true
}
@@ -147,11 +149,7 @@ func (datasets DatasetList) loadAttachmentAttributes(opts *SearchDatasetOptions)

if permission {
datasets[i].Attachments = append(datasets[i].Attachments, attachment)
} else if !attachment.IsPrivate {
datasets[i].Attachments = append(datasets[i].Attachments, attachment)
}
} else {
datasets[i].Attachments = append(datasets[i].Attachments, attachment)
}

}


Loading…
Cancel
Save