BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
fcd3e5d4
Commit
fcd3e5d4
authored
Jul 17, 2017
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cache the cache key...
parent
45e9d287
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
condition.rb
lib/declarative_policy/condition.rb
+8
-7
No files found.
lib/declarative_policy/condition.rb
View file @
fcd3e5d4
...
...
@@ -82,13 +82,14 @@ module DeclarativePolicy
# depending on the scope, we may cache only by the user or only by
# the subject, resulting in sharing across different policy objects.
def
cache_key
case
@condition
.
scope
when
:normal
then
"/dp/condition/
#{
@condition
.
key
}
/
#{
user_key
}
,
#{
subject_key
}
"
when
:user
then
"/dp/condition/
#{
@condition
.
key
}
/
#{
user_key
}
"
when
:subject
then
"/dp/condition/
#{
@condition
.
key
}
/
#{
subject_key
}
"
when
:global
then
"/dp/condition/
#{
@condition
.
key
}
"
else
raise
'invalid scope'
end
@cache_key
||=
case
@condition
.
scope
when
:normal
then
"/dp/condition/
#{
@condition
.
key
}
/
#{
user_key
}
,
#{
subject_key
}
"
when
:user
then
"/dp/condition/
#{
@condition
.
key
}
/
#{
user_key
}
"
when
:subject
then
"/dp/condition/
#{
@condition
.
key
}
/
#{
subject_key
}
"
when
:global
then
"/dp/condition/
#{
@condition
.
key
}
"
else
raise
'invalid scope'
end
end
def
user_key
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment