Policy Builders
PrivMX Endpoint has configurable policies that determine who can perform specified actions in Containers and Items.
To learn more about Policies, see the Policies documentation.
PrivMX Endpoint Kotlin Extra library provides classes that provide static fields of available policy values in ItemPolicyValues
, ContainerPolicyValues
and SpecialPolicyValue
,
as well as ItemPolicyBuilder
and ContainerPolicyBuilder
classes for configuring the respective policies.
Combining Policy Values
Some policy values like ContainerPolicyComplexValue
or ItemPolicyComplexValue
can be combined
with the same type of policy value using AND
and OR
methods.
Configuring a Container Policy
Builder will create an empty policy, if it's not configured yet, which is equivalent to setting inherit
in all fields. To configure it, call the methods responsible for setting particular policies.
Those calls can be chained together, since each of the methods setting a policy value returns the reference to the builder.
The ContainerPolicyBuilder
can build both ContainerPolicy
and ContainerPolicyWithoutItem
by calling .build()
and .buildWithoutItem()
respectively.
To build the ItemPolicy
, use ItemPolicyBuilder
which works in the same way as ContainerPolicyBuilder
.
Alternatively, you can use helper functions like itemPolicy
, containerPolicy
or containerPolicyWithoutItem
, which offer a cleaner way to define your policies.
We use cookies on our website. We use them to ensure the proper functioning of the site and, if you agree, for purposes we set, such as analytics or marketing.
PrivMX Endpoint Kotlin v2.2