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
Jérome Perrin
gitlab-ce
Commits
92446390
Commit
92446390
authored
Feb 18, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow `ProjectTeam#human_max_access` to return "Owner"
parent
c04e22fb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
app/models/project_team.rb
app/models/project_team.rb
+1
-1
spec/models/project_team_spec.rb
spec/models/project_team_spec.rb
+18
-8
No files found.
app/models/project_team.rb
View file @
92446390
...
...
@@ -136,7 +136,7 @@ class ProjectTeam
end
def
human_max_access
(
user_id
)
Gitlab
::
Access
.
options
.
key
max_member_access
(
user_id
)
Gitlab
::
Access
.
options
_with_owner
.
key
(
max_member_access
(
user_id
)
)
end
# This method assumes project and group members are eager loaded for optimal
...
...
spec/models/project_team_spec.rb
View file @
92446390
...
...
@@ -68,14 +68,24 @@ describe ProjectTeam, models: true do
end
describe
"#human_max_access"
do
it
"return master role"
do
user
=
create
:user
group
=
create
:group
group
.
add_users
([
user
.
id
],
GroupMember
::
MASTER
)
project
=
create
(
:project
,
namespace:
group
)
project
.
team
<<
[
user
,
:guest
]
expect
(
project
.
team
.
human_max_access
(
user
.
id
)).
to
eq
(
"Master"
)
it
'returns Master role'
do
user
=
create
(
:user
)
group
=
create
(
:group
)
group
.
add_master
(
user
)
project
=
build_stubbed
(
:empty_project
,
namespace:
group
)
expect
(
project
.
team
.
human_max_access
(
user
.
id
)).
to
eq
'Master'
end
it
'returns Owner role'
do
user
=
create
(
:user
)
group
=
create
(
:group
)
group
.
add_owner
(
user
)
project
=
build_stubbed
(
:empty_project
,
namespace:
group
)
expect
(
project
.
team
.
human_max_access
(
user
.
id
)).
to
eq
'Owner'
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