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-03-25 00:17:17 +00:00
|
|
|
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?
|
|
|
|
record.user_id == record.id || local_writer?(record.to_project)
|
|
|
|
end
|
|
|
|
|
|
|
|
def merge?
|
|
|
|
local_writer?(record.to_project)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|