Commit 270b7ce8 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add ability for admin to edit user identity

Signed-off-by: default avatarDmitriy Zaporozhets <>
parent 228da2dd
......@@ -7,7 +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
- Admin can edit and remove user identities
v 7.12.0 (unreleased)
- Fix post-receive errors on a push when an external issue tracker is configured (Stan Hu)
class Admin::IdentitiesController < Admin::ApplicationController
before_action :user, only: [:destroy]
before_action :user
before_action :identity
def destroy
identity = user.identities.find(params[:id])
def edit
def update
if @identity.update_attributes(identity_params)
redirect_to admin_user_path(@user), notice: 'User identity was successfully updated.'
render :edit
def destroy
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], alert: 'Failed to remove user identity.' }
......@@ -18,4 +28,12 @@ def destroy
def user
@user ||= User.find_by!(username: params[:user_id])
def identity
@identity ||= user.identities.find(params[:id])
def identity_params
params[:identity].permit(:provider, :extern_uid)
= form_for [:admin, @user, @identity], html: { class: 'form-horizontal fieldset-form' } do |f|
-if @identity.errors.any?
- @identity.errors.full_messages.each do |msg|
%p= msg
= f.label :provider, class: 'control-label'
= f.text_field :provider, required: true, autocomplete: "off", class: 'form-control', required: true
= f.label :extern_uid, class: 'control-label'
= f.text_field :extern_uid, required: true, autocomplete: "off", class: 'form-control', required: true
= f.submit 'Save changes', class: "btn btn-save"
......@@ -4,6 +4,9 @@
= identity.extern_uid
= link_to edit_admin_user_identity_path(@user, identity), class: 'btn btn-xs btn-grouped' do
= 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
- page_title, "Users"
Edit identity for #{}
= render 'form'
......@@ -149,7 +149,7 @@
namespace :admin do
resources :users, constraints: { id: /[a-zA-Z.\/0-9_\-]+/ } do
resources :keys, only: [:show, :destroy]
resources :identities, only: [:destroy]
resources :identities, only: [:edit, :update, :destroy]
member do
put :team_update
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment