Browse Source

修复关联数据集权限问题

tags/v1.22.8.2^2
ychao_1983 3 years ago
parent
commit
2c95d6421e
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 { for i := range datasets {
if attachment.DatasetID == datasets[i].ID { 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] permission, ok := permissionMap[datasets[i].ID]
if !ok { if !ok {


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


if permission { if permission {
datasets[i].Attachments = append(datasets[i].Attachments, attachment) 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