diff options
author | http://jneen.net/ <jneen@jneen.net> | 2016-08-16 15:31:01 -0700 |
---|---|---|
committer | http://jneen.net/ <jneen@jneen.net> | 2016-08-30 11:39:22 -0700 |
commit | 4016c5351362a409b9d8bb258e0330089cdb4394 (patch) | |
tree | 0d8db3f39c53eb7642afe360313f5547f506cc49 | |
parent | 3fdcebfdda31b0cc0f5641489bb4066b1f815df3 (diff) | |
download | gitlab-ce-4016c5351362a409b9d8bb258e0330089cdb4394.tar.gz |
port personal snippets
-rw-r--r-- | app/models/ability.rb | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/app/models/ability.rb b/app/models/ability.rb index 323597c8888..c5392379b32 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -73,7 +73,6 @@ class Ability def abilities_by_subject_class(user:, subject:) case subject - when PersonalSnippet then personal_snippet_abilities(user, subject) when Group then group_abilities(user, subject) when Namespace then namespace_abilities(user, subject) when GroupMember then group_member_abilities(user, subject) @@ -87,11 +86,7 @@ class Ability # List of possible abilities for anonymous user def anonymous_abilities(subject) - if subject.is_a?(PersonalSnippet) - anonymous_personal_snippet_abilities(subject) - elsif subject.is_a?(ProjectSnippet) - anonymous_project_snippet_abilities(subject) - elsif subject.respond_to?(:project) + if subject.respond_to?(:project) ProjectPolicy.abilities(nil, subject.project) elsif subject.is_a?(Group) || subject.respond_to?(:group) anonymous_group_abilities(subject) @@ -153,14 +148,6 @@ class Ability rules end - def anonymous_personal_snippet_abilities(snippet) - if snippet.public? - [:read_personal_snippet] - else - [] - end - end - def anonymous_user_abilities [:read_user] unless restricted_public_level? end @@ -232,24 +219,6 @@ class Ability rules.flatten end - def personal_snippet_abilities(user, snippet) - rules = [] - - if snippet.author == user - rules += [ - :read_personal_snippet, - :update_personal_snippet, - :admin_personal_snippet - ] - end - - if snippet.public? || (snippet.internal? && !user.external?) - rules << :read_personal_snippet - end - - rules - end - def group_member_abilities(user, subject) rules = [] target_user = subject.user |