Module: Textus::Write::AuthorityGate
Overview
Shared gate for write verbs that require the caller to hold the manifest’s accept_authority role. Provides one method, expressed as two early-returns rather than a ternary, so each failure mode reads on its own line.
Instance Method Summary collapse
Instance Method Details
#assert_accept_authority!(verb) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/textus/write/authority_gate.rb', line 8 def (verb) return if @manifest.policy.role_kind(@call.role) == :accept_authority = @manifest.policy.roles_with_kind(:accept_authority).first if .nil? raise ProposalError.new( "no role with accept_authority kind is declared in this manifest; #{verb} is disabled", ) end raise ProposalError.new( "only #{} role can #{verb} proposals; got '#{@call.role}'", ) end |