@felloh-org/lambda-wrapper 1.11.24 → 1.11.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,7 +7,11 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _typeorm = require("typeorm");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _feature = _interopRequireDefault(require("../feature"));
|
|
11
|
+
|
|
12
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9;
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
15
|
|
|
12
16
|
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
13
17
|
|
|
@@ -36,7 +40,12 @@ let Role = (_dec = (0, _typeorm.Entity)({
|
|
|
36
40
|
}), _dec8 = (0, _typeorm.Column)({
|
|
37
41
|
type: "varchar",
|
|
38
42
|
length: "100"
|
|
39
|
-
}), _dec9 = (0, _typeorm.
|
|
43
|
+
}), _dec9 = (0, _typeorm.ManyToOne)(() => _feature.default, {
|
|
44
|
+
nullable: true
|
|
45
|
+
}), _dec10 = (0, _typeorm.JoinColumn)({
|
|
46
|
+
name: 'dependent_feature_id',
|
|
47
|
+
referencedColumnName: 'id'
|
|
48
|
+
}), _dec11 = (0, _typeorm.CreateDateColumn)(), _dec(_class = (_class2 = class Role {
|
|
40
49
|
constructor() {
|
|
41
50
|
_initializerDefineProperty(this, "id", _descriptor, this);
|
|
42
51
|
|
|
@@ -52,7 +61,9 @@ let Role = (_dec = (0, _typeorm.Entity)({
|
|
|
52
61
|
|
|
53
62
|
_initializerDefineProperty(this, "group", _descriptor7, this);
|
|
54
63
|
|
|
55
|
-
_initializerDefineProperty(this, "
|
|
64
|
+
_initializerDefineProperty(this, "feature", _descriptor8, this);
|
|
65
|
+
|
|
66
|
+
_initializerDefineProperty(this, "created_at", _descriptor9, this);
|
|
56
67
|
}
|
|
57
68
|
|
|
58
69
|
}, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "id", [_dec2], {
|
|
@@ -98,7 +109,14 @@ let Role = (_dec = (0, _typeorm.Entity)({
|
|
|
98
109
|
initializer: function () {
|
|
99
110
|
return "";
|
|
100
111
|
}
|
|
101
|
-
}), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "
|
|
112
|
+
}), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "feature", [_dec9, _dec10], {
|
|
113
|
+
configurable: true,
|
|
114
|
+
enumerable: true,
|
|
115
|
+
writable: true,
|
|
116
|
+
initializer: function () {
|
|
117
|
+
return _feature.default;
|
|
118
|
+
}
|
|
119
|
+
}), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "created_at", [_dec11], {
|
|
102
120
|
configurable: true,
|
|
103
121
|
enumerable: true,
|
|
104
122
|
writable: true,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { MigrationInterface, QueryRunner } = require("typeorm");
|
|
2
|
+
|
|
3
|
+
module.exports = class dependentFeature1695127749722 {
|
|
4
|
+
name = 'dependentFeature1695127749722'
|
|
5
|
+
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
await queryRunner.query(`ALTER TABLE "user"."role" ADD "dependent_feature_id" uuid`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async down(queryRunner) {
|
|
11
|
+
await queryRunner.query(`ALTER TABLE "user"."role" DROP COLUMN "dependent_feature_id"`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -132,16 +132,16 @@ class AuthenticationService extends _dependencyAware.default {
|
|
|
132
132
|
// Fetch the users assigned roles
|
|
133
133
|
const userRoles = await this.fetchUserRoles(this.user.id); // Loop through the roles and determine match count
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
const rolesMatching = {};
|
|
136
136
|
|
|
137
137
|
for (const userRole of userRoles) {
|
|
138
138
|
if (roles.indexOf(userRole) !== -1) {
|
|
139
|
-
|
|
139
|
+
rolesMatching[userRole] = 1;
|
|
140
140
|
}
|
|
141
141
|
} // Throw an error if the user does not have all the roles
|
|
142
142
|
|
|
143
143
|
|
|
144
|
-
if (
|
|
144
|
+
if (Object.keys(rolesMatching).length !== roles.length) {
|
|
145
145
|
const notFoundResponse = new _response.default(null, 401);
|
|
146
146
|
notFoundResponse.addError({
|
|
147
147
|
title: 'Unauthorized',
|