Class: Yes::Core::Authorization::ReadModelsAuthorizer
- Inherits:
-
Object
- Object
- Yes::Core::Authorization::ReadModelsAuthorizer
- Defined in:
- lib/yes/core/authorization/read_models_authorizer.rb
Overview
Authorizes a collection of read model records by delegating to per-record authorizers.
Constant Summary collapse
Class Method Summary collapse
Class Method Details
.call(read_model_name, records, auth_data) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/yes/core/authorization/read_models_authorizer.rb', line 15 def call(read_model_name, records, auth_data) = (read_model_name) return unless = [] records.each do |record| .call(record, auth_data) rescue ReadModelAuthorizer::NotAuthorized => e << { message: e., model_type: record.class.to_s, model_id: record.id } end raise NotAuthorized.new(extra: ) if .any? end |