update check user
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class Settings::CommissionersController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
|
||||
before_action :check_user
|
||||
|
||||
# GET /commissioners
|
||||
# GET /commissioners.json
|
||||
@@ -82,7 +83,11 @@ class Settings::CommissionersController < ApplicationController
|
||||
end
|
||||
render json: @transactions
|
||||
end
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_commissioner
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Settings::CommissionsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_commission, only: [:show, :edit, :update, :destroy]
|
||||
before_action :check_user
|
||||
|
||||
# GET /commissions
|
||||
# GET /commissions.json
|
||||
@@ -68,6 +69,12 @@ class Settings::CommissionsController < ApplicationController
|
||||
# end
|
||||
end
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_commission
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Settings::OrderQueueStationsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_order_queue_station, only: [:show, :edit, :update, :destroy]
|
||||
before_action :check_user
|
||||
|
||||
# GET /settings/order_queue_stations
|
||||
# GET /settings/order_queue_stations.json
|
||||
@@ -67,6 +68,12 @@ class Settings::OrderQueueStationsController < ApplicationController
|
||||
# end
|
||||
end
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_order_queue_station
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Settings::ProductsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_settings_product, only: [:show, :edit, :update, :destroy]
|
||||
before_action :check_user
|
||||
|
||||
# GET /settings/products
|
||||
# GET /settings/products.json
|
||||
@@ -65,6 +66,12 @@ load_and_authorize_resource except: [:create]
|
||||
# end
|
||||
end
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_product
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Settings::PromotionProductsController < ApplicationController
|
||||
before_action :set_promotion, only: [:show, :edit, :update, :destroy,:new]
|
||||
before_action :set_promotion_product, only: [:show, :edit, :update, :destroy]
|
||||
before_action :check_user
|
||||
|
||||
# GET /promotion_products
|
||||
# GET /promotion_products.json
|
||||
@@ -63,6 +64,12 @@ class Settings::PromotionProductsController < ApplicationController
|
||||
# end
|
||||
end
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_promotion
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Settings::PromotionsController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_promotion, only: [:show, :edit, :update, :destroy]
|
||||
before_action :check_user
|
||||
|
||||
# GET /promotions
|
||||
# GET /promotions.json
|
||||
@@ -119,6 +120,12 @@ class Settings::PromotionsController < ApplicationController
|
||||
render json: res
|
||||
end
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_promotion
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Transactions::CreditNotesController < ApplicationController
|
||||
|
||||
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
|
||||
before_action :check_user
|
||||
|
||||
# GET /transactions/sales
|
||||
# GET /transactions/sales.json
|
||||
@@ -25,12 +26,18 @@ class Transactions::CreditNotesController < ApplicationController
|
||||
@credit_notes = 0
|
||||
end
|
||||
end
|
||||
puts "sssssssssssss"
|
||||
puts @credit_notes.to_json
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @credit_notes }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,5 +1,7 @@
|
||||
class Transactions::OrdersController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :check_user
|
||||
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
@@ -39,4 +41,10 @@ class Transactions::OrdersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Transactions::SalesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
|
||||
before_action :check_user
|
||||
|
||||
# GET /transactions/sales
|
||||
# GET /transactions/sales.json
|
||||
@@ -129,6 +130,12 @@ class Transactions::SalesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_transactions_sale
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Transactions::ShiftSalesController < ApplicationController
|
||||
load_and_authorize_resource except: [:create]
|
||||
before_action :set_transactions_shift_sale, only: [:show, :edit, :update, :destroy]
|
||||
before_action :check_user
|
||||
|
||||
def index
|
||||
|
||||
@@ -53,6 +54,12 @@ class Transactions::ShiftSalesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def check_user
|
||||
if current_user.nil?
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_transactions_shift_sale
|
||||
|
||||
Reference in New Issue
Block a user