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
a5444564
Commit
a5444564
authored
Apr 26, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memoization and rename #owner to #owner?
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
dc26a76e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
app/policies/project_policy.rb
app/policies/project_policy.rb
+7
-5
No files found.
app/policies/project_policy.rb
View file @
a5444564
...
...
@@ -4,9 +4,9 @@ class ProjectPolicy < BasePolicy
def
rules
team_access!
(
user
)
owner_access!
if
user
.
admin?
||
owner
owner_access!
if
user
.
admin?
||
owner
?
auditor_access!
if
user
.
auditor?
team_member_owner_access!
if
owner
team_member_owner_access!
if
owner
?
if
project
.
public?
||
(
project
.
internal?
&&
!
user
.
external?
)
guest_access!
...
...
@@ -26,8 +26,10 @@ class ProjectPolicy < BasePolicy
@subject
end
def
owner
@owner
||=
project
.
owner
==
user
||
def
owner?
return
@owner
if
defined?
(
@owner
)
@owner
=
project
.
owner
==
user
||
(
project
.
group
&&
project
.
group
.
has_owner?
(
user
))
end
...
...
@@ -279,7 +281,7 @@ class ProjectPolicy < BasePolicy
def
access_requestable?
project
.
request_access_enabled
&&
!
owner
&&
!
owner
?
&&
!
user
.
admin?
&&
!
project
.
team
.
member?
(
user
)
&&
!
project_group_member?
(
user
)
...
...
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