2016-08-16 14:10:34 -04:00
|
|
|
class IssuablePolicy < BasePolicy
|
|
|
|
def action_name
|
|
|
|
@subject.class.name.underscore
|
|
|
|
end
|
|
|
|
|
|
|
|
def rules
|
2016-10-12 08:01:34 -04:00
|
|
|
if @user && @subject.assignee_or_author?(@user)
|
2016-08-16 14:10:34 -04:00
|
|
|
can! :"read_#{action_name}"
|
|
|
|
can! :"update_#{action_name}"
|
|
|
|
end
|
|
|
|
|
|
|
|
delegate! @subject.project
|
|
|
|
end
|
|
|
|
end
|