Class: WizAcl::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/wizdog/acl/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_idObject

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_idObject

Returns the value of attribute aro_id.



6
7
8
# File 'lib/wizdog/acl/entry.rb', line 6

def aro_id
  @aro_id
end

#privilegesObject

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

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/wizdog/acl/entry.rb', line 27

def allowed?(operation = "*")
  permission = @privileges[operation.to_s] || @privileges["*"]
  return permission == :allow unless permission.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