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
Boxiang Sun
gitlab-ce
Commits
71765536
Commit
71765536
authored
Aug 30, 2016
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move the rules method to the top #cosmetic
parent
57def53c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
app/policies/project_policy.rb
app/policies/project_policy.rb
+27
-27
No files found.
app/policies/project_policy.rb
View file @
71765536
class
ProjectPolicy
<
BasePolicy
class
ProjectPolicy
<
BasePolicy
def
rules
team_access!
(
user
)
owner
=
user
.
admin?
||
project
.
owner
==
user
||
(
project
.
group
&&
project
.
group
.
has_owner?
(
user
))
owner_access!
if
owner
if
project
.
public?
||
(
project
.
internal?
&&
!
user
.
external?
)
guest_access!
public_access!
# Allow to read builds for internal projects
can!
:read_build
if
project
.
public_builds?
if
project
.
request_access_enabled
&&
!
(
owner
||
project
.
team
.
member?
(
user
)
||
project_group_member?
(
user
))
can!
:request_access
end
end
archived_access!
if
project
.
archived?
disabled_features!
end
def
project
def
project
@subject
@subject
end
end
...
@@ -158,33 +185,6 @@ class ProjectPolicy < BasePolicy
...
@@ -158,33 +185,6 @@ class ProjectPolicy < BasePolicy
end
end
end
end
def
rules
team_access!
(
user
)
owner
=
user
.
admin?
||
project
.
owner
==
user
||
(
project
.
group
&&
project
.
group
.
has_owner?
(
user
))
owner_access!
if
owner
if
project
.
public?
||
(
project
.
internal?
&&
!
user
.
external?
)
guest_access!
public_access!
# Allow to read builds for internal projects
can!
:read_build
if
project
.
public_builds?
if
project
.
request_access_enabled
&&
!
(
owner
||
project
.
team
.
member?
(
user
)
||
project_group_member?
(
user
))
can!
:request_access
end
end
archived_access!
if
project
.
archived?
disabled_features!
end
def
anonymous_rules
def
anonymous_rules
return
unless
project
.
public?
return
unless
project
.
public?
...
...
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