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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
68d90b96
Commit
68d90b96
authored
Dec 13, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract hook methods from group policies with EE-specific implementation
parent
657da7b4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
app/policies/group_member_policy.rb
app/policies/group_member_policy.rb
+5
-2
app/policies/group_policy.rb
app/policies/group_policy.rb
+8
-5
No files found.
app/policies/group_member_policy.rb
View file @
68d90b96
...
@@ -16,8 +16,11 @@ class GroupMemberPolicy < BasePolicy
...
@@ -16,8 +16,11 @@ class GroupMemberPolicy < BasePolicy
can!
:destroy_group_member
can!
:destroy_group_member
end
end
# EE-only
additional_rules!
can_override
=
Ability
.
allowed?
(
@user
,
:override_group_member
,
group
)
end
def
additional_rules!
can_override
=
Ability
.
allowed?
(
@user
,
:override_group_member
,
@subject
.
group
)
if
can_override
if
can_override
can!
:override_group_member
if
@subject
.
ldap?
can!
:override_group_member
if
@subject
.
ldap?
...
...
app/policies/group_policy.rb
View file @
68d90b96
...
@@ -34,11 +34,7 @@ class GroupPolicy < BasePolicy
...
@@ -34,11 +34,7 @@ class GroupPolicy < BasePolicy
can!
:request_access
can!
:request_access
end
end
# EE-only
additional_rules!
(
master
)
if
@subject
.
ldap_synced?
cannot!
:admin_group_member
can!
:override_group_member
if
owner
end
end
end
def
can_read_group?
def
can_read_group?
...
@@ -49,4 +45,11 @@ class GroupPolicy < BasePolicy
...
@@ -49,4 +45,11 @@ class GroupPolicy < BasePolicy
GroupProjectsFinder
.
new
(
@subject
).
execute
(
@user
).
any?
GroupProjectsFinder
.
new
(
@subject
).
execute
(
@user
).
any?
end
end
def
additional_rules!
(
master
)
if
@subject
.
ldap_synced?
cannot!
:admin_group_member
can!
:override_group_member
if
master
end
end
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