From 15f317fba1188a3bf5caf02bc9a41f3934f640c1 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Thu, 23 Mar 2017 05:36:51 -0400 Subject: [PATCH] Update customers_controller.rb --- app/controllers/customers_controller.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/customers_controller.rb b/app/controllers/customers_controller.rb index 409b8b2..ec9770f 100644 --- a/app/controllers/customers_controller.rb +++ b/app/controllers/customers_controller.rb @@ -27,7 +27,8 @@ class CustomersController < ApplicationController include SortHelper helper :timelog - before_filter :require_user, :except => :view + before_filter :add_customer, :only => :new + before_filter :view_customer, :except => :new skip_before_filter :verify_authenticity_token, :check_if_login_required, :only => [:view] default_search_scope :names @@ -144,6 +145,14 @@ class CustomersController < ApplicationController private + def add_customer + check_permission(:add_customer) + end + + def view_customer + chech_permission(:view_customer) + end + def only_one_non_zero?( array ) found_non_zero = false array.each do |val|