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
f208dd00
Commit
f208dd00
authored
Nov 25, 2015
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
specs fix
parent
18c73368
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
22 deletions
+34
-22
app/models/ability.rb
app/models/ability.rb
+34
-22
No files found.
app/models/ability.rb
View file @
f208dd00
...
...
@@ -18,19 +18,33 @@ class Ability
when
"GroupMember"
then
group_member_abilities
(
user
,
subject
)
when
"ProjectMember"
then
project_member_abilities
(
user
,
subject
)
else
[]
end
.
concat
(
global_abilities
(
user
))
end
abilities
.
concat
(
global_abilities
(
user
))
abilities
-=
license_blocked_abilities
if
License
.
block_changes?
abilities
end
def
license_blocked_abilities
[
:create_issue
,
:create_merge_request
,
:push_code
,
:push_code_to_protected_branches
]
end
# List of possible abilities
# for non-authenticated user
def
not_auth
_abilities
(
user
,
subject
)
project
=
if
subject
.
kind_of
?
(
Project
)
def
anonymous
_abilities
(
user
,
subject
)
project
=
if
subject
.
is_a
?
(
Project
)
subject
els
e
els
if
subject
.
respond_to?
(
:project
)
subject
.
project
else
nil
end
if
project
&&
project
.
public?
...
...
@@ -50,15 +64,12 @@ class Ability
rules
-
project_disabled_features_rules
(
project
)
else
[]
end
end
def
anonymous_group_abilities
(
subject
)
group
=
if
subject
.
is_a?
(
Group
)
group
=
if
subject
.
kind_of?
(
Group
)
subject
else
elsif
subject
.
respond_to?
(
:group
)
subject
.
group
else
nil
end
if
group
&&
group
.
public_profile?
...
...
@@ -67,6 +78,7 @@ class Ability
[]
end
end
end
def
anonymous_personal_snippet_abilities
(
snippet
)
if
snippet
.
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