@illustrisinteractive/sentinel-nest 0.0.5 → 0.0.6
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.
- package/dist/src/sentinel/resources/NewResource3.d.ts +4 -0
- package/dist/src/sentinel/resources/NewResource3.js +18 -0
- package/dist/src/sentinel/resources/NewResource3.js.map +1 -0
- package/dist/src/sentinel/resources/TestResource.d.ts +4 -0
- package/dist/src/sentinel/resources/TestResource.js +18 -0
- package/dist/src/sentinel/resources/TestResource.js.map +1 -0
- package/dist/src/sentinel.guard.d.ts +2 -1
- package/dist/src/sentinel.guard.js +7 -8
- package/dist/src/sentinel.guard.js.map +1 -1
- package/dist/src/sentinel.module.js +2 -3
- package/dist/src/sentinel.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/main.ts +2 -2
- package/src/sentinel/resources/.sentinel/NewResource2.d.ts +4 -0
- package/src/sentinel/resources/.sentinel/NewResource2.js +13 -0
- package/src/sentinel/resources/.sentinel/NewResource2.js.map +1 -0
- package/src/sentinel/resources/.sentinel/NewResource3.d.ts +4 -0
- package/src/sentinel/resources/.sentinel/NewResource3.js +18 -0
- package/src/sentinel/resources/.sentinel/NewResource3.js.map +1 -0
- package/src/sentinel/resources/.sentinel/TestResource.d.ts +5 -0
- package/src/sentinel/resources/.sentinel/TestResource.js +19 -0
- package/src/sentinel/resources/.sentinel/TestResource.js.map +1 -0
- package/src/sentinel/resources/.sentinel/tsconfig.tsbuildinfo +1 -0
- package/src/sentinel/resources/NewResource3.ts +18 -0
- package/src/sentinel/resources/TestResource.ts +18 -0
- package/src/sentinel/resources/tsconfig.json +26 -0
- package/src/sentinel/sentinel.config.json +39 -0
- package/src/sentinel.guard.ts +8 -9
- package/src/sentinel.module.ts +2 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NewResource3 = void 0;
|
|
4
|
+
const SecuredResource_1 = require("../../models/SecuredResource");
|
|
5
|
+
class NewResource3 extends SecuredResource_1.SecuredResource {
|
|
6
|
+
static actions = {
|
|
7
|
+
manage: {
|
|
8
|
+
description: 'Allows all Actions in this Secured Resource',
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
static {
|
|
12
|
+
Object.keys(NewResource3.actions).forEach((key) => {
|
|
13
|
+
NewResource3.actions[key].source = 'NewResource3';
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.NewResource3 = NewResource3;
|
|
18
|
+
//# sourceMappingURL=NewResource3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewResource3.js","sourceRoot":"","sources":["../../../../src/sentinel/resources/NewResource3.ts"],"names":[],"mappings":";;;AAAA,kEAGsC;AAEtC,MAAa,YAAa,SAAQ,iCAAe;IAC/C,MAAM,CAAC,OAAO,GAA0C;QACtD,MAAM,EAAE;YACN,WAAW,EAAE,6CAA6C;SAC3D;KACF,CAAC;IAEF;QACE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAChD,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,cAAc,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;;AAXH,oCAYC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestResource = void 0;
|
|
4
|
+
const SecuredResource_1 = require("../../models/SecuredResource");
|
|
5
|
+
class TestResource extends SecuredResource_1.SecuredResource {
|
|
6
|
+
static actions = {
|
|
7
|
+
manage: {
|
|
8
|
+
description: 'Allows all Actions in this Secured Resource',
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
static {
|
|
12
|
+
Object.keys(TestResource.actions).forEach((key) => {
|
|
13
|
+
TestResource.actions[key].source = 'TestResource';
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.TestResource = TestResource;
|
|
18
|
+
//# sourceMappingURL=TestResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestResource.js","sourceRoot":"","sources":["../../../../src/sentinel/resources/TestResource.ts"],"names":[],"mappings":";;;AAAA,kEAGsC;AAEtC,MAAa,YAAa,SAAQ,iCAAe;IAC/C,MAAM,CAAC,OAAO,GAA0C;QACtD,MAAM,EAAE;YACN,WAAW,EAAE,6CAA6C;SAC3D;KACF,CAAC;IAEF;QACE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAChD,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,cAAc,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;;AAXH,oCAYC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
2
|
import { SentinelService } from './sentinel.service';
|
|
3
|
+
import { Reflector } from '@nestjs/core';
|
|
3
4
|
export declare class SentinelGuard implements CanActivate {
|
|
4
5
|
private readonly sentinelService;
|
|
5
6
|
private reflector;
|
|
6
|
-
constructor(sentinelService: SentinelService);
|
|
7
|
+
constructor(sentinelService: SentinelService, reflector: Reflector);
|
|
7
8
|
canActivate(context: ExecutionContext): boolean;
|
|
8
9
|
}
|
|
@@ -13,15 +13,17 @@ exports.SentinelGuard = void 0;
|
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const sentinel_service_1 = require("./sentinel.service");
|
|
15
15
|
const core_1 = require("@nestjs/core");
|
|
16
|
-
const
|
|
16
|
+
const can_decorator_1 = require("../src/can.decorator");
|
|
17
17
|
let SentinelGuard = class SentinelGuard {
|
|
18
18
|
sentinelService;
|
|
19
19
|
reflector;
|
|
20
|
-
constructor(sentinelService) {
|
|
20
|
+
constructor(sentinelService, reflector) {
|
|
21
21
|
this.sentinelService = sentinelService;
|
|
22
|
+
this.reflector = reflector;
|
|
22
23
|
}
|
|
23
24
|
canActivate(context) {
|
|
24
|
-
|
|
25
|
+
console.log(this.reflector);
|
|
26
|
+
const requiredActions = this.reflector.get(can_decorator_1.Can, context.getHandler());
|
|
25
27
|
console.log(requiredActions);
|
|
26
28
|
if (requiredActions.length == 0)
|
|
27
29
|
return true;
|
|
@@ -61,12 +63,9 @@ let SentinelGuard = class SentinelGuard {
|
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
65
|
exports.SentinelGuard = SentinelGuard;
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, common_1.Inject)(),
|
|
66
|
-
__metadata("design:type", core_1.Reflector)
|
|
67
|
-
], SentinelGuard.prototype, "reflector", void 0);
|
|
68
66
|
exports.SentinelGuard = SentinelGuard = __decorate([
|
|
69
67
|
(0, common_1.Injectable)(),
|
|
70
|
-
__metadata("design:paramtypes", [sentinel_service_1.SentinelService
|
|
68
|
+
__metadata("design:paramtypes", [sentinel_service_1.SentinelService,
|
|
69
|
+
core_1.Reflector])
|
|
71
70
|
], SentinelGuard);
|
|
72
71
|
//# sourceMappingURL=sentinel.guard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentinel.guard.js","sourceRoot":"","sources":["../../src/sentinel.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"sentinel.guard.js","sourceRoot":"","sources":["../../src/sentinel.guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA2E;AAC3E,yDAAqD;AAIrD,uCAAyC;AACzC,wDAA2C;AAGpC,IAAM,aAAa,GAAnB,MAAM,aAAa;IAEL;IACT;IAFV,YACmB,eAAgC,EACzC,SAAoB;QADX,oBAAe,GAAf,eAAe,CAA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AE,OAAO,KAAK,CAAC;YAE3B,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YACpE,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;gBACrC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;oBACnB,OAAO,KAAK,CAAC;gBACf,CAAC;gBAED,IAAI,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC;oBAAE,OAAO,IAAI,CAAC;YACxE,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF,CAAA;AAlDY,sCAAa;wBAAb,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAGyB,kCAAe;QAC9B,gBAAS;GAHnB,aAAa,CAkDzB"}
|
|
@@ -13,7 +13,6 @@ const config_1 = require("@nestjs/config");
|
|
|
13
13
|
const prisma_service_1 = require("./prisma.service");
|
|
14
14
|
const sentinel_module_definition_1 = require("./sentinel.module-definition");
|
|
15
15
|
const jwt_1 = require("@nestjs/jwt");
|
|
16
|
-
const sentinel_guard_1 = require("./sentinel.guard");
|
|
17
16
|
let SentinelModule = class SentinelModule extends sentinel_module_definition_1.ConfigurableModuleClass {
|
|
18
17
|
};
|
|
19
18
|
exports.SentinelModule = SentinelModule;
|
|
@@ -33,8 +32,8 @@ exports.SentinelModule = SentinelModule = __decorate([
|
|
|
33
32
|
}),
|
|
34
33
|
],
|
|
35
34
|
controllers: [],
|
|
36
|
-
providers: [prisma_service_1.PrismaService, sentinel_service_1.SentinelService
|
|
37
|
-
exports: [prisma_service_1.PrismaService, sentinel_service_1.SentinelService
|
|
35
|
+
providers: [prisma_service_1.PrismaService, sentinel_service_1.SentinelService],
|
|
36
|
+
exports: [prisma_service_1.PrismaService, sentinel_service_1.SentinelService],
|
|
38
37
|
})
|
|
39
38
|
], SentinelModule);
|
|
40
39
|
//# sourceMappingURL=sentinel.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentinel.module.js","sourceRoot":"","sources":["../../src/sentinel.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,yDAAqD;AACrD,2CAA6D;AAC7D,qDAAiD;AACjD,6EAAuE;AACvE,qCAAwC;
|
|
1
|
+
{"version":3,"file":"sentinel.module.js","sourceRoot":"","sources":["../../src/sentinel.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,yDAAqD;AACrD,2CAA6D;AAC7D,qDAAiD;AACjD,6EAAuE;AACvE,qCAAwC;AAoBjC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,oDAAuB;CAAG,CAAA;AAAjD,wCAAc;yBAAd,cAAc;IAlB1B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,qBAAY,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YACxC,eAAS,CAAC,aAAa,CAAC;gBACtB,OAAO,EAAE,CAAC,qBAAY,CAAC;gBACvB,MAAM,EAAE,CAAC,sBAAa,CAAC;gBACvB,UAAU,EAAE,CAAC,aAA4B,EAAE,EAAE,CAAC,CAAC;oBAC7C,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,cAAc,CAAC;oBAChD,WAAW,EAAE;wBACX,SAAS,EAAE,KAAK;qBACjB;iBACF,CAAC;aACH,CAAC;SACH;QACD,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,CAAC,8BAAa,EAAE,kCAAe,CAAC;QAC3C,OAAO,EAAE,CAAC,8BAAa,EAAE,kCAAe,CAAC;KAC1C,CAAC;GACW,cAAc,CAAmC"}
|