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
cf3d78e5
Commit
cf3d78e5
authored
Nov 25, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
specs fixing
parent
f208dd00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
17 deletions
+29
-17
app/models/ability.rb
app/models/ability.rb
+29
-17
No files found.
app/models/ability.rb
View file @
cf3d78e5
...
...
@@ -36,15 +36,25 @@ class Ability
]
end
# List of possible abilities
# for non-authenticated user
# List of possible abilities for anonymous user
def
anonymous_abilities
(
user
,
subject
)
case
true
when
subject
.
is_a?
(
PersonalSnippet
)
anonymous_personal_snippet_abilities
(
subject
)
when
subject
.
is_a?
(
Project
)
||
subject
.
respond_to?
(
:project
)
anonymous_project_abilities
(
subject
)
when
subject
.
is_a?
(
Group
)
||
subject
.
respond_to?
(
:group
)
anonymous_group_abilities
(
subject
)
else
[]
end
end
def
anonymous_project_abilities
(
subject
)
project
=
if
subject
.
is_a?
(
Project
)
subject
elsif
subject
.
respond_to?
(
:project
)
subject
.
project
else
nil
subject
.
project
end
if
project
&&
project
.
public?
...
...
@@ -64,19 +74,21 @@ class Ability
rules
-
project_disabled_features_rules
(
project
)
else
group
=
if
subject
.
kind_of?
(
Group
)
subject
elsif
subject
.
respond_to?
(
:group
)
subject
.
group
else
nil
end
[]
end
end
if
group
&&
group
.
public_profile?
[
:read_group
]
else
[]
end
def
anonymous_group_abilities
(
subject
)
group
=
if
subject
.
is_a?
(
Group
)
subject
else
subject
.
group
end
if
group
&&
group
.
public_profile?
[
:read_group
]
else
[]
end
end
...
...
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