Conditions Reference#
This section documents the conditions that the Guardian provides for configuring capabilities on roles. This is of interest to both app developers and guardian administrators who want to configure roles properly.
All conditions listed here come from the builtin
namespace of the guardian
app.
Therefore, the identifier of any condition is guardian:builtin:condition_name
,
where condition_name
is the name of the specific condition.
Important
Requests to the Authorization API supply both an old_target
,
the state of the target before a change,
and a new_target
,
the state of the target after the change.
In this document, conditions on the target apply only to the old_target
.
- actor_does_not_have_role#
Parameter name
Value type
role
ROLE (string)
This condition is true if the actor doesn’t have the role specified in the
role
parameter.
- only_if_param_result_true#
Parameter name
Value type
result
BOOLEAN
Don’t use this condition. It exists for testing and debugging purposes only.
- target_does_not_have_role#
Parameter name
Value type
role
ROLE (string)
This condition is true if the target doesn’t have the role specified in the
role
parameter.
- target_does_not_have_role_in_same_context#
Parameter name
Value type
role
ROLE (string)
This condition is true if the target doesn’t have the role specified in the
role
parameter with the same context as the actor’s role currently under evaluation. For example, if the actor’s role iscompany:default:admin
in the contextDEPARTMENT1
and therole
parameter iscompany:default:user
, this condition would be true as long as the target doesn’t have the rolecompany:default:user
with the contextDEPARTMENT1
.
- target_field_equals_actor_field#
Parameter name
Value type
target_field
STRING
actor_field
STRING
This condition is true if the specified field of the actor and the specified field of the target have the same value.
- target_field_equals_value#
Parameter name
Value type
field
STRING
value
ANY
This condition is true if the specified
field
of the target has the same value as specified in thevalue
parameter.
- target_field_not_equals_value#
Parameter name
Value type
field
STRING
value
ANY
This condition is true if the specified
field
of the target doesn’t have the same value as specified in thevalue
parameter.
- target_has_role#
Parameter name
Value type
role
ROLE (string)
This condition is true if the target has the role specified in the
role
parameter.
- target_has_role_in_same_context#
Parameter name
Value type
role
ROLE (string)
This condition is true if the target has the role specified in the
role
parameter with the same context as the actor’s role currently under evaluation. For example, if the actor’s role iscompany:default:admin
in the contextDEPARTMENT1
and therole
parameter iscompany:default:user
, this condition would be true as long as the target has the rolecompany:default:user
with the contextDEPARTMENT1
.