1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.authChecker = void 0;
|
4 | // This authChecker is used by type-graphql's @Authorized decorator
|
5 | exports.authChecker = function (_a, permissions) {
|
6 | var user = _a.context.user;
|
7 | if (!user) {
|
8 | return false;
|
9 | }
|
10 | // Just checking @Authorized() - return true since we know there is a user now
|
11 | if (permissions.length === 0) {
|
12 | return user !== undefined;
|
13 | }
|
14 | // Check that permissions overlap
|
15 | return permissions.some(function (perm) { return user.permissions.includes(perm); });
|
16 | };
|
17 | //# sourceMappingURL=authChecker.js.map |
\ | No newline at end of file |