Ash Resource Preparation that applies field masking to read results.
When a field group defines mask and mask_with, this preparation replaces
visible field values with masked versions for actors whose field group level
specifies masking for those fields.
Masking follows allow-wins semantics: if any of the actor's field groups provides unmasked access to a field, the field is not masked.
How It Works
- The preparation adds an
after_actionhook to the query - After records are fetched (but before field restriction), the hook:
- Resolves the actor's field groups from permissions
- Determines which fields should be masked (allow-wins)
- Replaces visible field values with masked values
- Ash's
restrict_field_accessthen runs, hiding truly forbidden fields
Summary
Functions
Callback implementation for Ash.Resource.Preparation.init/1.
Callback implementation for Ash.Resource.Preparation.supports/1.
Functions
Callback implementation for Ash.Resource.Preparation.init/1.
Callback implementation for Ash.Resource.Preparation.supports/1.