mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: clean up structure using more AsyncHandlers and more folders
This commit is contained in:
@@ -1,23 +1,25 @@
|
||||
import { AsyncHandler } from '../util/AsyncHandler';
|
||||
import { Credentials } from '../authentication/Credentials';
|
||||
import { PermissionSet } from '../ldp/permissions/PermissionSet';
|
||||
import { ResourceIdentifier } from '../ldp/http/ResourceIdentifier';
|
||||
import { ResourceIdentifier } from '../ldp/representation/ResourceIdentifier';
|
||||
|
||||
/**
|
||||
* Responsible for the permission verification.
|
||||
* Verifies if the given credentials have access to the given permissions on the given resource.
|
||||
* An {@link Error} with the necessary explanation will be thrown when permissions are not granted.
|
||||
*/
|
||||
export interface Authorizer {
|
||||
export type Authorizer = AsyncHandler<AuthorizerArgs>;
|
||||
|
||||
export interface AuthorizerArgs {
|
||||
/**
|
||||
* Verifies if the given credentials have access to the given permissions on the given resource.
|
||||
* @param credentials - Credentials of the entity that wants to use the resource.
|
||||
* @param identifier - Identifier of the resource that will be read/modified.
|
||||
* @param permissions - Permissions that are requested on the resource.
|
||||
*
|
||||
* @returns A promise resolving when the Authorizer is finished.
|
||||
* An {@link Error} with the necessary explanation will be thrown when permissions are not granted.
|
||||
* Credentials of the entity that wants to use the resource.
|
||||
*/
|
||||
ensurePermissions: (
|
||||
credentials: Credentials,
|
||||
identifier: ResourceIdentifier,
|
||||
permissions: PermissionSet,
|
||||
) => Promise<void>;
|
||||
credentials: Credentials;
|
||||
/**
|
||||
* Identifier of the resource that will be read/modified.
|
||||
*/
|
||||
identifier: ResourceIdentifier;
|
||||
/**
|
||||
* Permissions that are requested on the resource.
|
||||
*/
|
||||
permissions: PermissionSet;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user