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
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
23 deletions
+35
-23
app/models/ability.rb
app/models/ability.rb
+34
-22
app/models/project.rb
app/models/project.rb
+1
-1
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,21 +64,19 @@ class Ability
rules
-
project_disabled_features_rules
(
project
)
else
[]
end
end
def
anonymous_group_abilities
(
subject
)
group
=
if
subject
.
is_a?
(
Group
)
subject
else
subject
.
group
end
group
=
if
subject
.
kind_of?
(
Group
)
subject
elsif
subject
.
respond_to?
(
:group
)
subject
.
group
else
nil
end
if
group
&&
group
.
public_profile?
[
:read_group
]
else
[]
if
group
&&
group
.
public_profile?
[
:read_group
]
else
[]
end
end
end
...
...
@@ -378,10 +390,10 @@ class Ability
def
abilities
@abilities
||=
begin
abilities
=
Six
.
new
abilities
<<
self
abilities
end
abilities
=
Six
.
new
abilities
<<
self
abilities
end
end
private
...
...
app/models/project.rb
View file @
f208dd00
...
...
@@ -77,7 +77,7 @@ class Project < ActiveRecord::Base
has_one
:git_hook
,
dependent: :destroy
has_one
:last_event
,
->
{
order
'events.created_at DESC'
},
class_name:
'Event'
,
foreign_key:
'project_id'
# Project services
# Project services
has_many
:services
has_one
:gitlab_ci_service
,
dependent: :destroy
has_one
:campfire_service
,
dependent: :destroy
...
...
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