Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
9a0ea135
Commit
9a0ea135
authored
Aug 16, 2016
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
factor in global permissions
parent
29440228
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
app/policies/base_policy.rb
app/policies/base_policy.rb
+2
-2
app/policies/global_policy.rb
app/policies/global_policy.rb
+7
-0
No files found.
app/policies/base_policy.rb
View file @
9a0ea135
...
@@ -4,6 +4,8 @@ class BasePolicy
...
@@ -4,6 +4,8 @@ class BasePolicy
end
end
def
self
.
class_for
(
subject
)
def
self
.
class_for
(
subject
)
return
GlobalPolicy
if
subject
.
nil?
subject
.
class
.
ancestors
.
each
do
|
klass
|
subject
.
class
.
ancestors
.
each
do
|
klass
|
next
unless
klass
.
name
next
unless
klass
.
name
...
@@ -59,8 +61,6 @@ class BasePolicy
...
@@ -59,8 +61,6 @@ class BasePolicy
private
private
def
collect_rules
(
&
b
)
def
collect_rules
(
&
b
)
return
Set
.
new
if
@subject
.
nil?
@can
=
Set
.
new
@can
=
Set
.
new
@cannot
=
Set
.
new
@cannot
=
Set
.
new
yield
yield
...
...
app/policies/global_policy.rb
0 → 100644
View file @
9a0ea135
class
GlobalPolicy
<
BasePolicy
def
rules
return
unless
@user
can!
:create_group
if
@user
.
can_create_group
can!
:read_users_list
end
end
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