Commit c62f7ca4 authored by Robert Speicher's avatar Robert Speicher Committed by Robert Speicher

Merge branch 'admin_add_identity' into 'master'

Allow admin to create new user identities

Fixes #2442 

See merge request !2077
parent 8eb895ee
class Admin::IdentitiesController < Admin::ApplicationController class Admin::IdentitiesController < Admin::ApplicationController
before_action :user before_action :user
before_action :identity, except: :index before_action :identity, except: [:index, :new, :create]
def new
@identity = Identity.new
end
def create
@identity = Identity.new(identity_params)
@identity.user_id = user.id
if @identity.save
redirect_to admin_user_identities_path(@user), notice: 'User identity was successfully created.'
else
render :new
end
end
def index def index
@identities = @user.identities @identities = @user.identities
......
- page_title "Identities", @user.name, "Users" - page_title "Identities", @user.name, "Users"
= render 'admin/users/head' = render 'admin/users/head'
= link_to 'New Identity', new_admin_user_identity_path, class: 'pull-right btn btn-new'
- if @identities.present? - if @identities.present?
.table-holder .table-holder
%table.table %table.table
......
- page_title "New Identity"
%h3.page-title New identity
%hr
= render 'form'
...@@ -188,7 +188,7 @@ Rails.application.routes.draw do ...@@ -188,7 +188,7 @@ Rails.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: [:index, :edit, :update, :destroy] resources :identities, except: [:show]
delete 'stop_impersonation' => 'impersonation#destroy', on: :collection delete 'stop_impersonation' => 'impersonation#destroy', on: :collection
......
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