Admin can see and remove user identities

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2015-06-18 17:56:15 +02:00
parent 74a6732c0d
commit 228da2dd28
5 changed files with 49 additions and 0 deletions

View file

@ -7,6 +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
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)

View file

@ -0,0 +1,21 @@
class Admin::IdentitiesController < Admin::ApplicationController
before_action :user, only: [:destroy]
def destroy
identity = user.identities.find(params[:id])
respond_to do |format|
if identity.destroy
format.html { redirect_to [:admin, user], notice: 'User identity was successfully removed.' }
else
format.html { redirect_to [:admin, user], alert: 'Failed to remove user identity.' }
end
end
end
protected
def user
@user ||= User.find_by!(username: params[:user_id])
end
end

View file

@ -0,0 +1,11 @@
%tr
%td
= identity.provider
%td
= identity.extern_uid
%td
= link_to [:admin, @user, identity], method: :delete,
class: 'btn btn-xs btn-danger',
data: { confirm: "Are you sure you want to remove this identity" } do
%i.fa.fa-trash
Delete

View file

@ -23,6 +23,8 @@
%a{"data-toggle" => "tab", href: "#projects"} Projects %a{"data-toggle" => "tab", href: "#projects"} Projects
%li %li
%a{"data-toggle" => "tab", href: "#ssh-keys"} SSH keys %a{"data-toggle" => "tab", href: "#ssh-keys"} SSH keys
%li
%a{"data-toggle" => "tab", href: "#identities"} Identities
.tab-content .tab-content
#account.tab-pane.active #account.tab-pane.active
@ -230,3 +232,15 @@
%i.fa.fa-times %i.fa.fa-times
#ssh-keys.tab-pane #ssh-keys.tab-pane
= render 'profiles/keys/key_table', admin: true = render 'profiles/keys/key_table', admin: true
#identities.tab-pane
- if @user.identities.present?
%table.table
%thead
%tr
%th Provider
%th Id
%th
= render @user.identities
- else
%h4 This user has no identities

View file

@ -149,6 +149,8 @@ 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]
member do member do
put :team_update put :team_update
put :block put :block