class Permisi::Config
Constants
- NULL_CACHE_STORE
Attributes
default_permissions[R]
mute_pre_0_1_4_warning[RW]
permissions[R]
Public Class Methods
new()
click to toggle source
# File lib/permisi/config.rb, line 12 def initialize @permissions = ::HashWithIndifferentAccess.new @default_permissions = ::HashWithIndifferentAccess.new end
Public Instance Methods
backend()
click to toggle source
# File lib/permisi/config.rb, line 34 def backend @backend || Backend::NullBackend end
backend=(chosen_backend)
click to toggle source
# File lib/permisi/config.rb, line 17 def backend=(chosen_backend) chosen_backend = "::Permisi::Backend::#{chosen_backend.to_s.classify}".constantize if chosen_backend.is_a? Symbol if !mute_pre_0_1_4_warning && chosen_backend == Backend::ActiveRecord warn <<~MESSAGE WARNING: If you are upgrading from Permisi <v0.1.4, please create the following migration: `add_index :permisi_actor_roles, [:actor_id, :role_id], unique: true` MESSAGE end @backend = chosen_backend rescue NameError raise Backend::InvalidBackend end
cache_store()
click to toggle source
# File lib/permisi/config.rb, line 50 def cache_store @cache_store || NULL_CACHE_STORE end
cache_store=(cache_store)
click to toggle source
# File lib/permisi/config.rb, line 44 def cache_store=(cache_store) raise InvalidCacheStore unless cache_store.respond_to?(:fetch) @cache_store = cache_store end
permissions=(permissions_hash)
click to toggle source
# File lib/permisi/config.rb, line 38 def permissions=(permissions_hash) permissions_hash = HashWithIndifferentAccess.new(permissions_hash) @default_permissions = PermissionUtil.transform_namespace(permissions_hash) @permissions = permissions_hash end