Commit f208dd00 authored by Valery Sizov's avatar Valery Sizov

specs fix

parent 18c73368
......@@ -18,19 +18,33 @@ class Ability
when "GroupMember" then group_member_abilities(user, subject)
when "ProjectMember" then project_member_abilities(user, subject)
else []
end.concat(global_abilities(user))
end
abilities.concat(global_abilities(user))
abilities -= license_blocked_abilities if License.block_changes?
abilities
end
def license_blocked_abilities
[
:create_issue,
:create_merge_request,
:push_code,
:push_code_to_protected_branches
]
end
# List of possible abilities
# for non-authenticated user
def not_auth_abilities(user, subject)
project = if subject.kind_of?(Project)
def anonymous_abilities(user, subject)
project = if subject.is_a?(Project)
subject
else
elsif subject.respond_to?(:project)
subject.project
else
nil
end
if project && project.public?
......@@ -50,15 +64,12 @@ class Ability
rules - project_disabled_features_rules(project)
else
[]
end
end
def anonymous_group_abilities(subject)
group = if subject.is_a?(Group)
group = if subject.kind_of?(Group)
subject
else
elsif subject.respond_to?(:group)
subject.group
else
nil
end
if group && group.public_profile?
......@@ -67,6 +78,7 @@ class Ability
[]
end
end
end
def anonymous_personal_snippet_abilities(snippet)
if snippet.public?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment