diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 286cc1b52..b803307fc 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,7 +2,7 @@ class ApplicationController < ActionController::Base include UserInfo # http_basic_authenticate_with :name => "test", :password => "ttt" - helper_method :current_user, :authentication_check, :config_frontend, :user_data_full + helper_method :current_user, :authentication_check, :config_frontend, :user_data_full, :is_role before_filter :set_user before_filter :cors_preflight_check @@ -127,6 +127,14 @@ class ApplicationController < ActionController::Base UserInfo.current_user_id = current_user.id end + def is_role( role_name ) + return false if !current_user + current_user.roles.each { |role| + return true if role.name == role_name + } + return false + end + def log_view (object) history_type = History::Type.where( :name => 'viewed' ).first if !history_type || !history_type.id