View Source Noizu.ElixirCore.Guards (noizu_core v1.0.28)
Provides guards for caller context and reference checks.
calling-context-guards
Calling Context Guards
The following guards are used to validate the caller context:
is_caller_context/1: Checks if the value is a struct of typeNoizu.ElixirCore.CallingContext.caller_context_with_permissions/1: Checks if the value is a caller context struct with apermissionsmap.
The following guards are used to validate specific caller types:
is_system_caller/1: Checks if the value is a system caller with thesystempermission.is_admin_caller/1: Checks if the value is an admin caller with theadminpermission.is_internal_caller/1: Checks if the value is an internal caller with theinternalpermission.is_restricted_caller/1: Checks if the value is a restricted caller without any permissions or with therestrictedpermission set to true.
caller-permission-macros
Caller Permission Macros
The following macros are used to check caller permissions:
caller_permission?(term, permission): Checks if the giventermhas the specifiedpermission.caller_permission_value?(term, permission, value): Checks if the giventermhas the specifiedpermissionwith the specifiedvalue.
ref-guards
Ref Guards
The following guards are used for reference checks:
is_ref/1: Checks if the value is a reference tuple of the form{:ref, Module, identifier}.is_sref/1: Checks if the value is a reference string of the form"ref.module.identifier".entity_ref/1: Checks if the value is a reference tuple, reference string, or a struct with avsnfield.
Code Review
- The code is well-documented and follows the Elixir naming conventions.
- The guards are defined clearly and provide useful abstractions for caller context and reference checks.