Class: Verifica::Ace
- Inherits:
-
Object
- Object
- Verifica::Ace
- Defined in:
- lib/verifica/ace.rb
Overview
Access Control Entry (ACE)
ACE is a minimal unit of the Access Control List (ACL) that defines whether or not a specific action is allowed for a particular Security Identifier (SID).
Instance Attribute Summary collapse
-
#action ⇒ Symbol
readonly
Action which is allowed or denied.
-
#sid ⇒ String
readonly
Security Identifier (SID).
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#allow? ⇒ Boolean
True if the action is allowed.
-
#deny? ⇒ Boolean
True if the action is denied.
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(sid, action, allow) ⇒ Ace
constructor
Creates a new Access Control Entry with immutable state.
-
#to_h ⇒ Hash
A new hash representing
self
. - #to_s ⇒ Object
Constructor Details
#initialize(sid, action, allow) ⇒ Ace
Creates a new Access Control Entry with immutable state
32 33 34 35 36 37 |
# File 'lib/verifica/ace.rb', line 32 def initialize(sid, action, allow) @sid = sid.dup.freeze @action = action.to_sym @allow = allow freeze end |
Instance Attribute Details
#action ⇒ Symbol (readonly)
Returns Action which is allowed or denied.
22 23 24 |
# File 'lib/verifica/ace.rb', line 22 def action @action end |
#sid ⇒ String (readonly)
Returns Security Identifier (SID).
17 18 19 |
# File 'lib/verifica/ace.rb', line 17 def sid @sid end |
Instance Method Details
#==(other) ⇒ Object
64 65 66 |
# File 'lib/verifica/ace.rb', line 64 def ==(other) eql?(other) end |
#allow? ⇒ Boolean
Returns true if the action is allowed.
42 43 44 |
# File 'lib/verifica/ace.rb', line 42 def allow? @allow end |
#deny? ⇒ Boolean
Returns true if the action is denied.
49 50 51 |
# File 'lib/verifica/ace.rb', line 49 def deny? !allow? end |
#eql?(other) ⇒ Boolean
68 69 70 71 72 73 |
# File 'lib/verifica/ace.rb', line 68 def eql?(other) self.class == other.class && @sid == other.sid && @action == other.action && @allow == other.allow? end |
#hash ⇒ Object
75 76 77 |
# File 'lib/verifica/ace.rb', line 75 def hash [self.class, @sid, @action, @allow].hash end |
#to_h ⇒ Hash
Returns a new hash representing self
.
56 57 58 |
# File 'lib/verifica/ace.rb', line 56 def to_h {sid: @sid, action: @action, allow: @allow} end |
#to_s ⇒ Object
60 61 62 |
# File 'lib/verifica/ace.rb', line 60 def to_s to_h.to_s end |