Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-18 18:56:15 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-19 16:29:52 +0300
commit228da2dd28a91b3ab2729787e93e72940975a2bd (patch)
treedf1741c721712cf758034e5a579fd5a91f91d8b0
parent74a6732c0dfc1416cad382203544d9c4d6246f58 (diff)
Admin can see and remove user identities
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/admin/identities_controller.rb21
-rw-r--r--app/views/admin/identities/_identity.html.haml11
-rw-r--r--app/views/admin/users/show.html.haml14
-rw-r--r--config/routes.rb2
5 files changed, 49 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 86de9314d80..a6c2f9ac0cb 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@ v 7.13.0 (unreleased)
- Rename "Design" profile settings page to "Preferences".
- 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
+ - Admin can remove user identities
v 7.12.0 (unreleased)
- Fix post-receive errors on a push when an external issue tracker is configured (Stan Hu)
diff --git a/app/controllers/admin/identities_controller.rb b/app/controllers/admin/identities_controller.rb
new file mode 100644
index 00000000000..6107b1bcb40
--- /dev/null
+++ b/app/controllers/admin/identities_controller.rb
@@ -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
diff --git a/app/views/admin/identities/_identity.html.haml b/app/views/admin/identities/_identity.html.haml
new file mode 100644
index 00000000000..b94edefaa41
--- /dev/null
+++ b/app/views/admin/identities/_identity.html.haml
@@ -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
diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml
index f7195ac3326..1546e069863 100644
--- a/app/views/admin/users/show.html.haml
+++ b/app/views/admin/users/show.html.haml
@@ -23,6 +23,8 @@
%a{"data-toggle" => "tab", href: "#projects"} Projects
%li
%a{"data-toggle" => "tab", href: "#ssh-keys"} SSH keys
+ %li
+ %a{"data-toggle" => "tab", href: "#identities"} Identities
.tab-content
#account.tab-pane.active
@@ -230,3 +232,15 @@
%i.fa.fa-times
#ssh-keys.tab-pane
= 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
diff --git a/config/routes.rb b/config/routes.rb
index d60bc796fdb..e9ff607aafe 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -149,6 +149,8 @@ Gitlab::Application.routes.draw do
namespace :admin do
resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
resources :keys, only: [:show, :destroy]
+ resources :identities, only: [:destroy]
+
member do
put :team_update
put :block