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
Léo-Paul Géneau
gitlab-ce
Commits
0447c731
Commit
0447c731
authored
Jun 02, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4161 from Undev/fix-#4109
Fix bug with team assignation on project from #4109
parents
c2280985
41f88f46
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 @
0447c731
...
...
@@ -99,8 +99,8 @@ module Gitlab
teams
||=
project
.
user_teams
.
with_member
(
user
)
if
action
&&
(
action
==
:added
)
&&
(
teams
.
count
==
1
)
result_access
||=
project
.
users_project
.
with_user
(
user
).
first
.
project_access
if
action
&&
(
action
==
:added
)
result_access
=
project
.
users_projects
.
with_user
(
user
).
first
.
project_access
if
project
.
users_projects
.
with_user
(
user
).
any?
end
if
teams
.
any?
...
...
spec/lib/gitlab/user_team_manager_spec.rb
0 → 100644
View file @
0447c731
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