Class: WizAcl::Entry
- Inherits:
-
Object
- Object
- WizAcl::Entry
- Defined in:
- lib/wizdog/acl/entry.rb
Instance Attribute Summary collapse
-
#aco_id ⇒ Object
Returns the value of attribute aco_id.
-
#aro_id ⇒ Object
Returns the value of attribute aro_id.
-
#privileges ⇒ Object
Returns the value of attribute privileges.
Instance Method Summary collapse
- #allow(operations = "*") ⇒ Object
- #allowed?(operation = "*") ⇒ Boolean
- #deny(operations = "*") ⇒ Object
-
#initialize(aro = "*", aco = "*") ⇒ Entry
constructor
A new instance of Entry.
Constructor Details
#initialize(aro = "*", aco = "*") ⇒ Entry
Returns a new instance of Entry.
8 9 10 11 12 13 |
# File 'lib/wizdog/acl/entry.rb', line 8 def initialize(aro = "*", aco = "*") aro.respond_to?(:aro_id) ? @aro_id = aro.aro_id : @aro_id = aro.to_s aco.respond_to?(:aco_id) ? @aco_id = aco.aco_id : @aco_id = aco.to_s #{:operation => :permission} @privileges = {} end |
Instance Attribute Details
#aco_id ⇒ Object
Returns the value of attribute aco_id.
6 7 8 |
# File 'lib/wizdog/acl/entry.rb', line 6 def aco_id @aco_id end |
#aro_id ⇒ Object
Returns the value of attribute aro_id.
6 7 8 |
# File 'lib/wizdog/acl/entry.rb', line 6 def aro_id @aro_id end |
#privileges ⇒ Object
Returns the value of attribute privileges.
6 7 8 |
# File 'lib/wizdog/acl/entry.rb', line 6 def privileges @privileges end |
Instance Method Details
#allow(operations = "*") ⇒ Object
15 16 17 18 19 |
# File 'lib/wizdog/acl/entry.rb', line 15 def allow(operations = "*") #@privileges << Privilege.new(operation, :allow) privilege(operations, :allow) return self end |
#allowed?(operation = "*") ⇒ Boolean
27 28 29 30 31 |
# File 'lib/wizdog/acl/entry.rb', line 27 def allowed?(operation = "*") = @privileges[operation.to_s] || @privileges["*"] return == :allow unless .nil? nil end |
#deny(operations = "*") ⇒ Object
21 22 23 24 25 |
# File 'lib/wizdog/acl/entry.rb', line 21 def deny(operations = "*") #@privileges << Privilege.new(operation, :deny) privilege(operations, :deny) return self end |