Module: Textus::Application::Writes::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
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/textus/application/writes/authority_gate.rb', line 9 def (verb) return if @manifest.role_kind(@ctx.role) == :accept_authority = @manifest.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 '#{@ctx.role}'", ) end |