diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-07-18 15:16:43 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-07-18 15:16:43 +0300 |
commit | 3c7cb6ad9e9d74c0f2fb7e8ba19f258c7316f445 (patch) | |
tree | befe2a0188971eb69052e6ca4f6280a57781697c /lib/gitlab/user_access.rb | |
parent | 65e722ee977a3fcd44fb272aa716dfa679385759 (diff) | |
parent | f3e682c03fa84adea99d55ac74e32d53164cd99b (diff) |
Merge remote-tracking branch 'upstream/master' into 30634-protected-pipeline
* upstream/master: (25 commits)
Remove unneeded asserts and add tests for inactive RequestStore
Rename the methods to make it fit with current name
Follow feedback on the merge request
Make sure it checks against the tag only when it's a tag
Renamed Gitaly services
fix transient rspec failure due to Poll.js race condition
Refactor variables initialization in dropzone_input.js
cache the cache key...
avoid #respond_to? in Cache.id_for
cache DeclarativePolicy.class_for at the class level
Update 9.3-to-9.4.md
fix padding on filtered search dropdown. Styles should only apply to li in list
Cache Note#notable for commits and fix tests
Add changelog entry
Update the comments for the new functionality
Use RequestStoreWrap for Commit#author
Skip dead jobs queue for web hooks and project services
Add RequestStoreWrap to cache via RequestStore
Don't track cached queries in Gitlab::PerformanceBar::PeekQueryTracker
Add changelog entry
...
Diffstat (limited to 'lib/gitlab/user_access.rb')
-rw-r--r-- | lib/gitlab/user_access.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb index d8b043f5021..c63b98500ee 100644 --- a/lib/gitlab/user_access.rb +++ b/lib/gitlab/user_access.rb @@ -1,8 +1,8 @@ module Gitlab class UserAccess - extend Gitlab::Cache::RequestStoreWrap + extend Gitlab::Cache::RequestCache - request_store_wrap_key do + request_cache_key do [user&.id, project&.id] end @@ -34,7 +34,7 @@ module Gitlab true end - def can_create_tag?(ref) + request_cache def can_create_tag?(ref) return false unless can_access_git? if ProtectedTag.protected?(project, ref) @@ -44,7 +44,7 @@ module Gitlab end end - def can_delete_branch?(ref) + request_cache def can_delete_branch?(ref) return false unless can_access_git? if ProtectedBranch.protected?(project, ref) @@ -58,7 +58,7 @@ module Gitlab can_push_to_branch?(ref) || can_merge_to_branch?(ref) end - request_store_wrap def can_push_to_branch?(ref) + request_cache def can_push_to_branch?(ref) return false unless can_access_git? if ProtectedBranch.protected?(project, ref) @@ -70,7 +70,7 @@ module Gitlab end end - request_store_wrap def can_merge_to_branch?(ref) + request_cache def can_merge_to_branch?(ref) return false unless can_access_git? if ProtectedBranch.protected?(project, ref) |