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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
08c2c94d
Commit
08c2c94d
authored
Jun 01, 2013
by
Andrey Kumanyaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug with team assignation on project from #4109
parent
ee2124b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
2 deletions
+30
-2
lib/gitlab/user_team_manager.rb
lib/gitlab/user_team_manager.rb
+2
-2
spec/lib/gitlab/user_team_manager_spec.rb
spec/lib/gitlab/user_team_manager_spec.rb
+28
-0
No files found.
lib/gitlab/user_team_manager.rb
View file @
08c2c94d
...
@@ -99,8 +99,8 @@ module Gitlab
...
@@ -99,8 +99,8 @@ module Gitlab
teams
||=
project
.
user_teams
.
with_member
(
user
)
teams
||=
project
.
user_teams
.
with_member
(
user
)
if
action
&&
(
action
==
:added
)
&&
(
teams
.
count
==
1
)
if
action
&&
(
action
==
:added
)
result_access
||=
project
.
users_project
.
with_user
(
user
).
first
.
project_access
result_access
=
project
.
users_projects
.
with_user
(
user
).
first
.
project_access
end
end
if
teams
.
any?
if
teams
.
any?
...
...
spec/lib/gitlab/user_team_manager_spec.rb
0 → 100644
View file @
08c2c94d
require
'spec_helper'
describe
Gitlab
::
UserTeamManager
do
before
do
@user
=
create
:user
@project
=
create
:project
,
creator:
@user
@master
=
create
:user
@developer
=
create
:user
@reporter
=
create
:user
@project
.
team
<<
[
@master
,
:master
]
@project
.
team
<<
[
@developer
,
:developer
]
@project
.
team
<<
[
@reporter
,
:reporter
]
@team
=
create
:user_team
,
owner:
@user
@team
.
add_members
([
@master
.
id
,
@developer
.
id
,
@reporter
.
id
],
UsersProject
::
DEVELOPER
,
false
)
end
it
"should assign team to project with correct permissions result"
do
@team
.
assign_to_project
(
@project
,
UsersProject
::
MASTER
)
@project
.
users_projects
.
find_by_user_id
(
@master
).
project_access
.
should
==
UsersProject
::
MASTER
@project
.
users_projects
.
find_by_user_id
(
@developer
).
project_access
.
should
==
UsersProject
::
DEVELOPER
@project
.
users_projects
.
find_by_user_id
(
@reporter
).
project_access
.
should
==
UsersProject
::
DEVELOPER
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