Methods
- A
- G
- P
Class Public methods
allowed(object, subject)
Link
Source: show
# File app/models/ability.rb, line 3 def allowed(object, subject) case subject.class.name when "Project" then project_abilities(object, subject) when "Issue" then issue_abilities(object, subject) when "Note" then note_abilities(object, subject) when "Snippet" then snippet_abilities(object, subject) when "MergeRequest" then merge_request_abilities(object, subject) when "Group" then group_abilities(object, subject) else [] end end
group_abilities(user, group)
Link
Source: show
# File app/models/ability.rb, line 107 def group_abilities user, group rules = [] rules << [ :manage_group ] if group.owner == user rules.flatten end
project_abilities(user, project)
Link
Source: show
# File app/models/ability.rb, line 15 def project_abilities(user, project) rules = [] # Rules based on role in project if project.master_access_for?(user) rules << project_master_rules elsif project.dev_access_for?(user) rules << project_dev_rules elsif project.report_access_for?(user) rules << project_report_rules elsif project.guest_access_for?(user) rules << project_guest_rules end if project.namespace # If user own project namespace # (Ex. group owner or account owner) if project.namespace.owner == user rules << project_admin_rules end else # For compatibility with global projects # use projects.owner_id if project.owner == user rules << project_admin_rules end end rules.flatten end
project_admin_rules()
Link
Source: show
# File app/models/ability.rb, line 99 def project_admin_rules project_master_rules + [ :change_namespace, :rename_project, :remove_project ] end
project_dev_rules()
Link
Source: show
# File app/models/ability.rb, line 74 def project_dev_rules project_report_rules + [ :write_wiki, :push_code ] end
project_guest_rules()
Link
Source: show
# File app/models/ability.rb, line 50 def project_guest_rules [ :read_project, :read_wiki, :read_issue, :read_milestone, :read_snippet, :read_team_member, :read_merge_request, :read_note, :write_project, :write_issue, :write_note ] end
project_master_rules()
Link
Source: show
# File app/models/ability.rb, line 81 def project_master_rules project_dev_rules + [ :push_code_to_protected_branches, :modify_issue, :modify_snippet, :modify_merge_request, :admin_issue, :admin_milestone, :admin_snippet, :admin_team_member, :admin_merge_request, :admin_note, :accept_mr, :admin_wiki, :admin_project ] end