Sha256: 55da4f4fb9a59406a65349f869c7709003d4687d032a316a2f4eca221e1f05d2

Contents?: true

Size: 816 Bytes

Versions: 8

Compression:

Stored size: 816 Bytes

Contents

module Kms
  class UsersController < ApplicationController
    before_action :authenticate_kms_user!
    load_and_authorize_resource
    skip_authorize_resource only: :kms_user

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

    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

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

    def kms_user
      render json: current_kms_user.to_json
    end

    protected

    def user_params
      params.require(:user).permit!
    end


  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kms-0.9.0 app/controllers/kms/users_controller.rb
kms-0.8.0 app/controllers/kms/users_controller.rb
kms-0.7.0 app/controllers/kms/users_controller.rb
kms-0.6.0 app/controllers/kms/users_controller.rb
kms-0.5.0 app/controllers/kms/users_controller.rb
kms-0.4.2 app/controllers/kms/users_controller.rb
kms-0.4.1 app/controllers/kms/users_controller.rb
kms-0.4.0 app/controllers/kms/users_controller.rb