Class: CommandTower::Configuration::Registry::ClientCompatibility::EntityRequirementDefinition
- Inherits:
-
Object
- Object
- CommandTower::Configuration::Registry::ClientCompatibility::EntityRequirementDefinition
- Includes:
- ClassComposer::Generator
- Defined in:
- lib/command_tower/configuration/registry/client_compatibility/entity_requirement_definition.rb
Overview
Capability-scoped version requirement bound to an existing RBAC entity.
Authority §6. CommandTower-owned entity requirements MUST reference a
named client_contract; host-owned entity requirements may reference a
client_contract OR set direct per-platform minima, never both.
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#minimum ⇒ Object
readonly
Returns the value of attribute minimum.
-
#owner ⇒ Object
Returns the value of attribute owner.
Instance Method Summary collapse
-
#initialize ⇒ EntityRequirementDefinition
constructor
A new instance of EntityRequirementDefinition.
- #validate_definition!(name:) ⇒ Object
Constructor Details
#initialize ⇒ EntityRequirementDefinition
Returns a new instance of EntityRequirementDefinition.
25 26 27 |
# File 'lib/command_tower/configuration/registry/client_compatibility/entity_requirement_definition.rb', line 25 def initialize @minimum = MinimumOverrides.new end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
22 23 24 |
# File 'lib/command_tower/configuration/registry/client_compatibility/entity_requirement_definition.rb', line 22 def id @id end |
#minimum ⇒ Object (readonly)
Returns the value of attribute minimum.
23 24 25 |
# File 'lib/command_tower/configuration/registry/client_compatibility/entity_requirement_definition.rb', line 23 def minimum @minimum end |
#owner ⇒ Object
Returns the value of attribute owner.
22 23 24 |
# File 'lib/command_tower/configuration/registry/client_compatibility/entity_requirement_definition.rb', line 22 def owner @owner end |
Instance Method Details
#validate_definition!(name:) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/command_tower/configuration/registry/client_compatibility/entity_requirement_definition.rb', line 29 def validate_definition!(name:) @id = name.to_s self.owner = owner&.to_sym || :host contract_present = client_contract.present? direct_present = minimum.any_set? if contract_present && direct_present raise CommandTower::ClientCompatibility::ConflictingRequirementError, "entity requirement #{name} MUST NOT set both client_contract and a direct minimum" end if owner == :command_tower && !contract_present raise CommandTower::ClientCompatibility::ConflictingRequirementError, "CommandTower-owned entity requirement #{name} MUST declare a client_contract, not a direct host version" end self.client_contract = normalize_contract_id!(client_contract, name:) if contract_present minimum.validate!(name:) if direct_present self end |