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
59c3968c
Commit
59c3968c
authored
Jun 14, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use update service on ldap call and updated specs and service
parent
cf628631
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
app/services/users/update_service.rb
app/services/users/update_service.rb
+20
-4
lib/gitlab/o_auth/user.rb
lib/gitlab/o_auth/user.rb
+1
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+0
-1
No files found.
app/services/users/update_service.rb
View file @
59c3968c
...
@@ -7,14 +7,30 @@ module Users
...
@@ -7,14 +7,30 @@ module Users
@params
=
params
.
dup
@params
=
params
.
dup
end
end
def
execute
(
skip_authorization:
false
)
def
execute
(
skip_authorization:
false
,
&
block
)
raise
Gitlab
::
Access
::
AccessDeniedError
unless
skip_authorization
||
can_update_user?
assign_attributes
(
skip_authorization
,
&
block
)
if
@user
.
update_attributes
(
params
)
if
@user
.
save
success
success
else
else
error
(
'Project could not be updated'
)
error
(
'User could not be updated'
)
end
end
def
execute!
(
skip_authorization:
false
,
&
block
)
assign_attributes
(
skip_authorization
,
&
block
)
@user
.
save!
end
end
private
def
assign_attributes
(
skip_authorization
,
&
block
)
raise
Gitlab
::
Access
::
AccessDeniedError
unless
skip_authorization
||
can_update_user?
yield
(
@user
)
if
block_given?
@user
.
assign_attributes
(
params
)
if
params
.
any?
end
end
def
can_update_user?
def
can_update_user?
...
...
lib/gitlab/o_auth/user.rb
View file @
59c3968c
...
@@ -32,7 +32,7 @@ module Gitlab
...
@@ -32,7 +32,7 @@ module Gitlab
block_after_save
=
needs_blocking?
block_after_save
=
needs_blocking?
gl_user
.
sav
e!
Users
::
UpdateService
.
new
(
gl_user
,
gl_user
).
execut
e!
gl_user
.
block
if
block_after_save
gl_user
.
block
if
block_after_save
...
...
spec/models/user_spec.rb
View file @
59c3968c
...
@@ -1900,7 +1900,6 @@ describe User, models: true do
...
@@ -1900,7 +1900,6 @@ describe User, models: true do
end
end
end
end
describe
'audit changes'
do
describe
'audit changes'
do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user
)
{
create
(
:user
)
}
...
...
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