2016-08-16 14:10:34 -04:00
|
|
|
class IssuablePolicy < BasePolicy
|
2017-04-06 17:06:42 -04:00
|
|
|
delegate { @subject.project }
|
2016-08-16 14:10:34 -04:00
|
|
|
|
2017-04-06 17:06:42 -04:00
|
|
|
desc "User is the assignee or author"
|
|
|
|
condition(:assignee_or_author) do
|
|
|
|
@user && @subject.assignee_or_author?(@user)
|
|
|
|
end
|
2016-08-16 14:10:34 -04:00
|
|
|
|
2017-04-06 17:06:42 -04:00
|
|
|
rule { assignee_or_author }.policy do
|
|
|
|
enable :read_issue
|
|
|
|
enable :update_issue
|
|
|
|
enable :read_merge_request
|
|
|
|
enable :update_merge_request
|
2016-08-16 14:10:34 -04:00
|
|
|
end
|
|
|
|
end
|