summaryrefslogtreecommitdiff
path: root/app/policies/issuable_policy.rb
blob: daf6fa9e18acd5c1cfeb9be7ae302e0217ca8a01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class IssuablePolicy < BasePolicy
  delegate { @subject.project }

  desc "User is the assignee or author"
  condition(:assignee_or_author) do
    @user && @subject.assignee_or_author?(@user)
  end

  rule { assignee_or_author }.policy do
    enable :read_issue
    enable :update_issue
    enable :read_merge_request
    enable :update_merge_request
  end
end