Commit 2099aa38 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #7131 from skv-headless/per_request_rules_caching

per request project rules caching
parents c50f8951 8ec02ed9
......@@ -173,6 +173,7 @@ gem "font-awesome-rails", '~> 3.2'
gem "gitlab_emoji", "~> 0.0.1.1"
gem "gon", '~> 5.0.0'
gem 'nprogress-rails'
gem 'request_store'
group :development do
gem "annotate", "~> 2.6.0.beta2"
......
......@@ -409,6 +409,7 @@ GEM
redis-store (1.1.4)
redis (>= 2.2)
ref (1.0.5)
request_store (1.0.5)
require_all (1.3.2)
rest-client (1.6.7)
mime-types (>= 1.16)
......@@ -647,6 +648,7 @@ DEPENDENCIES
rb-inotify
redcarpet (~> 2.2.2)
redis-rails
request_store
rspec-rails
sanitize (~> 2.0)
sass-rails (~> 4.0.2)
......
......@@ -67,7 +67,8 @@ class Ability
def project_abilities(user, project)
rules = []
key = "/user/#{user.id}/project/#{project.id}"
RequestStore.store[key] ||= begin
team = project.team
# Rules based on role in project
......@@ -102,6 +103,7 @@ class Ability
rules
end
end
def public_project_rules
project_guest_rules + [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment