Class: CanTango::CachedAbility

Inherits:
Ability
  • Object
show all
Defined in:
lib/cantango/cached_ability.rb

Instance Attribute Summary

Attributes inherited from Ability

#candidate, #options

Instance Method Summary collapse

Methods inherited from Ability

#clear_rules!, #config, #session, #subject

Methods included from Ability::RoleHelpers

#role_groups, #roles

Methods included from Helpers::RoleMethods

#config, #has_role_group_meth, #has_role_meth, #role_groups_list_meth, #roles_list_meth

Methods included from Ability::UserHelpers

#user, #user_account, #user_key_field

Methods included from Ability::PermitHelpers

#permits?

Methods included from Ability::MasqueradeHelpers

#masquerade_account?, #masquerade_user?, #masquerading?, #masquerading_off?

Methods included from Ability::CacheHelpers

#cache

Methods included from Ability::EngineHelpers

#each_engine, #engines, #engines_on?, #execute_engines!, #opts_engines_off?

Methods included from PermitEngine::Util

#localhost_manager?, #permit_name, #role

Constructor Details

#initialize(candidate, options = {}) ⇒ CachedAbility

Equivalent to a CanCan Ability#initialize call which executes all the permission logic



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cantango/cached_ability.rb', line 5

def initialize candidate, options = {}
  raise "Candidate must be something!" if !candidate
  @candidate, @options = candidate, options

  # return if cached_rules?

  clear_rules!
  permit_rules

  execute_engines! if engines_on?

  # cache_rules!
end

Instance Method Details

#cached?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/cantango/cached_ability.rb', line 19

def cached?
  true
end

#permit_rulesObject



23
24
# File 'lib/cantango/cached_ability.rb', line 23

def permit_rules
end