proto.io 0.0.146 → 0.0.147
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/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -800,14 +800,16 @@ class ProtoInternal {
|
|
|
800
800
|
return func(proxy(payload ?? proto));
|
|
801
801
|
const { callback, validator } = func;
|
|
802
802
|
const roles = await proto.currentRoles();
|
|
803
|
-
if (
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
803
|
+
if (!options?.master) {
|
|
804
|
+
if (!!validator?.requireUser && !(await proto.currentUser()))
|
|
805
|
+
throw Error('No permission');
|
|
806
|
+
if (!!validator?.requireMaster)
|
|
807
|
+
throw Error('No permission');
|
|
808
|
+
if (_.isArray(validator?.requireAnyUserRoles) && !_.some(validator?.requireAnyUserRoles, x => _.includes(roles, x)))
|
|
809
|
+
throw Error('No permission');
|
|
810
|
+
if (_.isArray(validator?.requireAllUserRoles) && _.some(validator?.requireAllUserRoles, x => !_.includes(roles, x)))
|
|
811
|
+
throw Error('No permission');
|
|
812
|
+
}
|
|
811
813
|
return callback(proxy(payload ?? proto));
|
|
812
814
|
}
|
|
813
815
|
async varifyPassword(proto, user, password, options) {
|