Sha256: 313b87b3bd982a1e347fad0b4c4b274f0af0800992329f6d1d9879d11b904829
Contents?: true
Size: 735 Bytes
Versions: 1
Compression:
Stored size: 735 Bytes
Contents
# typed: true # frozen_string_literal: true require 'dry/monads/all' require 'clean_architecture/entities/failure_details' require 'forwardable' module CleanArchitecture module Checks class Authorization extend Forwardable def result if authorized? Dry::Monads::Success(true) else failure_details = Entities::FailureDetails.new( message: failure_message, other_properties: {}, type: 'unauthorized' ) Dry::Monads::Failure(failure_details) end end protected def failure_message 'Unauthorized' end def authorized? raise NotImplementedError end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
clean-architecture-5.0.2 | lib/clean_architecture/checks/authorization.rb |