Vex · API
createScopePolicy
createScopePolicy builds a scope policy from a role’s grants, a behaviors map and an optional profile name. A grant such as bookings.read decides whether a phase is present; the behaviors define the rules of a granted phase under the named profile. The returned policy has default: 'deny': it denies everything it does not list.
['shows.read', 'bookings.read', 'bookings.write.insert']
{
bookings: {
default: { read: [] },
personal: {
read: [{ match: 'member_id', to: 'memberId' }],
insert: [{ set: 'member_id', to: 'memberId' }],
},
},
}'personal'
{
default: 'deny',
entities: {
shows: { read: [] },
bookings: {
read: [{ match: 'member_id', to: 'memberId' }],
insert: [{ set: 'member_id', to: 'memberId' }],
},
},
}Runs in this page on the installed package. The input and the expected output are defined by the example.