2015-03-18 22:02:38 +00:00
|
|
|
class PullRequestPolicy < ApplicationPolicy
|
|
|
|
|
2015-04-01 01:47:32 +01:00
|
|
|
def index?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2015-03-18 22:02:38 +00:00
|
|
|
def show?
|
2015-04-06 23:35:48 +01:00
|
|
|
is_admin? || ProjectPolicy.new(user, record.to_project).show?
|
2015-03-18 22:02:38 +00:00
|
|
|
end
|
|
|
|
alias_method :read?, :show?
|
|
|
|
alias_method :commits?, :show?
|
|
|
|
alias_method :files?, :show?
|
|
|
|
|
|
|
|
def create?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def update?
|
2015-04-06 23:35:48 +01:00
|
|
|
is_admin? || record.user_id == record.id || local_writer?(record.to_project)
|
2015-03-18 22:02:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def merge?
|
2015-04-06 23:35:48 +01:00
|
|
|
is_admin? || local_writer?(record.to_project)
|
2015-03-18 22:02:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|