@autofleet/zehut 1.4.9 → 1.4.10-beta-1
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/lib/check-permission.d.ts +1 -0
- package/lib/check-permission.js +3 -2
- package/lib/errors.d.ts +5 -0
- package/lib/errors.js +10 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const checkFleetPermission: (fleetId: any) => any;
|
|
2
2
|
export declare const checkBusinessModelPermission: (businessModelId: any) => any;
|
|
3
3
|
export declare const checkDemandSourcePermission: (demandSourceId: any) => any;
|
|
4
|
+
export declare const getUser: () => any;
|
|
4
5
|
export declare const isUserExist: () => boolean;
|
package/lib/check-permission.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isUserExist = exports.checkDemandSourcePermission = exports.checkBusinessModelPermission = exports.checkFleetPermission = void 0;
|
|
3
|
+
exports.isUserExist = exports.getUser = exports.checkDemandSourcePermission = exports.checkBusinessModelPermission = exports.checkFleetPermission = void 0;
|
|
4
4
|
const tracer_1 = require("./tracer");
|
|
5
5
|
exports.checkFleetPermission = fleetId => {
|
|
6
6
|
if (exports.isUserExist()) {
|
|
@@ -26,4 +26,5 @@ exports.checkDemandSourcePermission = demandSourceId => {
|
|
|
26
26
|
}
|
|
27
27
|
return true;
|
|
28
28
|
};
|
|
29
|
-
exports.
|
|
29
|
+
exports.getUser = () => { var _a, _b; return (_b = (_a = tracer_1.getCurrentTrace()) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.user; };
|
|
30
|
+
exports.isUserExist = () => !!exports.getUser();
|
package/lib/errors.d.ts
ADDED
package/lib/errors.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UnauthorizedAccessError = void 0;
|
|
4
|
+
class UnauthorizedAccessError extends Error {
|
|
5
|
+
constructor(user, ...params) {
|
|
6
|
+
super(...params);
|
|
7
|
+
this.user = user;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.UnauthorizedAccessError = UnauthorizedAccessError;
|