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
iv
gitlab-ce
Commits
08dc3822
Commit
08dc3822
authored
Nov 17, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename `not_auth_*` ability methods to `anonymous_*`
parent
1b347565
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
app/models/ability.rb
app/models/ability.rb
+9
-10
No files found.
app/models/ability.rb
View file @
08dc3822
class
Ability
class
<<
self
def
allowed
(
user
,
subject
)
return
not_auth
_abilities
(
user
,
subject
)
if
user
.
nil?
return
anonymous
_abilities
(
user
,
subject
)
if
user
.
nil?
return
[]
unless
user
.
is_a?
(
User
)
return
[]
if
user
.
blocked?
...
...
@@ -19,22 +19,21 @@ class Ability
end
.
concat
(
global_abilities
(
user
))
end
# List of possible abilities
# for non-authenticated user
def
not_auth_abilities
(
user
,
subject
)
# List of possible abilities for anonymous user
def
anonymous_abilities
(
user
,
subject
)
case
true
when
subject
.
is_a?
(
PersonalSnippet
)
not_auth
_personal_snippet_abilities
(
subject
)
anonymous
_personal_snippet_abilities
(
subject
)
when
subject
.
is_a?
(
Project
)
||
subject
.
respond_to?
(
:project
)
not_auth
_project_abilities
(
subject
)
anonymous
_project_abilities
(
subject
)
when
subject
.
is_a?
(
Group
)
||
subject
.
respond_to?
(
:group
)
not_auth
_group_abilities
(
subject
)
anonymous
_group_abilities
(
subject
)
else
[]
end
end
def
not_auth
_project_abilities
(
subject
)
def
anonymous
_project_abilities
(
subject
)
project
=
if
subject
.
is_a?
(
Project
)
subject
else
...
...
@@ -62,7 +61,7 @@ class Ability
end
end
def
not_auth
_group_abilities
(
subject
)
def
anonymous
_group_abilities
(
subject
)
group
=
if
subject
.
is_a?
(
Group
)
subject
else
...
...
@@ -76,7 +75,7 @@ class Ability
end
end
def
not_auth
_personal_snippet_abilities
(
snippet
)
def
anonymous
_personal_snippet_abilities
(
snippet
)
if
snippet
.
public?
[
:read_personal_snippet
]
else
...
...
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