app/controllers/application_controller.rb
# used as a before_filter for controller actions to check that
# the currently logged in user has rights to perform the requested action
used as a before_filter for controller actions to check that
the currently logged in user has rights to perform the requested action
used as a before_filter for controller actions to check that the currently logged in user has rights to perform the requested action
def check_privileges
    unless PrivilegeCheckerService.new.valid_session?(session, current_user)
      handle_invalid_session
      return
    end
    return if action_name == 'auth_error'
    trusted_referer = session[:saml_login_request]
    session[:saml_login_request] = nil
    if RequestRefererService.allowed_access?(request, controller_name, action_name, session['referer'], trusted_referer)
      session['referer'] = request.base_url + '/' unless session['referer'].present?
    else
      head :forbidden
      return
    end
    pass = %w(button x_button).include?(action_name) ? handle_button_rbac : handle_generic_rbac
    $audit_log.failure("Username [#{current_userid}], Role ID [#{current_user.miq_user_role.try(:id)}] attempted to access area [#{controller_name}], type [Action], task [#{action_name}]") unless pass
  end
def check_privileges unless PrivilegeCheckerService . new . valid_session? ( session , current_user ) handle_invalid_session return end return if action_name == 'auth_error' trusted_referer = session [ :saml_login_request ] session [ :saml_login_request ] = nil if RequestRefererService . allowed_access? ( request , controller_name , action_name , session [ 'referer' ] , trusted_referer ) session [ 'referer' ] = request . base_url + '/' unless session [ 'referer' ] . present? else head :forbidden return end pass = %w( button x_button ) . include? ( action_name ) ? handle_button_rbac : handle_generic_rbac $audit_log . failure ( "Username [#{current_userid}], Role ID [#{current_user.miq_user_role.try(:id)}] attempted to access area [#{controller_name}], type [Action], task [#{action_name}]" ) unless pass end
used as a before_filter for controller actions to check that
the currently logged in user has rights to perform the requested action
used as a before_filter for controller actions to check that the currently logged in user has rights to perform the requested action
# if we came in directly and were allowed then # we need to make sure we have the referer in the session for future requests