@objectstack/plugin-auth 6.8.1 → 6.9.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/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -937,14 +937,18 @@ var AuthManager = class {
|
|
|
937
937
|
// never seed `sys_environment`) keep working: any lookup error
|
|
938
938
|
// is treated as "no envs to protect".
|
|
939
939
|
organizationHooks: {
|
|
940
|
-
// Gate fresh organization creation behind
|
|
940
|
+
// Gate fresh organization creation behind the multi-org flag.
|
|
941
941
|
// The plugin itself is always installed (so list/update/invite endpoints
|
|
942
942
|
// keep responding); only the `create` operation is denied when the
|
|
943
|
-
// deployment is provisioned in single-org mode.
|
|
944
|
-
//
|
|
943
|
+
// deployment is provisioned in single-org mode. Resolution order:
|
|
944
|
+
// 1. explicit `OS_MULTI_ORG_ENABLED` (wins for backwards compat),
|
|
945
|
+
// 2. else `OS_MULTI_TENANT` (multi-tenant deployments are always
|
|
946
|
+
// multi-org), default `'false'` → single-org / per-env runtime.
|
|
945
947
|
beforeCreateOrganization: async () => {
|
|
948
|
+
const env = globalThis?.process?.env ?? {};
|
|
949
|
+
const explicit = env.OS_MULTI_ORG_ENABLED;
|
|
946
950
|
const flag = String(
|
|
947
|
-
|
|
951
|
+
explicit ?? env.OS_MULTI_TENANT ?? "false"
|
|
948
952
|
).toLowerCase();
|
|
949
953
|
if (flag === "false") {
|
|
950
954
|
const { APIError } = await import("better-auth/api");
|
|
@@ -1335,8 +1339,9 @@ var AuthManager = class {
|
|
|
1335
1339
|
requireEmailVerification: emailPasswordConfig.requireEmailVerification ?? false
|
|
1336
1340
|
};
|
|
1337
1341
|
const pluginConfig = this.config.plugins ?? {};
|
|
1342
|
+
const multiOrgEnv = globalThis?.process?.env ?? {};
|
|
1338
1343
|
const multiOrgEnabled = String(
|
|
1339
|
-
|
|
1344
|
+
multiOrgEnv.OS_MULTI_ORG_ENABLED ?? multiOrgEnv.OS_MULTI_TENANT ?? "false"
|
|
1340
1345
|
).toLowerCase() !== "false";
|
|
1341
1346
|
const DEFAULT_TERMS_URL = "https://objectstack.ai/terms";
|
|
1342
1347
|
const DEFAULT_PRIVACY_URL = "https://objectstack.ai/privacy";
|