Skip to content

Commit a67b93b

Browse files
committed
implement Permissible on AuthenticatedRequest
1 parent 49cb0e6 commit a67b93b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/AuthenticatedRequest.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {Authorisation} from "./auth/Authorisation.js";
2+
import {Permissible} from "./auth/Permissible.js";
23
import {Request} from "./Request.js";
34

4-
export class AuthenticatedRequest<A> extends Request<A> {
5+
export class AuthenticatedRequest<A> extends Request<A> implements Permissible {
56
public readonly authorisation: Authorisation<A>;
67
public constructor(
78
authorisation: Authorisation<A>,
@@ -10,4 +11,12 @@ export class AuthenticatedRequest<A> extends Request<A> {
1011
super(...args);
1112
this.authorisation = authorisation;
1213
}
14+
15+
/**
16+
* Check if the request has the specified permission.
17+
* @param permission
18+
*/
19+
public has(permission: Permission): boolean {
20+
return this.authorisation.has(permission);
21+
}
1322
}

0 commit comments

Comments
 (0)