2015-09-08 15:14:46 +02:00
|
|
|
class UsersController < ApplicationController
|
2018-06-20 18:02:33 +02:00
|
|
|
skip_before_action :verify_authenticity_token, only: :create, find_by: :name
|
2015-09-17 16:46:33 +02:00
|
|
|
|
|
|
|
before_action :authenticate_user!, except: :show
|
|
|
|
before_action :authenticate_user_or_client!, only: :show
|
|
|
|
|
2016-02-02 15:24:26 +01:00
|
|
|
load_and_authorize_resource except: :show
|
2015-09-08 17:40:40 +02:00
|
|
|
|
2015-09-08 17:28:46 +02:00
|
|
|
def show
|
2016-02-04 13:45:12 +01:00
|
|
|
@user = User.find_by(name: params[:id]) || User.new
|
2016-02-10 15:23:16 +01:00
|
|
|
authorize! :read, @user
|
2015-09-08 20:45:32 +02:00
|
|
|
respond_to do |format|
|
2015-09-17 16:46:33 +02:00
|
|
|
format.html { @transaction = Transaction.new }
|
|
|
|
format.json { render json: @user }
|
2015-09-08 20:45:32 +02:00
|
|
|
end
|
2015-09-08 17:28:46 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def index
|
|
|
|
@users = User.all
|
|
|
|
end
|
2015-09-08 15:14:46 +02:00
|
|
|
end
|