Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. class Ability
  2. include CanCan::Ability
  3.  
  4. def initialize(dashboard_user)
  5.  
  6. if dashboard_user.role_id == 1 then
  7. can :manage, :all
  8. else
  9. can :read, :summary
  10. can :read, :home
  11. end
  12. end
  13. end
  14.  
  15. def current_user
  16. current_dashboard_user
  17. end
  18.  
  19. #For authorization using cancancan
  20. protected
  21. rescue_from CanCan::AccessDenied do |exception|
  22. redirect_to main_app.root_url, :alert => exception.message
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement