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
Kazuhiko Shiozaki
gitlab-ce
Commits
7caaa108
Commit
7caaa108
authored
Dec 24, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9915 from huacnlee/avoid-ability-methods-allocations
Avoid allocations in Ability class.
parents
1a23af48
03a40a7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
app/models/ability.rb
app/models/ability.rb
+8
-8
No files found.
app/models/ability.rb
View file @
7caaa108
...
@@ -132,14 +132,14 @@ class Ability
...
@@ -132,14 +132,14 @@ class Ability
end
end
def
public_project_rules
def
public_project_rules
project_guest_rules
+
[
@public_project_rules
||=
project_guest_rules
+
[
:download_code
,
:download_code
,
:fork_project
:fork_project
]
]
end
end
def
project_guest_rules
def
project_guest_rules
[
@project_guest_rules
||=
[
:read_project
,
:read_project
,
:read_wiki
,
:read_wiki
,
:read_issue
,
:read_issue
,
...
@@ -157,7 +157,7 @@ class Ability
...
@@ -157,7 +157,7 @@ class Ability
end
end
def
project_report_rules
def
project_report_rules
project_guest_rules
+
[
@project_report_rules
||=
project_guest_rules
+
[
:create_commit_status
,
:create_commit_status
,
:read_commit_statuses
,
:read_commit_statuses
,
:download_code
,
:download_code
,
...
@@ -170,7 +170,7 @@ class Ability
...
@@ -170,7 +170,7 @@ class Ability
end
end
def
project_dev_rules
def
project_dev_rules
project_report_rules
+
[
@project_dev_rules
||=
project_report_rules
+
[
:admin_merge_request
,
:admin_merge_request
,
:create_merge_request
,
:create_merge_request
,
:create_wiki
,
:create_wiki
,
...
@@ -181,7 +181,7 @@ class Ability
...
@@ -181,7 +181,7 @@ class Ability
end
end
def
project_archived_rules
def
project_archived_rules
[
@project_archived_rules
||=
[
:create_merge_request
,
:create_merge_request
,
:push_code
,
:push_code
,
:push_code_to_protected_branches
,
:push_code_to_protected_branches
,
...
@@ -191,7 +191,7 @@ class Ability
...
@@ -191,7 +191,7 @@ class Ability
end
end
def
project_master_rules
def
project_master_rules
project_dev_rules
+
[
@project_master_rules
||=
project_dev_rules
+
[
:push_code_to_protected_branches
,
:push_code_to_protected_branches
,
:update_project_snippet
,
:update_project_snippet
,
:update_merge_request
,
:update_merge_request
,
...
@@ -206,7 +206,7 @@ class Ability
...
@@ -206,7 +206,7 @@ class Ability
end
end
def
project_admin_rules
def
project_admin_rules
project_master_rules
+
[
@project_admin_rules
||=
project_master_rules
+
[
:change_namespace
,
:change_namespace
,
:change_visibility_level
,
:change_visibility_level
,
:rename_project
,
:rename_project
,
...
@@ -332,7 +332,7 @@ class Ability
...
@@ -332,7 +332,7 @@ class Ability
end
end
if
snippet
.
public?
||
snippet
.
internal?
if
snippet
.
public?
||
snippet
.
internal?
rules
<<
:read_personal_snippet
rules
<<
:read_personal_snippet
end
end
rules
rules
...
...
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