Sha256: 412cba8645831449484586f25bcfe8e1625b4766a57651eb03cc041342be946f
Contents?: true
Size: 1021 Bytes
Versions: 6
Compression:
Stored size: 1021 Bytes
Contents
require "refinery/core/authorisation_adapter" module Refinery module Authentication module Devise class AuthorisationAdapter < Refinery::Core::AuthorisationAdapter # If no user exists, we use a NilUser (non-admin). def current_user @current_user ||= Refinery::Authentication::Devise::NilUser.new end # This method has been added, it does not exist in the superclass. def current_user=(set_to_this_user) @current_user = set_to_this_user end 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 end end end end
Version data entries
6 entries across 6 versions & 1 rubygems