mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-15 20:54:03 +00:00
base controller
Conflicts: app/controllers/admin/commercials_controller.rb app/controllers/admin/questions_controller.rb app/controllers/admin/users_controller.rb
This commit is contained in:
parent
336d0e9d04
commit
17ebad413e
29 changed files with 48 additions and 31 deletions
17
app/controllers/admin/base_controller.rb
Normal file
17
app/controllers/admin/base_controller.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
module Admin
|
||||
class BaseController < ApplicationController
|
||||
before_filter :verify_user_admin
|
||||
|
||||
def verify_user_admin
|
||||
if (current_user.nil?)
|
||||
redirect_to new_user_session_path
|
||||
return false
|
||||
end
|
||||
unless (current_user.has_role? :organizer, :any) || (current_user.has_role? :cfp, :any) ||
|
||||
(current_user.has_role? :info_desk, :any) ||
|
||||
(current_user.has_role? :volunteers_coordinator, :any) || current_user.is_admin
|
||||
raise CanCan::AccessDenied.new('You are not authorized to access this area!')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue