Class: CanTango::Permits::Permit
- Inherits:
-
Object
- Object
- CanTango::Permits::Permit
show all
- Extended by:
- ClassMethods
- Includes:
- Api::Attributes, Helpers::Debug, CanTango::PermitEngine::Compatibility, CanTango::PermitEngine::RoleMatcher, CanTango::PermitEngine::Util, License, Execute, Rules
- Defined in:
- lib/cantango/permits/permit.rb,
lib/cantango/permits/permit/execute.rb,
lib/cantango/permits/permit/license.rb,
lib/cantango/permits/permit/class_methods.rb
Defined Under Namespace
Modules: ClassMethods, Execute, License
Instance Attribute Summary collapse
-
#ability ⇒ Object
readonly
strategy is used to control the owns strategy (see rules.rb).
-
#disabled ⇒ Object
readonly
strategy is used to control the owns strategy (see rules.rb).
Instance Method Summary
collapse
account_name, first_name, type
#role_group_match?, #role_match?
#rules, #rules_1_4, #rules_1_5
#localhost_manager?, #permit_name, #role
Methods included from Execute
#cached_rules, #dynamic_rules, #execute, #executor, #include_cached, #include_non_cached, #non_cached_rules, #permit?, #permit_rules, #run_rule_methods, #static_rules
Methods included from Rules::Dsl
included, #scope
#debug
Constructor Details
#initialize(ability) ⇒ Permit
22
23
24
|
# File 'lib/cantango/permits/permit.rb', line 22
def initialize ability
@ability = ability
end
|
Instance Attribute Details
#ability ⇒ Object
strategy is used to control the owns strategy (see rules.rb)
17
18
19
|
# File 'lib/cantango/permits/permit.rb', line 17
def ability
@ability
end
|
#disabled ⇒ Object
strategy is used to control the owns strategy (see rules.rb)
17
18
19
|
# File 'lib/cantango/permits/permit.rb', line 17
def disabled
@disabled
end
|
Instance Method Details
#ability_rules ⇒ Object
30
31
32
|
# File 'lib/cantango/permits/permit.rb', line 30
def ability_rules
ability.send :rules
end
|
#ability_sync! ⇒ Object
70
71
72
73
|
# File 'lib/cantango/permits/permit.rb', line 70
def ability_sync!
ability_rules << (rules - ability_rules)
ability_rules.flatten!
end
|
#any(reg_exp) ⇒ Object
50
51
52
|
# File 'lib/cantango/permits/permit.rb', line 50
def any reg_exp
config.models.by_reg_exp reg_exp
end
|
#category(label) ⇒ Object
46
47
48
|
# File 'lib/cantango/permits/permit.rb', line 46
def category label
config.models.by_category label
end
|
#disable! ⇒ Object
34
35
36
|
# File 'lib/cantango/permits/permit.rb', line 34
def disable!
@disabled = true
end
|
#disabled? ⇒ Boolean
38
39
40
|
# File 'lib/cantango/permits/permit.rb', line 38
def disabled?
@disabled || config_disabled?
end
|
#localhost? ⇒ Boolean
62
63
64
|
# File 'lib/cantango/permits/permit.rb', line 62
def localhost?
config.localhost_list.include? request.host
end
|
#permit_type ⇒ Object
26
27
28
|
# File 'lib/cantango/permits/permit.rb', line 26
def permit_type
self.class.type
end
|
#publichost? ⇒ Boolean
66
67
68
|
# File 'lib/cantango/permits/permit.rb', line 66
def publichost?
!localhost?
end
|
#valid_for?(subject) ⇒ Boolean
42
43
44
|
# File 'lib/cantango/permits/permit.rb', line 42
def valid_for? subject
raise NotImplementedError
end
|