Class: Refinery::Core::NilUser

Inherits:
Zilch::Authorisation::NilUser
  • Object
show all
Defined in:
core/lib/refinery/core/nil_user.rb

Instance Method Summary collapse

Instance Method Details

#active_pluginsObject

Returns all plugins that the user has access to, that are currently loaded in the system. For NilUser, this returns all registered plugins. Should be overridden in authentication solutions



17
18
19
# File 'core/lib/refinery/core/nil_user.rb', line 17

def active_plugins
  Refinery::Plugins.registered
end

#has_plugin?(name) ⇒ Boolean

Returns true. Should be overridden in authentication solutions. A real solution might be: `Refinery::Plugins.active.names.include?(name)`



30
31
32
# File 'core/lib/refinery/core/nil_user.rb', line 30

def has_plugin?(name)
  true
end

#has_role?(role) ⇒ Boolean

The default NilUser has all roles and can access all plugins. Should be overridden in authentication solutions.



9
10
11
# File 'core/lib/refinery/core/nil_user.rb', line 9

def has_role?(role)
  true
end

#landing_urlObject

Returns a URL to the first plugin with a URL in the menu. Used for admin users' root admin url. Should be overridden in authentication solutions.



37
38
39
# File 'core/lib/refinery/core/nil_user.rb', line 37

def landing_url
  active_plugins.first_url_in_menu
end

#pluginsObject

Returns all registered plugins. Should be overridden in authentication solutions.



23
24
25
# File 'core/lib/refinery/core/nil_user.rb', line 23

def plugins
  Refinery::Plugins.registered
end