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
9ea80a19
Commit
9ea80a19
authored
Jul 05, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix condition in Ability and start with cheaper checks
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
22ba5d8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
app/models/ability.rb
app/models/ability.rb
+7
-7
No files found.
app/models/ability.rb
View file @
9ea80a19
...
@@ -157,9 +157,9 @@ class Ability
...
@@ -157,9 +157,9 @@ class Ability
# Push abilities on the users team role
# Push abilities on the users team role
rules
.
push
(
*
project_team_rules
(
project
.
team
,
user
))
rules
.
push
(
*
project_team_rules
(
project
.
team
,
user
))
owner
=
project
.
owner
==
user
||
owner
=
user
.
admin?
||
(
project
.
group
&&
project
.
group
.
has_owner?
(
user
))
||
project
.
owner
==
user
||
user
.
admin?
(
project
.
group
&&
project
.
group
.
has_owner?
(
user
))
if
owner
if
owner
rules
.
push
(
*
project_owner_rules
)
rules
.
push
(
*
project_owner_rules
)
...
@@ -178,7 +178,7 @@ class Ability
...
@@ -178,7 +178,7 @@ class Ability
project
.
group
.
requesters
.
exists?
(
user_id:
user
.
id
)
project
.
group
.
requesters
.
exists?
(
user_id:
user
.
id
)
)
)
rules
<<
:request_access
unless
owner
||
project
.
team
.
member?
(
user
)
||
group_member
rules
<<
:request_access
unless
owner
||
group_member
||
project
.
team
.
member?
(
user
)
end
end
if
project
.
archived?
if
project
.
archived?
...
@@ -355,8 +355,8 @@ class Ability
...
@@ -355,8 +355,8 @@ class Ability
rules
=
[]
rules
=
[]
rules
<<
:read_group
if
can_read_group?
(
user
,
group
)
rules
<<
:read_group
if
can_read_group?
(
user
,
group
)
owner
=
group
.
has_owner?
(
user
)
||
user
.
admin?
owner
=
user
.
admin?
||
group
.
has_owner?
(
user
)
master
=
owner
||
user
.
admin?
master
=
owner
||
group
.
has_master?
(
user
)
# Only group masters and group owners can create new projects
# Only group masters and group owners can create new projects
if
master
if
master
...
@@ -376,7 +376,7 @@ class Ability
...
@@ -376,7 +376,7 @@ class Ability
]
]
end
end
if
(
group
.
public?
||
(
group
.
internal?
&&
!
user
.
external?
)
)
if
group
.
public?
||
(
group
.
internal?
&&
!
user
.
external?
)
rules
<<
:request_access
unless
group
.
users
.
include?
(
user
)
rules
<<
:request_access
unless
group
.
users
.
include?
(
user
)
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