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
888e493b
Commit
888e493b
authored
May 30, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update membership instead of remove/add if it permissions were changed
parent
31fdcac1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
lib/gitlab/user_team_manager.rb
lib/gitlab/user_team_manager.rb
+10
-4
No files found.
lib/gitlab/user_team_manager.rb
View file @
888e493b
...
@@ -80,12 +80,18 @@ module Gitlab
...
@@ -80,12 +80,18 @@ module Gitlab
def
update_team_user_access_in_project
(
team
,
user
,
project
,
action
)
def
update_team_user_access_in_project
(
team
,
user
,
project
,
action
)
granted_access
=
max_teams_member_permission_in_project
(
user
,
project
,
action
)
granted_access
=
max_teams_member_permission_in_project
(
user
,
project
,
action
)
project_team_user
=
UsersProject
.
find_by_user_id_and_project_id
(
user
.
id
,
project
.
id
)
project_team_user
=
UsersProject
.
find_by_user_id_and_project_id
(
user
.
id
,
project
.
id
)
if
granted_access
.
zero?
project_team_user
.
destroy
if
project_team_user
.
present?
project_team_user
.
destroy
if
project_team_user
.
present?
return
end
# project_team_user.project_access != granted_access
if
project_team_user
.
present?
project
.
team
<<
[
user
,
granted_access
]
if
granted_access
>
0
project_team_user
.
update_attributes
(
project_access:
granted_access
)
else
project
.
team
<<
[
user
,
granted_access
]
end
end
end
def
max_teams_member_permission_in_project
(
user
,
project
,
action
=
nil
,
teams
=
nil
)
def
max_teams_member_permission_in_project
(
user
,
project
,
action
=
nil
,
teams
=
nil
)
...
...
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