mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Restructure source code folder
This way the location of certain classes should make more sense
This commit is contained in:
15
src/authorization/access/AgentAccessChecker.ts
Normal file
15
src/authorization/access/AgentAccessChecker.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
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, credential }: AccessCheckerArgs): Promise<boolean> {
|
||||
if (typeof credential.webId === 'string') {
|
||||
return acl.countQuads(rule, ACL.terms.agent, credential.webId, null) !== 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user