Guest User

Untitled

a guest
May 26th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. class UsersController < ApplicationController
  2.  
  3. before_filter :check_allowed_role, :only => [:index, :destroy, :enable, :show]
  4.  
  5. ....
  6.  
  7. #login_system.rb
  8.  
  9. def check_allowed_role
  10. unless is_logged_in? && (@logged_in_user.has_role?('Administrator') || @logged_in_user.has_role?('Support'))
  11. flash[:error] = "You do not have the permission to do that."
  12. redirect_to :controller => 'account', :action => 'login'
  13. end
  14. end
Add Comment
Please, Sign In to add comment