diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-21 21:09:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-21 21:09:45 +0300 |
commit | 36b0a5b87569e1b0e9f193630e50d1a376a71a4a (patch) | |
tree | 149dc553a092cd184bd196877d98964b4f8b3825 /lib/gitlab/user_access_snippet.rb | |
parent | a6578252111f8ce77de356eca6fd55c470893d54 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/user_access_snippet.rb')
-rw-r--r-- | lib/gitlab/user_access_snippet.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/gitlab/user_access_snippet.rb b/lib/gitlab/user_access_snippet.rb index dcd45f9350d..3d1ec800091 100644 --- a/lib/gitlab/user_access_snippet.rb +++ b/lib/gitlab/user_access_snippet.rb @@ -2,6 +2,7 @@ module Gitlab class UserAccessSnippet < UserAccess + extend ::Gitlab::Utils::Override extend ::Gitlab::Cache::RequestCache # TODO: apply override check https://gitlab.com/gitlab-org/gitlab/issues/205677 @@ -9,11 +10,10 @@ module Gitlab [user&.id, snippet&.id] end - attr_reader :snippet + alias_method :snippet, :container def initialize(user, snippet: nil) - @user = user - @snippet = snippet + super(user, container: snippet) @project = snippet&.project end @@ -43,13 +43,9 @@ module Gitlab def can_push_to_branch?(ref) return true if snippet_migration? - - super - return false unless snippet - return false unless can_do_action?(:update_snippet) - true + can_do_action?(:update_snippet) end def can_merge_to_branch?(ref) @@ -59,5 +55,8 @@ module Gitlab def snippet_migration? user&.migration_bot? && snippet end + + override :project + attr_reader :project end end |