mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
16 lines
535 B
TypeScript
16 lines
535 B
TypeScript
import { ACL } from '../../util/Vocabularies';
|
|
import type { AccessCheckerArgs } from './AccessChecker';
|
|
import { AccessChecker } from './AccessChecker';
|
|
|
|
/**
|
|
* Checks if the given WebID has been given access.
|
|
*/
|
|
export class AgentAccessChecker extends AccessChecker {
|
|
public async handle({ acl, rule, credentials }: AccessCheckerArgs): Promise<boolean> {
|
|
if (typeof credentials.agent?.webId === 'string') {
|
|
return acl.countQuads(rule, ACL.terms.agent, credentials.agent.webId, null) !== 0;
|
|
}
|
|
return false;
|
|
}
|
|
}
|