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
end
def
public_project_rules
project_guest_rules
+
[
@public_project_rules
||=
project_guest_rules
+
[
:download_code
,
:fork_project
]
end
def
project_guest_rules
[
@project_guest_rules
||=
[
:read_project
,
:read_wiki
,
:read_issue
,
...
...
@@ -157,7 +157,7 @@ class Ability
end
def
project_report_rules
project_guest_rules
+
[
@project_report_rules
||=
project_guest_rules
+
[
:create_commit_status
,
:read_commit_statuses
,
:download_code
,
...
...
@@ -170,7 +170,7 @@ class Ability
end
def
project_dev_rules
project_report_rules
+
[
@project_dev_rules
||=
project_report_rules
+
[
:admin_merge_request
,
:create_merge_request
,
:create_wiki
,
...
...
@@ -181,7 +181,7 @@ class Ability
end
def
project_archived_rules
[
@project_archived_rules
||=
[
:create_merge_request
,
:push_code
,
:push_code_to_protected_branches
,
...
...
@@ -191,7 +191,7 @@ class Ability
end
def
project_master_rules
project_dev_rules
+
[
@project_master_rules
||=
project_dev_rules
+
[
:push_code_to_protected_branches
,
:update_project_snippet
,
:update_merge_request
,
...
...
@@ -206,7 +206,7 @@ class Ability
end
def
project_admin_rules
project_master_rules
+
[
@project_admin_rules
||=
project_master_rules
+
[
:change_namespace
,
:change_visibility_level
,
:rename_project
,
...
...
@@ -332,7 +332,7 @@ class Ability
end
if
snippet
.
public?
||
snippet
.
internal?
rules
<<
:read_personal_snippet
rules
<<
:read_personal_snippet
end
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