caps.serializers
This module provides serializer (and base serializers) for Django-Caps’ models.
** Note: we never expose internal db id to the external world as they are predictable for an attacker. Instead we refer to them using their UUID. **
- class AccessSerializer(*args, **kwargs)[source]
Bases:
UUIDSerializer,SerializerSerializer for
Access.Implemented as simple Serializer, since the corresponding models are generated based on concrete
models.object.Owned.
- class AgentSerializer(*args, **kwargs)[source]
Bases:
UUIDSerializer,ModelSerializerSerializer for
Agent.- name
Provided fields for utility
- class OwnedSerializer(*args, **kwargs)[source]
Bases:
UUIDSerializer,ModelSerializerBase serializer for
Owned.When the owned object has
accessset, it will use the access’ uuid as id. This happens for example when it is fetched from database using theaccess()method.It is highly recommanded to set the user’s
agentandagentsin the serializer context (implemented API view already does it for you). This allows validation of the owner.- access
Access
Bases:
SerializerThis serializer is used to deserialize requests to derive a Access (
share()).