Class: Kms::UsersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/kms/users_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#set_csrf_cookie_for_ng

Instance Method Details

#createObject



11
12
13
14
15
16
# File 'app/controllers/kms/users_controller.rb', line 11

def create
  user_params.merge!(password: params[:password], password_confirmation: params[:password_confirmation]) if params[:password]
  @user = User.new(user_params)
  @user.save
  render json: @user.to_json
end

#destroyObject



18
19
20
21
22
# File 'app/controllers/kms/users_controller.rb', line 18

def destroy 
  @user = User.find(params[:id])
  @user.destroy
  render json: @user.to_json
end

#indexObject



7
8
9
# File 'app/controllers/kms/users_controller.rb', line 7

def index
  render json: User.all.to_json(except: [:created_at, :updated_at], methods: :localized_role)
end

#kms_userObject



24
25
26
# File 'app/controllers/kms/users_controller.rb', line 24

def kms_user
  render json: current_kms_user.to_json
end