diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-04-28 22:06:27 +0000 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2017-05-10 11:09:17 +0200 |
commit | 050d92f8177513b74d6c18d75d35a62f5fa6addd (patch) | |
tree | db6caf2ce3c47d1127974384c2c78c11bd7c038f /app/models | |
parent | c26e9027d31b0735cea438eaa7bf787bc5b6e3a7 (diff) | |
download | gitlab-ce-050d92f8177513b74d6c18d75d35a62f5fa6addd.tar.gz |
Merge branch 'snippets-finder-visibility' into 'security'
Refactor snippets finder & dont return internal snippets for external users
See merge request !2094
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/snippet.rb | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/app/models/snippet.rb b/app/models/snippet.rb index abfbefdf9a0..882e2fa0594 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -152,18 +152,5 @@ class Snippet < ActiveRecord::Base where(table[:content].matches(pattern)) end - - def accessible_to(user) - return are_public unless user.present? - return all if user.admin? - - where( - 'visibility_level IN (:visibility_levels) - OR author_id = :author_id - OR project_id IN (:project_ids)', - visibility_levels: [Snippet::PUBLIC, Snippet::INTERNAL], - author_id: user.id, - project_ids: user.authorized_projects.select(:id)) - end end end |