gitlab-org--gitlab-foss/app/policies/issue_policy.rb

29 lines
564 B
Ruby
Raw Normal View History

2016-08-16 14:10:34 -04:00
class IssuePolicy < IssuablePolicy
def issue
@subject
end
def rules
super
if @subject.confidential? && !can_read_confidential?
cannot! :read_issue
cannot! :admin_issue
cannot! :update_issue
cannot! :read_issue
end
end
private
def can_read_confidential?
return false unless @user
return true if @user.admin?
return true if @subject.author == @user
return true if @subject.assignee == @user
return true if @subject.project.team.member?(@user, Gitlab::Access::REPORTER)
2016-08-30 18:55:37 -04:00
2016-08-16 14:10:34 -04:00
false
end
end