2016-09-29 09:46:39 +05:30
|
|
|
class IssuablePolicy < BasePolicy
|
|
|
|
def action_name
|
|
|
|
@subject.class.name.underscore
|
|
|
|
end
|
|
|
|
|
|
|
|
def rules
|
2017-08-17 22:00:37 +05:30
|
|
|
if @user && @subject.assignee_or_author?(@user)
|
2016-09-29 09:46:39 +05:30
|
|
|
can! :"read_#{action_name}"
|
|
|
|
can! :"update_#{action_name}"
|
|
|
|
end
|
|
|
|
|
|
|
|
delegate! @subject.project
|
|
|
|
end
|
|
|
|
end
|