feat: Use PermissionReaders to determine available permissions

These readers will determine which permissions
are available for the incoming credentials.
Their results then get combined in a UnionReader
and authorized in a PermissionBasedAuthorizer
This commit is contained in:
Joachim Van Herwegen
2021-09-20 11:24:38 +02:00
parent e8dedf5c23
commit bf28c83ffa
50 changed files with 714 additions and 445 deletions

View File

@@ -1,4 +1,4 @@
import type { ResourceStore, PermissionSet } from '../../src/';
import type { ResourceStore, Permission } from '../../src/';
import { BasicRepresentation } from '../../src/';
export class AclHelper {
@@ -11,7 +11,7 @@ export class AclHelper {
public async setSimpleAcl(
resource: string,
options: {
permissions: Partial<PermissionSet>;
permissions: Partial<Permission>;
agentClass?: 'agent' | 'authenticated';
agent?: string;
accessTo?: boolean;
@@ -32,7 +32,7 @@ export class AclHelper {
];
for (const perm of [ 'Read', 'Append', 'Write', 'Control' ]) {
if (options.permissions[perm.toLowerCase() as keyof PermissionSet]) {
if (options.permissions[perm.toLowerCase() as keyof Permission]) {
acl.push(`;\n acl:mode acl:${perm}`);
}
}