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
270b7ce8
Commit
270b7ce8
authored
Jun 19, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability for admin to edit user identity
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
228da2dd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
6 deletions
+52
-6
CHANGELOG
CHANGELOG
+1
-1
app/controllers/admin/identities_controller.rb
app/controllers/admin/identities_controller.rb
+22
-4
app/views/admin/identities/_form.html.haml
app/views/admin/identities/_form.html.haml
+19
-0
app/views/admin/identities/_identity.html.haml
app/views/admin/identities/_identity.html.haml
+3
-0
app/views/admin/identities/edit.html.haml
app/views/admin/identities/edit.html.haml
+6
-0
config/routes.rb
config/routes.rb
+1
-1
No files found.
CHANGELOG
View file @
270b7ce8
...
@@ -7,7 +7,7 @@ v 7.13.0 (unreleased)
...
@@ -7,7 +7,7 @@ v 7.13.0 (unreleased)
- Rename "Design" profile settings page to "Preferences".
- Rename "Design" profile settings page to "Preferences".
- Allow users to customize their default Dashboard page.
- Allow users to customize their default Dashboard page.
- Update ssl_ciphers in Nginx example to remove DHE settings. This will deny forward secrecy for Android 2.3.7, Java 6 and OpenSSL 0.9.8
- Update ssl_ciphers in Nginx example to remove DHE settings. This will deny forward secrecy for Android 2.3.7, Java 6 and OpenSSL 0.9.8
- Admin can remove user identities
- Admin can
edit and
remove user identities
v 7.12.0 (unreleased)
v 7.12.0 (unreleased)
- Fix post-receive errors on a push when an external issue tracker is configured (Stan Hu)
- Fix post-receive errors on a push when an external issue tracker is configured (Stan Hu)
...
...
app/controllers/admin/identities_controller.rb
View file @
270b7ce8
class
Admin::IdentitiesController
<
Admin
::
ApplicationController
class
Admin::IdentitiesController
<
Admin
::
ApplicationController
before_action
:user
,
only:
[
:destroy
]
before_action
:user
before_action
:identity
def
destroy
def
edit
identity
=
user
.
identities
.
find
(
params
[
:id
])
end
def
update
if
@identity
.
update_attributes
(
identity_params
)
redirect_to
admin_user_path
(
@user
),
notice:
'User identity was successfully updated.'
else
render
:edit
end
end
def
destroy
respond_to
do
|
format
|
respond_to
do
|
format
|
if
identity
.
destroy
if
@
identity
.
destroy
format
.
html
{
redirect_to
[
:admin
,
user
],
notice:
'User identity was successfully removed.'
}
format
.
html
{
redirect_to
[
:admin
,
user
],
notice:
'User identity was successfully removed.'
}
else
else
format
.
html
{
redirect_to
[
:admin
,
user
],
alert:
'Failed to remove user identity.'
}
format
.
html
{
redirect_to
[
:admin
,
user
],
alert:
'Failed to remove user identity.'
}
...
@@ -18,4 +28,12 @@ class Admin::IdentitiesController < Admin::ApplicationController
...
@@ -18,4 +28,12 @@ class Admin::IdentitiesController < Admin::ApplicationController
def
user
def
user
@user
||=
User
.
find_by!
(
username:
params
[
:user_id
])
@user
||=
User
.
find_by!
(
username:
params
[
:user_id
])
end
end
def
identity
@identity
||=
user
.
identities
.
find
(
params
[
:id
])
end
def
identity_params
params
[
:identity
].
permit
(
:provider
,
:extern_uid
)
end
end
end
app/views/admin/identities/_form.html.haml
0 → 100644
View file @
270b7ce8
=
form_for
[
:admin
,
@user
,
@identity
],
html:
{
class:
'form-horizontal fieldset-form'
}
do
|
f
|
-
if
@identity
.
errors
.
any?
#error_explanation
.alert.alert-danger
-
@identity
.
errors
.
full_messages
.
each
do
|
msg
|
%p
=
msg
.form-group
=
f
.
label
:provider
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:provider
,
required:
true
,
autocomplete:
"off"
,
class:
'form-control'
,
required:
true
.form-group
=
f
.
label
:extern_uid
,
class:
'control-label'
.col-sm-10
=
f
.
text_field
:extern_uid
,
required:
true
,
autocomplete:
"off"
,
class:
'form-control'
,
required:
true
.form-actions
=
f
.
submit
'Save changes'
,
class:
"btn btn-save"
app/views/admin/identities/_identity.html.haml
View file @
270b7ce8
...
@@ -4,6 +4,9 @@
...
@@ -4,6 +4,9 @@
%td
%td
=
identity
.
extern_uid
=
identity
.
extern_uid
%td
%td
=
link_to
edit_admin_user_identity_path
(
@user
,
identity
),
class:
'btn btn-xs btn-grouped'
do
%i
.fa.fa-edit
Edit
=
link_to
[
:admin
,
@user
,
identity
],
method: :delete
,
=
link_to
[
:admin
,
@user
,
identity
],
method: :delete
,
class:
'btn btn-xs btn-danger'
,
class:
'btn btn-xs btn-danger'
,
data:
{
confirm:
"Are you sure you want to remove this identity"
}
do
data:
{
confirm:
"Are you sure you want to remove this identity"
}
do
...
...
app/views/admin/identities/edit.html.haml
0 → 100644
View file @
270b7ce8
-
page_title
@user
.
name
,
"Users"
%h3
.page-title
Edit identity for
#{
@user
.
name
}
%hr
=
render
'form'
config/routes.rb
View file @
270b7ce8
...
@@ -149,7 +149,7 @@ Gitlab::Application.routes.draw do
...
@@ -149,7 +149,7 @@ Gitlab::Application.routes.draw do
namespace
:admin
do
namespace
:admin
do
resources
:users
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-]+/
}
do
resources
:users
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-]+/
}
do
resources
:keys
,
only:
[
:show
,
:destroy
]
resources
:keys
,
only:
[
:show
,
:destroy
]
resources
:identities
,
only:
[
:destroy
]
resources
:identities
,
only:
[
:
edit
,
:update
,
:
destroy
]
member
do
member
do
put
:team_update
put
:team_update
...
...
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