1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | Object.defineProperty(exports, "__esModule", { value: true });
|
7 | exports.isStaffOrGreater = exports.notAuthUser = exports.authUser = void 0;
|
8 | var role_entity_1 = require("./entities/role.entity");
|
9 |
|
10 |
|
11 |
|
12 | function authUser(req, _) {
|
13 | if (!req.user || req.user === undefined) {
|
14 | return false;
|
15 | }
|
16 | return true;
|
17 | }
|
18 | exports.authUser = authUser;
|
19 |
|
20 |
|
21 |
|
22 | function notAuthUser(req, res) {
|
23 | return !authUser(req, res);
|
24 | }
|
25 | exports.notAuthUser = notAuthUser;
|
26 |
|
27 |
|
28 |
|
29 | function isStaffOrGreater(req, res) {
|
30 | if (!authUser(req, res)) {
|
31 | return false;
|
32 | }
|
33 | if (req.user.level >= role_entity_1.default.STAFF_LEVEL) {
|
34 | return true;
|
35 | }
|
36 | return false;
|
37 | }
|
38 | exports.isStaffOrGreater = isStaffOrGreater;
|