mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-04 09:19:06 +01:00
Allow users with write permissions for issues to add attachments with API (#26837)
Fixes #24944 Since a user with write permissions for issues can add attachments to an issue via the the web interface, the user should also be able to add attachments via the API
This commit is contained in:
parent
02efd99010
commit
04771b5ff7
1 changed files with 1 additions and 1 deletions
|
@ -344,7 +344,7 @@ func getIssueAttachmentSafeRead(ctx *context.APIContext, issue *issues_model.Iss
|
||||||
}
|
}
|
||||||
|
|
||||||
func canUserWriteIssueAttachment(ctx *context.APIContext, issue *issues_model.Issue) bool {
|
func canUserWriteIssueAttachment(ctx *context.APIContext, issue *issues_model.Issue) bool {
|
||||||
canEditIssue := ctx.IsSigned && (ctx.Doer.ID == issue.PosterID || ctx.IsUserRepoAdmin() || ctx.IsUserSiteAdmin()) && ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull)
|
canEditIssue := ctx.IsSigned && (ctx.Doer.ID == issue.PosterID || ctx.IsUserRepoAdmin() || ctx.IsUserSiteAdmin() || ctx.Repo.CanWriteIssuesOrPulls(issue.IsPull))
|
||||||
if !canEditIssue {
|
if !canEditIssue {
|
||||||
ctx.Error(http.StatusForbidden, "", "user should have permission to write issue")
|
ctx.Error(http.StatusForbidden, "", "user should have permission to write issue")
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in a new issue