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:

The following guards are used to validate specific caller types:

  • is_system_caller/1: Checks if the value is a system caller with the system permission.
  • is_admin_caller/1: Checks if the value is an admin caller with the admin permission.
  • is_internal_caller/1: Checks if the value is an internal caller with the internal permission.
  • is_restricted_caller/1: Checks if the value is a restricted caller without any permissions or with the restricted permission 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 given term has the specified permission.
  • caller_permission_value?(term, permission, value): Checks if the given term has the specified permission with the specified value.

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 a vsn field.

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.

Link to this section Summary

Link to this section Functions

Link to this macro

caller_context_with_permissions(value)

View Source (macro)
Link to this macro

caller_permission_value?(term, permission, value)

View Source (macro)
Link to this macro

caller_permission?(term, permission)

View Source (macro)
Link to this macro

entity_ref(value)

View Source (macro)
Link to this macro

has_call_reason?(value)

View Source (macro)
Link to this macro

is_admin_caller(value)

View Source (macro)
Link to this macro

is_caller_context(value)

View Source (macro)
Link to this macro

is_internal_caller(value)

View Source (macro)
Link to this macro

is_restricted_caller(value)

View Source (macro)
Link to this macro

is_sref(value)

View Source (macro)
Link to this macro

is_system_caller(value)

View Source (macro)
Link to this macro

permission?(context, permission)

View Source (macro)
Link to this macro

permission?(context, permission, value)

View Source (macro)