Skip to content

Commit

Permalink
Simplify permission checks
Browse files Browse the repository at this point in the history
  • Loading branch information
guillep2k committed Nov 9, 2019
1 parent fd27108 commit 72d0f5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ func UpdateIssuesCommit(doer *User, repo *Repository, commits []*PushCommit, bra
refMarked[key] = true

// FIXME: this kind of condition is all over the code, it should be consolidated in a single place
canclose := perm.IsAdmin() || perm.IsOwner() || perm.CanWrite(UnitTypeIssues) || refIssue.PosterID == doer.ID
cancomment := canclose || perm.CanRead(UnitTypeIssues)
canclose := perm.CanWrite(UnitTypeIssues) || refIssue.PosterID == doer.ID
cancomment := perm.CanRead(UnitTypeIssues)

// Don't proceed if the user can't comment
if !cancomment {
Expand Down

0 comments on commit 72d0f5f

Please sign in to comment.