diff options
author | Sean McGivern <sean@gitlab.com> | 2019-05-02 13:13:42 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2019-05-02 13:13:42 +0300 |
commit | c1892f6c9000cacafae4f6c8992ba6c1128c8c95 (patch) | |
tree | 237c2955a1514b9be6b8b09c4bdb16323573641a /app/policies | |
parent | acb55198b4a05a0b4ac2662bf68cfeb3d744ca01 (diff) |
Remove the `comment_personal_snippet` permission
This is now entirely handled by `create_note`:
1. Project snippets prevent `create_note`.
2. Uploads already only support routing for personal snippets.
This simplifies some policies and access checks, too!
Diffstat (limited to 'app/policies')
-rw-r--r-- | app/policies/personal_snippet_policy.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/app/policies/personal_snippet_policy.rb b/app/policies/personal_snippet_policy.rb index 2b5cca76c20..40dd49b4afd 100644 --- a/app/policies/personal_snippet_policy.rb +++ b/app/policies/personal_snippet_policy.rb @@ -7,7 +7,7 @@ class PersonalSnippetPolicy < BasePolicy rule { public_snippet }.policy do enable :read_personal_snippet - enable :comment_personal_snippet + enable :create_note end rule { is_author }.policy do @@ -15,7 +15,7 @@ class PersonalSnippetPolicy < BasePolicy enable :update_personal_snippet enable :destroy_personal_snippet enable :admin_personal_snippet - enable :comment_personal_snippet + enable :create_note end rule { ~anonymous }.enable :create_personal_snippet @@ -23,15 +23,12 @@ class PersonalSnippetPolicy < BasePolicy rule { internal_snippet & ~external_user }.policy do enable :read_personal_snippet - enable :comment_personal_snippet + enable :create_note end - rule { anonymous }.prevent :comment_personal_snippet + rule { anonymous }.prevent :create_note - rule { can?(:comment_personal_snippet) }.policy do - enable :create_note - enable :award_emoji - end + rule { can?(:create_note) }.enable :award_emoji rule { full_private_access }.enable :read_personal_snippet end |