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
1954bb17
Commit
1954bb17
authored
Aug 20, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Ability#project_abilities return unique values and fix counts
parent
be95e03a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
app/models/ability.rb
app/models/ability.rb
+1
-1
spec/models/ability_spec.rb
spec/models/ability_spec.rb
+10
-9
No files found.
app/models/ability.rb
View file @
1954bb17
...
...
@@ -203,7 +203,7 @@ class Ability
rules
-=
project_archived_rules
end
rules
-
project_disabled_features_rules
(
project
)
(
rules
-
project_disabled_features_rules
(
project
)).
uniq
end
def
project_team_rules
(
team
,
user
)
...
...
spec/models/ability_spec.rb
View file @
1954bb17
...
...
@@ -191,21 +191,22 @@ describe Ability, lib: true do
admin
=
create
(
:admin
)
results
=
described_class
.
project_abilities
(
admin
,
project
)
expect
(
results
.
count
).
to
eq
(
90
)
expect
(
results
.
count
).
to
eq
(
68
)
end
it
'returns permissions for an owner'
do
results
=
described_class
.
project_abilities
(
project
.
owner
,
project
)
expect
(
results
.
count
).
to
eq
(
90
)
expect
(
results
.
count
).
to
eq
(
68
)
end
it
'returns permissions for a
guest
'
do
project
.
team
<<
[
user
,
:
guest
]
it
'returns permissions for a
master
'
do
project
.
team
<<
[
user
,
:
master
]
results
=
described_class
.
project_abilities
(
user
,
project
)
expect
(
results
.
count
).
to
eq
(
22
)
expect
(
results
.
count
).
to
eq
(
60
)
end
it
'returns permissions for a developer'
do
...
...
@@ -213,15 +214,15 @@ describe Ability, lib: true do
results
=
described_class
.
project_abilities
(
user
,
project
)
expect
(
results
.
count
).
to
eq
(
22
)
expect
(
results
.
count
).
to
eq
(
44
)
end
it
'returns permissions for a
master
'
do
project
.
team
<<
[
user
,
:
master
]
it
'returns permissions for a
guest
'
do
project
.
team
<<
[
user
,
:
guest
]
results
=
described_class
.
project_abilities
(
user
,
project
)
expect
(
results
.
count
).
to
eq
(
2
2
)
expect
(
results
.
count
).
to
eq
(
2
1
)
end
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