Files
sx-fc/app/models/ability.rb
2017-11-22 10:40:43 +06:30

154 lines
4.1 KiB
Ruby
Executable File

class Ability
include CanCan::Ability
def initialize(user)
user ||= Employee.new
if user.role == "administrator"
can :manage, :all
elsif user.role == "manager"
can :manage, Menu
can :manage, MenuCategory
can :manage, MenuItemAttribute
can :manage, MenuItemInstance
can :manage, MenuItemOption
can :manage, SetMenuItem
can :manage, ItemSet
can :manage, MenuItemSet
can :manage, OrderQueueStation
can :manage, Zone
can :manage, CashierTerminal
can :manage, Employee
# can :manage, MembershipSetting
# can :manage, MembershipAction
# can :manage, PaymentMethodSetting
can :manage, TaxProfile
can :manage, PrintSetting
can :manage, Account
can :manage, Commission
can :manage, Commissioner
can :manage, Promotion
can :manage, Product
can :manage, Order
can :manage, Booking
can :manage, Sale
can :manage, Customer
can :manage, DiningQueue
can :index, :dailysale
can :index, :saleitem
can :index, :receipt_no
can :index, :shiftsale
can :index, :credit_payment
can :index, :void_sale
can :get_customer, Customer
can :add_customer, Customer
can :update_sale_by_customer, Customer
can :index, :other_charge
can :create, :other_charge
can :index, :discount
can :create, :discount
can :remove_discount_items, :discount
can :remove_all_discount, :discount
can :first_bill, :payment
can :show, :payment
can :create, :payment
can :reprint, :payment
can :rounding_adj, :payment
can :foc, :payment
can :move_dining, :movetable
can :moving, :movetable
can :move_dining, :moveroom
can :edit, :sale_edit
can :item_void, :sale_edit
can :item_void_cancel, :sale_edit
can :cancel_all_void, :sale_edit
can :apply_void, :sale_edit
can :item_foc, :sale_edit
can :item_edit, :sale_edit
can :overall_void, :void
elsif user.role == "cashier"
# can :overall_void, :void
can :read, Order
can :update, Order
can :menage, Booking
can :read, Sale
can :update, Sale
can :get_customer, Customer
can :add_customer, Customer
can :update_sale_by_customer, Customer
can :index, :other_charge
can :create, :other_charge
can :index, :discount
can :create, :discount
can :remove_discount_items, :discount
can :remove_all_discount, :discount
can :member_discount, :discount
can :first_bill, :payment
can :show, :payment
can :create, :payment
can :reprint, :payment
can :rounding_adj, :payment
can :move_dining, :movetable
can :moving, :movetable
can :move_dining, :moveroom
can :manage, DiningQueue
elsif user.role == "account"
can :index, :dailysale
can :index, :saleitem
can :index, :receipt_no
can :index, :shiftsale
can :index, :credit_payment
can :index, :void_sale
elsif user.role == "supervisor"
can :edit, :sale_edit
can :item_void, :sale_edit
can :item_foc, :sale_edit
can :item_edit, :sale_edit
can :item_void_cancel, :sale_edit
can :cancel_all_void, :sale_edit
can :apply_void, :sale_edit
can :overall_void, :void
can :index, :other_charge
can :create, :other_charge
can :index, :discount
can :create, :discount
can :remove_discount_items, :discount
can :remove_all_discount, :discount
can :manage, Customer
can :manage, DiningQueue
can :first_bill, :payment
can :create, :payment
can :show, :payment
can :reprint, :payment
can :rounding_adj, :payment
end
end
end