Class: Legion::Rbac::CapabilityAudit::AuditResult
- Inherits:
-
Object
- Object
- Legion::Rbac::CapabilityAudit::AuditResult
- Defined in:
- lib/legion/rbac/capability_audit.rb
Instance Attribute Summary collapse
-
#allowed ⇒ Object
readonly
Returns the value of attribute allowed.
-
#declared_capabilities ⇒ Object
readonly
Returns the value of attribute declared_capabilities.
-
#detected_capabilities ⇒ Object
readonly
Returns the value of attribute detected_capabilities.
-
#extension_name ⇒ Object
readonly
Returns the value of attribute extension_name.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#undeclared ⇒ Object
readonly
Returns the value of attribute undeclared.
Instance Method Summary collapse
- #blocked? ⇒ Boolean
-
#initialize(extension_name:, detected:, declared:, allowed:, reason: nil) ⇒ AuditResult
constructor
A new instance of AuditResult.
- #to_h ⇒ Object
Constructor Details
#initialize(extension_name:, detected:, declared:, allowed:, reason: nil) ⇒ AuditResult
Returns a new instance of AuditResult.
28 29 30 31 32 33 34 35 |
# File 'lib/legion/rbac/capability_audit.rb', line 28 def initialize(extension_name:, detected:, declared:, allowed:, reason: nil) @extension_name = extension_name @detected_capabilities = detected.uniq.sort @declared_capabilities = declared.map(&:to_sym).uniq.sort @undeclared = (@detected_capabilities - @declared_capabilities).sort @allowed = allowed @reason = reason end |
Instance Attribute Details
#allowed ⇒ Object (readonly)
Returns the value of attribute allowed.
25 26 27 |
# File 'lib/legion/rbac/capability_audit.rb', line 25 def allowed @allowed end |
#declared_capabilities ⇒ Object (readonly)
Returns the value of attribute declared_capabilities.
25 26 27 |
# File 'lib/legion/rbac/capability_audit.rb', line 25 def declared_capabilities @declared_capabilities end |
#detected_capabilities ⇒ Object (readonly)
Returns the value of attribute detected_capabilities.
25 26 27 |
# File 'lib/legion/rbac/capability_audit.rb', line 25 def detected_capabilities @detected_capabilities end |
#extension_name ⇒ Object (readonly)
Returns the value of attribute extension_name.
25 26 27 |
# File 'lib/legion/rbac/capability_audit.rb', line 25 def extension_name @extension_name end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
25 26 27 |
# File 'lib/legion/rbac/capability_audit.rb', line 25 def reason @reason end |
#undeclared ⇒ Object (readonly)
Returns the value of attribute undeclared.
25 26 27 |
# File 'lib/legion/rbac/capability_audit.rb', line 25 def undeclared @undeclared end |
Instance Method Details
#blocked? ⇒ Boolean
37 38 39 |
# File 'lib/legion/rbac/capability_audit.rb', line 37 def blocked? !@allowed end |
#to_h ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/legion/rbac/capability_audit.rb', line 41 def to_h hash = { extension_name: @extension_name, allowed: @allowed, detected_capabilities: @detected_capabilities, declared_capabilities: @declared_capabilities, undeclared: @undeclared } hash[:reason] = @reason if @reason hash end |