diff options
author | http://jneen.net/ <jneen@jneen.net> | 2016-08-23 17:56:41 -0700 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2016-08-30 11:39:22 -0700 |
commit | b3b7fb1fe7b876487b1464aa5779bacec7276742 (patch) | |
tree | e4bb681b7facae1e2664f8c3b9e4d01909da4942 /app/models/ability.rb | |
parent | 35779223a69c22806bbb48d70086c7fb9a23f513 (diff) | |
download | gitlab-ce-b3b7fb1fe7b876487b1464aa5779bacec7276742.tar.gz |
remove the rest of the dead code
Diffstat (limited to 'app/models/ability.rb')
-rw-r--r-- | app/models/ability.rb | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/app/models/ability.rb b/app/models/ability.rb index b57ada715df..8ccbb9bee9c 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -63,79 +63,5 @@ class Ability def uncached_allowed(user, subject) BasePolicy.class_for(subject).abilities(user, subject) end - - def abilities_by_subject_class(user:, subject:) - case subject - when ExternalIssue, Deployment, Environment then project_abilities(user, subject.project) - else [] - end + global_abilities(user) - end - - # List of possible abilities for anonymous user - def anonymous_abilities(subject) - if subject.respond_to?(:project) - ProjectPolicy.abilities(nil, subject.project) - elsif subject.respond_to?(:group) - GroupPolicy.abilities(nil, subject.group) - else - [] - end - end - - def global_abilities(user) - rules = [] - rules << :create_group if user.can_create_group - rules << :read_users_list - rules - end - - def project_abilities(user, project) - # temporary patch, deleteme before merge - ProjectPolicy.abilities(user, project).to_a - end - - def project_member_abilities(user, subject) - rules = [] - target_user = subject.user - project = subject.project - - unless target_user == project.owner - can_manage = allowed?(user, :admin_project_member, project) - - if can_manage - rules << :update_project_member - rules << :destroy_project_member - elsif user == target_user - rules << :destroy_project_member - end - end - - rules - end - - def filter_build_abilities(rules) - # If we can't read build we should also not have that - # ability when looking at this in context of commit_status - %w(read create update admin).each do |rule| - rules.delete(:"#{rule}_commit_status") unless rules.include?(:"#{rule}_build") - end - rules - end - - def restricted_public_level? - current_application_settings.restricted_visibility_levels.include?(Gitlab::VisibilityLevel::PUBLIC) - end - - def filter_confidential_issues_abilities(user, issue, rules) - return rules if user.admin? || !issue.confidential? - - unless issue.author == user || issue.assignee == user || issue.project.team.member?(user, Gitlab::Access::REPORTER) - rules.delete(:admin_issue) - rules.delete(:read_issue) - rules.delete(:update_issue) - end - - rules - end end end |