✅ Attribute validators
Attribute mutations compose shared authentication and administrator validators in the order shown by the route source.
Inventory
| Validator | Reads | Success condition | Failure / error | Consumers |
|---|---|---|---|---|
isAuthenticated() | context.authenticate, or the Bearer fallback | The selected token adapter authenticates the request. | Adapter authentication error. | createAttributeRoute, updateAttributeRoute, deleteAttributeRoute |
checkIdentityType(['admin']) | Auth adapter, db.identities, configuration.identity.typeIds | The authenticated identity's typeId equals configured admin. | 500 missing setup; 401 invalid token; 403 unavailable, malformed, or non-admin identity. | createAttributeRoute, updateAttributeRoute, deleteAttributeRoute |
Details
isAuthenticated()
Implementation
Signature: isAuthenticated(): Validator. This shared factory calls context.authenticate(payload), falling back to Bearer authentication. attributesService injects Bearer mode unless authMode is 'cookie'; then it injects cookie authentication. See the Authentication validator.
Consumers: createAttributeRoute, updateAttributeRoute, and deleteAttributeRoute, before checkIdentityType(['admin']).
checkIdentityType(['admin'])
Implementation
Signature: checkIdentityType(['admin']): Validator. This shared factory requires db.identities and configuration.identity.typeIds, authenticates the request, loads its identity, then compares typeId with typeIds.admin. See the Authentication validator.
Consumers: createAttributeRoute, updateAttributeRoute, and deleteAttributeRoute, after isAuthenticated().