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
95f4dd4f
Commit
95f4dd4f
authored
Sep 07, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize policy rule
parent
1feeea9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
app/policies/group_policy.rb
app/policies/group_policy.rb
+3
-2
No files found.
app/policies/group_policy.rb
View file @
95f4dd4f
...
...
@@ -15,9 +15,10 @@ class GroupPolicy < BasePolicy
condition
(
:nested_groups_supported
,
scope: :global
)
{
Group
.
supports_nested_groups?
}
condition
(
:has_parent
,
scope: :subject
)
{
@subject
.
has_parent?
}
condition
(
:share_with_group_locked
,
scope: :subject
)
{
@subject
.
share_with_group_lock?
}
condition
(
:parent_share_with_group_locked
,
scope: :subject
)
{
@subject
.
parent
&
.
share_with_group_lock?
}
condition
(
:can_change_parent_share_with_group_lock
)
{
@subject
.
has_parent?
&&
can?
(
:change_share_with_group_lock
,
@subject
.
parent
)
}
condition
(
:can_change_parent_share_with_group_lock
)
{
can?
(
:change_share_with_group_lock
,
@subject
.
parent
)
}
condition
(
:has_projects
)
do
GroupProjectsFinder
.
new
(
group:
@subject
,
current_user:
@user
).
execute
.
any?
...
...
@@ -58,7 +59,7 @@ class GroupPolicy < BasePolicy
rule
{
~
can?
(
:view_globally
)
}.
prevent
:request_access
rule
{
has_access
}.
prevent
:request_access
rule
{
owner
&
(
~
share_with_group_locked
|
~
parent_share_with_group_locked
|
can_change_parent_share_with_group_lock
)
}.
enable
:change_share_with_group_lock
rule
{
owner
&
(
~
share_with_group_locked
|
~
has_parent
|
~
parent_share_with_group_locked
|
can_change_parent_share_with_group_lock
)
}.
enable
:change_share_with_group_lock
def
access_level
return
GroupMember
::
NO_ACCESS
if
@user
.
nil?
...
...
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