class Refinery::Authentication::Devise::AuthorisationAdapter

Public Instance Methods

allow?(operation, resource) click to toggle source
# File lib/refinery/authentication/devise/authorisation_adapter.rb, line 18
def allow?(operation, resource)
  case
  when resource == :site_bar
    current_user.has_role?(:refinery)
  when operation == :plugin
    current_user.active_plugins.names.include?(resource)
  when operation == :controller
    current_user.active_plugins.any? do |plugin|
      Regexp.new(plugin.menu_match) === resource
    end
  else
    false
  end
end
current_user() click to toggle source

If no user exists, we use a NilUser (non-admin).

# File lib/refinery/authentication/devise/authorisation_adapter.rb, line 9
def current_user
  @current_user ||= Refinery::Authentication::Devise::NilUser.new
end
current_user=(set_to_this_user) click to toggle source

This method has been added, it does not exist in the superclass.

# File lib/refinery/authentication/devise/authorisation_adapter.rb, line 14
def current_user=(set_to_this_user)
  @current_user = set_to_this_user
end