Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 1x | import {validation} from '@feasibleone/blong';
/**
* `access.acl.add` — explicit validation override.
*
* The auto-generated schema requires `aclId` (the row's ULID) and would reject
* the virtual display fields the editor round-trips; the server generates the id
* and the handler drops the virtuals.
*/
export default validation(
async ({lib: {type}}) =>
function accessAclAdd() {
return {
params: type.Object(
{
acl: type.Optional(
type.Object(
{
aclId: type.Optional(type.String()),
/** Principal resource (user / role / unit / capability). */
principalId: type.Optional(type.String()),
/** Action resource (`access_action`). */
actionId: type.Optional(type.String()),
/** `record` or `scope`. */
targetKind: type.Optional(type.String()),
/** Guarded record, or a scope node. */
targetId: type.Optional(type.String()),
/** `allow` or `deny`. */
effect: type.Optional(type.String()),
isActive: type.Optional(
type.Union([
type.Boolean(),
type.Literal(0),
type.Literal(1),
]),
),
// Virtual display fields joined by find/get.
principalName: type.Optional(type.String()),
actionName: type.Optional(type.String()),
targetName: type.Optional(type.String()),
},
{additionalProperties: true},
),
),
},
{additionalProperties: true},
),
result: type.Object({}, {additionalProperties: true}),
};
},
);
|