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