Sha256: 4af003df9b395e8dd8d322119e574f26339a7fa873933448081df9827aee0c41
Contents?: true
Size: 775 Bytes
Versions: 38
Compression:
Stored size: 775 Bytes
Contents
# frozen_string_literal: true module Decidim module Verifications # A command to authorize a user with an authorization handler. class AuthorizeUser < Rectify::Command # Public: Initializes the command. # # handler - An AuthorizationHandler object. def initialize(handler) @handler = handler end # Executes the command. Broadcasts these events: # # - :ok when everything is valid. # - :invalid if the handler wasn't valid and we couldn't proceed. # # Returns nothing. def call return broadcast(:invalid) unless handler.valid? Authorization.create_or_update_from(handler) broadcast(:ok) end private attr_reader :handler end end end
Version data entries
38 entries across 38 versions & 1 rubygems