querysub 0.692.0 → 0.693.0
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/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import { isNode, sha256Hash, timeInHour } from "socket-function/src/misc";
|
|
|
6
6
|
import { registerAliveChecker } from "../2-proxy/garbageCollection";
|
|
7
7
|
import { generateLoginEmail } from "./loginEmail";
|
|
8
8
|
import { logErrors } from "../errors";
|
|
9
|
-
import { PermissionsParameters } from "../3-path-functions/syncSchema";
|
|
9
|
+
import { PermissionsCallback, PermissionsParameters } from "../3-path-functions/syncSchema";
|
|
10
10
|
import { sendEmail_postmark } from "../email_ims_notifications/postmark";
|
|
11
11
|
import { isClient } from "../config2";
|
|
12
12
|
import { getExternalIP } from "../misc/networking";
|
|
@@ -457,6 +457,17 @@ export function satisifiedUserType(currentType: UserType, minimumType: UserType)
|
|
|
457
457
|
return currentType === minimumType || userTypeRanking[currentType] > userTypeRanking[minimumType];
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
+
export function createWildcardUserPERMISSIONS(config: { wildcardIndex: number; allowSuperUser?: boolean; }): PermissionsCallback {
|
|
461
|
+
let check: PermissionsCallback = permissionsConfig => {
|
|
462
|
+
if (config.allowSuperUser && isSuperUserPERMISSIONS()) return true;
|
|
463
|
+
let userId = getUserIdAllowUndefined();
|
|
464
|
+
if (!userId) return false;
|
|
465
|
+
return permissionsConfig.pathWildcards[config.wildcardIndex] === userId;
|
|
466
|
+
};
|
|
467
|
+
check.callImmutable = true;
|
|
468
|
+
return check;
|
|
469
|
+
}
|
|
470
|
+
|
|
460
471
|
export function createUserPERMISSIONS(userType: UserType) {
|
|
461
472
|
return () => {
|
|
462
473
|
let allowed = isCurrentUserType(userType);
|