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.mjs
CHANGED
|
@@ -797,14 +797,16 @@ class ProtoInternal {
|
|
|
797
797
|
return func(proxy(payload ?? proto));
|
|
798
798
|
const { callback, validator } = func;
|
|
799
799
|
const roles = await proto.currentRoles();
|
|
800
|
-
if (
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
800
|
+
if (!options?.master) {
|
|
801
|
+
if (!!validator?.requireUser && !(await proto.currentUser()))
|
|
802
|
+
throw Error('No permission');
|
|
803
|
+
if (!!validator?.requireMaster)
|
|
804
|
+
throw Error('No permission');
|
|
805
|
+
if (_.isArray(validator?.requireAnyUserRoles) && !_.some(validator?.requireAnyUserRoles, x => _.includes(roles, x)))
|
|
806
|
+
throw Error('No permission');
|
|
807
|
+
if (_.isArray(validator?.requireAllUserRoles) && _.some(validator?.requireAllUserRoles, x => !_.includes(roles, x)))
|
|
808
|
+
throw Error('No permission');
|
|
809
|
+
}
|
|
808
810
|
return callback(proxy(payload ?? proto));
|
|
809
811
|
}
|
|
810
812
|
async varifyPassword(proto, user, password, options) {
|