@infuro/cms-core 1.0.33 → 1.0.35
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/README.md +22 -6
- package/dist/OrderTrackPage-W3J6WIG2.js +426 -0
- package/dist/OrderTrackPage-Z6FCJQYY.cjs +428 -0
- package/dist/admin.cjs +34072 -20487
- package/dist/admin.d.cts +191 -9
- package/dist/admin.d.ts +191 -9
- package/dist/admin.js +33913 -20423
- package/dist/api.cjs +123 -16508
- package/dist/api.d.cts +633 -3
- package/dist/api.d.ts +633 -3
- package/dist/api.js +14 -16519
- package/dist/auth.cjs +196 -955
- package/dist/auth.d.cts +201 -42
- package/dist/auth.d.ts +201 -42
- package/dist/auth.js +4 -888
- package/dist/chunk-2XE4X74C.js +29602 -0
- package/dist/chunk-3DZRIZOD.cjs +52 -0
- package/dist/chunk-3KPNTQBV.cjs +620 -0
- package/dist/chunk-46GKADYE.cjs +84 -0
- package/dist/chunk-4TRPKBKO.js +589 -0
- package/dist/chunk-5ELSW2UP.js +150 -0
- package/dist/chunk-6KPQWRFW.js +171 -0
- package/dist/chunk-7NMT3GBR.cjs +29 -0
- package/dist/chunk-7YIBMQDR.cjs +86 -0
- package/dist/chunk-BGJAV67S.cjs +29710 -0
- package/dist/chunk-CNTSLED2.cjs +559 -0
- package/dist/chunk-CRFV5WJK.js +16 -0
- package/dist/chunk-D5FBNKQM.cjs +104 -0
- package/dist/chunk-EF2JBPDM.js +114 -0
- package/dist/chunk-EQPITOP6.js +543 -0
- package/dist/chunk-GO7PPYNU.js +76 -0
- package/dist/chunk-HF3L2GIT.cjs +194 -0
- package/dist/chunk-J7XHLOLO.js +830 -0
- package/dist/chunk-JBRR5UYL.js +87 -0
- package/dist/chunk-JC6DLWTE.js +21 -0
- package/dist/chunk-JHF4YYRC.cjs +188 -0
- package/dist/chunk-JXF23MPG.js +25 -0
- package/dist/chunk-MQBT33IV.js +48 -0
- package/dist/chunk-N44BJZ4C.cjs +123 -0
- package/dist/chunk-OOTLNH63.cjs +18 -0
- package/dist/chunk-PAMVINEX.cjs +577 -0
- package/dist/chunk-PNOKNSG2.cjs +222 -0
- package/dist/chunk-QM733NUK.js +186 -0
- package/dist/chunk-R73BKDRO.cjs +90 -0
- package/dist/chunk-SHUYVCID.js +4 -0
- package/dist/chunk-SYBOCAWB.js +97 -0
- package/dist/chunk-TDV6EJHV.js +192 -0
- package/dist/chunk-TFUOHI37.cjs +839 -0
- package/dist/chunk-TIAEXJLI.cjs +182 -0
- package/dist/chunk-UPLVMVRX.cjs +23 -0
- package/dist/chunk-USNT2KNT.cjs +6 -0
- package/dist/chunk-WEMDMVHQ.js +216 -0
- package/dist/chunk-XDSNZUW7.js +564 -0
- package/dist/chunk-XQ3QUHWR.cjs +83 -0
- package/dist/chunk-XW5ATPRW.cjs +155 -0
- package/dist/chunk-ZQ4X6OAU.js +82 -0
- package/dist/chunk-ZSVCP6N3.js +83 -0
- package/dist/cli.cjs +142 -84
- package/dist/cli.js +101 -27
- package/dist/email-FKR4FXFI.js +5 -0
- package/dist/email-KVKVPNCL.cjs +58 -0
- package/dist/email-queue-CGZBVVAS.js +2 -0
- package/dist/email-queue-TPZWLTIV.cjs +23 -0
- package/dist/erp-config-enabled-CUMQ6N2V.cjs +11 -0
- package/dist/erp-config-enabled-T37X7T34.js +2 -0
- package/dist/erp-order-invoice-3YISSOWW.js +3 -0
- package/dist/erp-order-invoice-ZR5F2KTA.cjs +12 -0
- package/dist/event-order-defaults-6E543227.js +2 -0
- package/dist/event-order-defaults-DUGDVGJI.cjs +39 -0
- package/dist/event-order-notifications-5GSAOYVS.cjs +27 -0
- package/dist/event-order-notifications-IIIF23D5.js +10 -0
- package/dist/hooks.cjs +259 -132
- package/dist/hooks.d.cts +42 -1
- package/dist/hooks.d.ts +42 -1
- package/dist/hooks.js +234 -91
- package/dist/index.cjs +3884 -21070
- package/dist/index.d.cts +2255 -749
- package/dist/index.d.ts +2255 -749
- package/dist/index.js +1925 -19891
- package/dist/interpolate-WAKPN56R.cjs +11 -0
- package/dist/interpolate-WDUWDF3I.js +2 -0
- package/dist/layout-36UFTHC5.cjs +11 -0
- package/dist/layout-AOBN26XG.js +2 -0
- package/dist/migrations/1778660000004-CreateCustomerAndCustomerContacts.ts +99 -0
- package/dist/migrations/1778660000005-AddCustomerIdToVendorCustomers.ts +39 -0
- package/dist/migrations/1778660000006-UpdateVendorCustomersContactNullable.ts +36 -0
- package/dist/migrations/1778660000007-VendorOwnerCustomerContactsPermission.ts +39 -0
- package/dist/migrations/1779300000000-VendorOwnerContactsPermission.ts +39 -0
- package/dist/migrations/1779400000000-AddCustomerContactIdToOrders.ts +33 -0
- package/dist/migrations/1779400000000-ConvertStatusToEnum.ts +142 -0
- package/dist/migrations/1779400000000-SeedDefaultCurrencies.ts +33 -0
- package/dist/migrations/1779500000000-VendorRolesAndPermissions.ts +102 -0
- package/dist/migrations/1779600000000-VendorRegistrationProfile.ts +52 -0
- package/dist/migrations/1779700000000-CollectionIsCatalog.ts +22 -0
- package/dist/migrations/1779710000000-CollectionPlatformCatalog.ts +60 -0
- package/dist/migrations/1779720000000-ProductCategoryPlatformCatalog.ts +157 -0
- package/dist/migrations/1779800000000-EventsAndEventProducts.ts +173 -0
- package/dist/migrations/1779810000000-BackfillVendorRoleEventsPermissions.ts +38 -0
- package/dist/migrations/1779820000000-FixProductsCategoryForeignKey.ts +70 -0
- package/dist/migrations/1779830000000-ProductTitleColumn.ts +32 -0
- package/dist/migrations/1779840000000-EventAboutAndVisibilityFields.ts +34 -0
- package/dist/migrations/1779850000000-EventCityCountrySplit.ts +43 -0
- package/dist/migrations/1779860000000-CreateCombos.ts +140 -0
- package/dist/migrations/1780100000000-OrderAttendeesEventId.ts +55 -0
- package/dist/migrations/1780110000000-EventContactFormId.ts +49 -0
- package/dist/migrations/1780130000000-ProductVariants.ts +54 -0
- package/dist/migrations/1780140000000-EventManagementEnhancements.ts +44 -0
- package/dist/migrations/1780160000000-EventRegistrationGstProductContactForm.ts +79 -0
- package/dist/migrations/1780170000000-ComboCurrencyPrices.ts +20 -0
- package/dist/migrations/1781110000000-VendorOwnerCombosPermission.ts +38 -0
- package/dist/migrations/1781120000000-RefundPoliciesAndRequests.ts +225 -0
- package/dist/migrations/1781130000000-CreateAttendees.ts +44 -0
- package/dist/migrations/1781140000000-EventOrderNotifications.ts +29 -0
- package/dist/migrations/1781150000000-EventNamedLists.ts +28 -0
- package/dist/migrations/1781160000000-RefundPolicyEventTiers.ts +27 -0
- package/dist/migrations/1781170000000-EventRefundPolicy.ts +42 -0
- package/dist/migrations/1781180000000-RemoveCartItemsUniqueConstraint.ts +15 -0
- package/dist/migrations/1781190000000-RenameProductTaxesToProductConfig.ts +84 -0
- package/dist/migrations/1781200000000-VendorOwnerProductConfigPermissions.ts +51 -0
- package/dist/migrations/1781210000000-VendorRoleProductConfigPermissions.ts +46 -0
- package/dist/migrations/helpers/vendor-role-seed.ts +243 -0
- package/dist/paid-order-erp-3USEG6WL.js +3 -0
- package/dist/paid-order-erp-FSQ3GSXE.cjs +12 -0
- package/dist/pg-boss-service-4XF2TQ2E.js +2 -0
- package/dist/pg-boss-service-L6MTF4EQ.cjs +15 -0
- package/dist/razorpay-KLO2KNCB.js +49 -0
- package/dist/razorpay-U23LGY72.cjs +56 -0
- package/dist/rbac-debug-db-D7ME7QUY.cjs +35 -0
- package/dist/rbac-debug-db-MTCTVNNM.js +33 -0
- package/dist/sms-defaults-2NL24H57.js +2 -0
- package/dist/sms-defaults-KCOPKQBA.cjs +19 -0
- package/dist/stripe-4FD27QVJ.js +51 -0
- package/dist/stripe-VU6OEG2D.cjs +57 -0
- package/dist/theme.cjs +31 -59
- package/dist/theme.d.cts +78 -3
- package/dist/theme.d.ts +78 -3
- package/dist/theme.js +23 -20
- package/dist/vendor-invite-status-77O7ZQ3U.cjs +19 -0
- package/dist/vendor-invite-status-PWJ3DE76.js +2 -0
- package/dist/whatsapp-queue-3DXA4MXU.js +2 -0
- package/dist/whatsapp-queue-KG65MXD5.cjs +15 -0
- package/package.json +147 -141
- package/dist/admin.cjs.map +0 -1
- package/dist/admin.js.map +0 -1
- package/dist/api.cjs.map +0 -1
- package/dist/api.js.map +0 -1
- package/dist/auth.cjs.map +0 -1
- package/dist/auth.js.map +0 -1
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/config-DJ5CmQvS.d.cts +0 -8
- package/dist/config-DJ5CmQvS.d.ts +0 -8
- package/dist/hooks.cjs.map +0 -1
- package/dist/hooks.js.map +0 -1
- package/dist/index-DWd5Gjc4.d.ts +0 -582
- package/dist/index-rZTnpK7y.d.cts +0 -582
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/theme.cjs.map +0 -1
- package/dist/theme.js.map +0 -1
- package/dist/types-DCVaXlPV.d.cts +0 -78
- package/dist/types-DCVaXlPV.d.ts +0 -78
- package/dist/vendor-scope-DTYhJk_I.d.cts +0 -129
- package/dist/vendor-scope-DTYhJk_I.d.ts +0 -129
package/dist/auth.cjs
CHANGED
|
@@ -1,960 +1,201 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __esm = (fn, res) => function __init() {
|
|
9
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
|
-
};
|
|
11
|
-
var __export = (target, all) => {
|
|
12
|
-
for (var name in all)
|
|
13
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
-
};
|
|
15
|
-
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let key of __getOwnPropNames(from))
|
|
18
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
-
mod
|
|
30
|
-
));
|
|
31
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
32
2
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function getPermissionableEntityKeys(entityMap) {
|
|
38
|
-
const fromMap = Object.keys(entityMap).filter((k) => !PERMISSION_ENTITY_INTERNAL_EXCLUDE.has(k));
|
|
39
|
-
const logical = PERMISSION_LOGICAL_ENTITIES.filter((k) => !fromMap.includes(k));
|
|
40
|
-
return [...fromMap.sort(), ...logical].filter((k, i, a) => a.indexOf(k) === i);
|
|
41
|
-
}
|
|
42
|
-
function permissionRowsToRecord(rows) {
|
|
43
|
-
const out = {};
|
|
44
|
-
if (!rows?.length) return out;
|
|
45
|
-
for (const p of rows) {
|
|
46
|
-
out[p.entity] = {
|
|
47
|
-
c: !!p.canCreate,
|
|
48
|
-
r: !!p.canRead,
|
|
49
|
-
u: !!p.canUpdate,
|
|
50
|
-
d: !!p.canDelete
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return out;
|
|
54
|
-
}
|
|
55
|
-
function hasEntityPermission(record, entity, action) {
|
|
56
|
-
const p = record?.[entity];
|
|
57
|
-
if (!p) return false;
|
|
58
|
-
if (action === "create") return p.c;
|
|
59
|
-
if (action === "read") return p.r;
|
|
60
|
-
if (action === "update") return p.u;
|
|
61
|
-
return p.d;
|
|
62
|
-
}
|
|
63
|
-
var PERMISSION_ENTITY_INTERNAL_EXCLUDE, PERMISSION_LOGICAL_ENTITIES, ADMIN_GROUP_NAME;
|
|
64
|
-
var init_permission_entities = __esm({
|
|
65
|
-
"src/auth/permission-entities.ts"() {
|
|
66
|
-
"use strict";
|
|
67
|
-
PERMISSION_ENTITY_INTERNAL_EXCLUDE = /* @__PURE__ */ new Set([
|
|
68
|
-
"users",
|
|
69
|
-
"password_reset_tokens",
|
|
70
|
-
"user_groups",
|
|
71
|
-
"permissions",
|
|
72
|
-
"comments",
|
|
73
|
-
"form_fields",
|
|
74
|
-
"configs",
|
|
75
|
-
"knowledge_base_chunks",
|
|
76
|
-
"carts",
|
|
77
|
-
"cart_items",
|
|
78
|
-
"wishlists",
|
|
79
|
-
"wishlist_items",
|
|
80
|
-
"message_templates",
|
|
81
|
-
"vendor_users"
|
|
82
|
-
]);
|
|
83
|
-
PERMISSION_LOGICAL_ENTITIES = [
|
|
84
|
-
"users",
|
|
85
|
-
"forms",
|
|
86
|
-
"form_submissions",
|
|
87
|
-
"dashboard",
|
|
88
|
-
"upload",
|
|
89
|
-
"settings",
|
|
90
|
-
"analytics",
|
|
91
|
-
"chat"
|
|
92
|
-
];
|
|
93
|
-
ADMIN_GROUP_NAME = "Administrator";
|
|
94
|
-
}
|
|
95
|
-
});
|
|
3
|
+
var chunkCNTSLED2_cjs = require('./chunk-CNTSLED2.cjs');
|
|
4
|
+
var chunkTIAEXJLI_cjs = require('./chunk-TIAEXJLI.cjs');
|
|
5
|
+
var chunk3KPNTQBV_cjs = require('./chunk-3KPNTQBV.cjs');
|
|
6
|
+
require('./chunk-USNT2KNT.cjs');
|
|
96
7
|
|
|
97
|
-
// src/auth/vendor-scope.ts
|
|
98
|
-
function isVendorGroupName(name) {
|
|
99
|
-
if (!name?.trim()) return false;
|
|
100
|
-
const n = name.trim().toLowerCase();
|
|
101
|
-
return n === VENDOR_OWNER_GROUP_NAME.toLowerCase() || n.includes("vendor");
|
|
102
|
-
}
|
|
103
|
-
function isPlatformAdministrator(user) {
|
|
104
|
-
if (!user?.email) return false;
|
|
105
|
-
return !!(user.isRBACAdmin || isSuperAdminGroupName(user.groupName));
|
|
106
|
-
}
|
|
107
|
-
function isVendorPortalUser(user) {
|
|
108
|
-
if (user?.isVendorPortal === true) return true;
|
|
109
|
-
if (!user?.email || isPlatformAdministrator(user)) return false;
|
|
110
|
-
if ((user.vendorIds?.length ?? 0) > 0) return true;
|
|
111
|
-
return isVendorGroupName(user.groupName);
|
|
112
|
-
}
|
|
113
|
-
function isVendorStaff(user) {
|
|
114
|
-
return isVendorPortalUser(user);
|
|
115
|
-
}
|
|
116
|
-
function isVendorOwner(user) {
|
|
117
|
-
if (user?.isVendorOwner === true) return true;
|
|
118
|
-
if (!user?.email || isPlatformAdministrator(user)) return false;
|
|
119
|
-
if (user.vendorRole === "staff") return false;
|
|
120
|
-
if (user.vendorRole === "owner") return true;
|
|
121
|
-
if (!isVendorPortalUser(user)) return false;
|
|
122
|
-
return user.groupName?.trim().toLowerCase() === VENDOR_OWNER_GROUP_NAME.toLowerCase();
|
|
123
|
-
}
|
|
124
|
-
function canManageVendorTeam(user) {
|
|
125
|
-
return isPlatformAdministrator(user) || isVendorOwner(user);
|
|
126
|
-
}
|
|
127
|
-
function canManageVendorRoles(user) {
|
|
128
|
-
return isPlatformAdministrator(user) || isVendorOwner(user);
|
|
129
|
-
}
|
|
130
|
-
function canOnboardVendors(user) {
|
|
131
|
-
return isPlatformAdministrator(user);
|
|
132
|
-
}
|
|
133
|
-
function resolveVendorScopeFromSessionUser(user) {
|
|
134
|
-
if (!user?.email) return { type: "deny" };
|
|
135
|
-
if (isPlatformAdministrator(user)) return { type: "all" };
|
|
136
|
-
const vendorIds = user.vendorIds ?? [];
|
|
137
|
-
if (vendorIds.length === 0) return { type: "deny" };
|
|
138
|
-
const preferred = user.activeVendorId ?? vendorIds[0];
|
|
139
|
-
const vendorId = vendorIds.includes(preferred) ? preferred : vendorIds[0];
|
|
140
|
-
return { type: "vendor", vendorId, vendorIds };
|
|
141
|
-
}
|
|
142
|
-
function vendorPortalFlagsFromUser(input) {
|
|
143
|
-
const vendorIds = input.vendorIds ?? [];
|
|
144
|
-
const isVendorPortal = !input.isRBACAdmin && (vendorIds.length > 0 || isVendorGroupName(input.groupName));
|
|
145
|
-
const isVendorOwner2 = isVendorPortal && input.vendorRole !== "staff" && (input.vendorRole === "owner" || input.groupName?.trim().toLowerCase() === VENDOR_OWNER_GROUP_NAME.toLowerCase());
|
|
146
|
-
return { isVendorPortal, isVendorOwner: isVendorOwner2 };
|
|
147
|
-
}
|
|
148
|
-
var VENDOR_SCOPED_STORE_ENTITIES, VENDOR_STORE_RBAC_ENTITIES, VENDOR_OWNER_GROUP_NAME;
|
|
149
|
-
var init_vendor_scope = __esm({
|
|
150
|
-
"src/auth/vendor-scope.ts"() {
|
|
151
|
-
"use strict";
|
|
152
|
-
init_permission_entities();
|
|
153
|
-
VENDOR_SCOPED_STORE_ENTITIES = /* @__PURE__ */ new Set([
|
|
154
|
-
"products",
|
|
155
|
-
"collections",
|
|
156
|
-
"brands",
|
|
157
|
-
"product_categories",
|
|
158
|
-
"orders",
|
|
159
|
-
"payments",
|
|
160
|
-
"taxes",
|
|
161
|
-
"attributes",
|
|
162
|
-
"vendor_customers",
|
|
163
|
-
"discounts"
|
|
164
|
-
]);
|
|
165
|
-
VENDOR_STORE_RBAC_ENTITIES = /* @__PURE__ */ new Set([
|
|
166
|
-
...VENDOR_SCOPED_STORE_ENTITIES,
|
|
167
|
-
"order_discounts",
|
|
168
|
-
"order_addresses"
|
|
169
|
-
]);
|
|
170
|
-
VENDOR_OWNER_GROUP_NAME = "Vendor Owner";
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
8
|
|
|
174
|
-
// src/auth/rbac-debug-db.ts
|
|
175
|
-
var rbac_debug_db_exports = {};
|
|
176
|
-
__export(rbac_debug_db_exports, {
|
|
177
|
-
loadDbPermissionsForUser: () => loadDbPermissionsForUser
|
|
178
|
-
});
|
|
179
|
-
async function loadDbPermissionsForUser(dataSource, userId) {
|
|
180
|
-
const rows = await dataSource.query(
|
|
181
|
-
`
|
|
182
|
-
SELECT u."groupId" AS "groupId", g.name AS "groupName",
|
|
183
|
-
p.entity, p."canCreate", p."canRead", p."canUpdate", p."canDelete"
|
|
184
|
-
FROM users u
|
|
185
|
-
LEFT JOIN user_groups g ON g.id = u."groupId" AND g.deleted = false
|
|
186
|
-
LEFT JOIN permissions p ON p."groupId" = g.id
|
|
187
|
-
WHERE u.id = $1
|
|
188
|
-
`,
|
|
189
|
-
[userId]
|
|
190
|
-
);
|
|
191
|
-
const groupId = rows[0]?.groupId ?? null;
|
|
192
|
-
const groupName = rows[0]?.groupName ?? null;
|
|
193
|
-
const permRows = rows.filter((r) => r.entity).map((r) => ({
|
|
194
|
-
entity: r.entity,
|
|
195
|
-
canCreate: !!r.canCreate,
|
|
196
|
-
canRead: !!r.canRead,
|
|
197
|
-
canUpdate: !!r.canUpdate,
|
|
198
|
-
canDelete: !!r.canDelete
|
|
199
|
-
}));
|
|
200
|
-
return {
|
|
201
|
-
groupId,
|
|
202
|
-
groupName,
|
|
203
|
-
dbEntityPerms: summarizeEntityPerms(permissionRowsToRecord(permRows))
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
var init_rbac_debug_db = __esm({
|
|
207
|
-
"src/auth/rbac-debug-db.ts"() {
|
|
208
|
-
"use strict";
|
|
209
|
-
init_permission_entities();
|
|
210
|
-
init_rbac_debug();
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
9
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
10
|
+
Object.defineProperty(exports, "createCmsMiddleware", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return chunkCNTSLED2_cjs.createCmsMiddleware; }
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "defaultPublicApiMethods", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunkCNTSLED2_cjs.defaultPublicApiMethods; }
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "getNextAuthOptions", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return chunkCNTSLED2_cjs.getNextAuthOptions; }
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "getStorefrontNextAuthOptions", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return chunkCNTSLED2_cjs.getStorefrontNextAuthOptions; }
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "isAuthDebugClientEnabled", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return chunkCNTSLED2_cjs.isAuthDebugClientEnabled; }
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "isAuthDebugEnabled", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return chunkCNTSLED2_cjs.isAuthDebugEnabled; }
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "logAuth", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () { return chunkCNTSLED2_cjs.logAuth; }
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "logAuthClient", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () { return chunkCNTSLED2_cjs.logAuthClient; }
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "nextAuthCookieDebugInfo", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () { return chunkCNTSLED2_cjs.nextAuthCookieDebugInfo; }
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, "seedAdministratorPermissions", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () { return chunkCNTSLED2_cjs.seedAdministratorPermissions; }
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "summarizeSessionUserForLog", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () { return chunkCNTSLED2_cjs.summarizeSessionUserForLog; }
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "OPEN_ENDPOINTS", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () { return chunkTIAEXJLI_cjs.OPEN_ENDPOINTS; }
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "PERMISSION_REQUIRED_ENDPOINTS", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () { return chunkTIAEXJLI_cjs.PERMISSION_REQUIRED_ENDPOINTS; }
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, "RBAC_ADMIN_ONLY_ENTITIES", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function () { return chunkTIAEXJLI_cjs.RBAC_ADMIN_ONLY_ENTITIES; }
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "canManageRoles", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () { return chunkTIAEXJLI_cjs.canManageRoles; }
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(exports, "createAuthHelpers", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () { return chunkTIAEXJLI_cjs.createAuthHelpers; }
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(exports, "createCmsAuthBundle", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function () { return chunkTIAEXJLI_cjs.createCmsAuthBundle; }
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "getRequiredPermission", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () { return chunkTIAEXJLI_cjs.getRequiredPermission; }
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(exports, "isOpenEndpoint", {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function () { return chunkTIAEXJLI_cjs.isOpenEndpoint; }
|
|
85
|
+
});
|
|
86
|
+
Object.defineProperty(exports, "isPublicMethod", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function () { return chunkTIAEXJLI_cjs.isPublicMethod; }
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "sessionHasEntityAccess", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () { return chunkTIAEXJLI_cjs.sessionHasEntityAccess; }
|
|
93
|
+
});
|
|
94
|
+
Object.defineProperty(exports, "ADMIN_GROUP_NAME", {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function () { return chunk3KPNTQBV_cjs.ADMIN_GROUP_NAME; }
|
|
97
|
+
});
|
|
98
|
+
Object.defineProperty(exports, "SUPER_ADMIN_GROUP_ID", {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () { return chunk3KPNTQBV_cjs.SUPER_ADMIN_GROUP_ID; }
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "VENDOR_ADMIN_GROUP_ID", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () { return chunk3KPNTQBV_cjs.VENDOR_ADMIN_GROUP_ID; }
|
|
105
|
+
});
|
|
106
|
+
Object.defineProperty(exports, "VENDOR_OWNER_GROUP_NAME", {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
get: function () { return chunk3KPNTQBV_cjs.VENDOR_OWNER_GROUP_NAME; }
|
|
109
|
+
});
|
|
110
|
+
Object.defineProperty(exports, "VENDOR_SCOPED_STORE_ENTITIES", {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get: function () { return chunk3KPNTQBV_cjs.VENDOR_SCOPED_STORE_ENTITIES; }
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "VENDOR_STORE_RBAC_ENTITIES", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function () { return chunk3KPNTQBV_cjs.VENDOR_STORE_RBAC_ENTITIES; }
|
|
117
|
+
});
|
|
118
|
+
Object.defineProperty(exports, "canManageVendorRoles", {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
get: function () { return chunk3KPNTQBV_cjs.canManageVendorRoles; }
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(exports, "canManageVendorTeam", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
get: function () { return chunk3KPNTQBV_cjs.canManageVendorTeam; }
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "canOnboardVendors", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function () { return chunk3KPNTQBV_cjs.canOnboardVendors; }
|
|
129
|
+
});
|
|
130
|
+
Object.defineProperty(exports, "explainSessionEntityAccess", {
|
|
131
|
+
enumerable: true,
|
|
132
|
+
get: function () { return chunk3KPNTQBV_cjs.explainSessionEntityAccess; }
|
|
133
|
+
});
|
|
134
|
+
Object.defineProperty(exports, "getPermissionableEntityKeys", {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
get: function () { return chunk3KPNTQBV_cjs.getPermissionableEntityKeys; }
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "hasEntityPermission", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function () { return chunk3KPNTQBV_cjs.hasEntityPermission; }
|
|
141
|
+
});
|
|
142
|
+
Object.defineProperty(exports, "isPlatformAdministrator", {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: function () { return chunk3KPNTQBV_cjs.isPlatformAdministrator; }
|
|
145
|
+
});
|
|
146
|
+
Object.defineProperty(exports, "isRbacDebugEnabled", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function () { return chunk3KPNTQBV_cjs.isRbacDebugEnabled; }
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "isSuperAdmin", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () { return chunk3KPNTQBV_cjs.isSuperAdmin; }
|
|
153
|
+
});
|
|
154
|
+
Object.defineProperty(exports, "isSuperAdminGroupName", {
|
|
155
|
+
enumerable: true,
|
|
156
|
+
get: function () { return chunk3KPNTQBV_cjs.isSuperAdminGroupName; }
|
|
157
|
+
});
|
|
158
|
+
Object.defineProperty(exports, "isVendorAdmin", {
|
|
159
|
+
enumerable: true,
|
|
160
|
+
get: function () { return chunk3KPNTQBV_cjs.isVendorAdmin; }
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "isVendorGroupName", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function () { return chunk3KPNTQBV_cjs.isVendorGroupName; }
|
|
165
|
+
});
|
|
166
|
+
Object.defineProperty(exports, "isVendorOwner", {
|
|
167
|
+
enumerable: true,
|
|
168
|
+
get: function () { return chunk3KPNTQBV_cjs.isVendorOwner; }
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(exports, "isVendorPortalUser", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
get: function () { return chunk3KPNTQBV_cjs.isVendorPortalUser; }
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "isVendorStaff", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function () { return chunk3KPNTQBV_cjs.isVendorStaff; }
|
|
177
|
+
});
|
|
178
|
+
Object.defineProperty(exports, "logEntityAccessDecision", {
|
|
179
|
+
enumerable: true,
|
|
180
|
+
get: function () { return chunk3KPNTQBV_cjs.logEntityAccessDecision; }
|
|
181
|
+
});
|
|
182
|
+
Object.defineProperty(exports, "logRbac", {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
get: function () { return chunk3KPNTQBV_cjs.logRbac; }
|
|
185
|
+
});
|
|
186
|
+
Object.defineProperty(exports, "permissionRowsToRecord", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () { return chunk3KPNTQBV_cjs.permissionRowsToRecord; }
|
|
189
|
+
});
|
|
190
|
+
Object.defineProperty(exports, "resolveVendorScopeFromSessionUser", {
|
|
191
|
+
enumerable: true,
|
|
192
|
+
get: function () { return chunk3KPNTQBV_cjs.resolveVendorScopeFromSessionUser; }
|
|
193
|
+
});
|
|
194
|
+
Object.defineProperty(exports, "summarizeEntityPerms", {
|
|
195
|
+
enumerable: true,
|
|
196
|
+
get: function () { return chunk3KPNTQBV_cjs.summarizeEntityPerms; }
|
|
197
|
+
});
|
|
198
|
+
Object.defineProperty(exports, "vendorPortalFlagsFromUser", {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
get: function () { return chunk3KPNTQBV_cjs.vendorPortalFlagsFromUser; }
|
|
364
201
|
});
|
|
365
|
-
|
|
366
|
-
// src/auth/index.ts
|
|
367
|
-
var auth_exports = {};
|
|
368
|
-
__export(auth_exports, {
|
|
369
|
-
ADMIN_GROUP_NAME: () => ADMIN_GROUP_NAME,
|
|
370
|
-
OPEN_ENDPOINTS: () => OPEN_ENDPOINTS,
|
|
371
|
-
PERMISSION_REQUIRED_ENDPOINTS: () => PERMISSION_REQUIRED_ENDPOINTS,
|
|
372
|
-
RBAC_ADMIN_ONLY_ENTITIES: () => RBAC_ADMIN_ONLY_ENTITIES,
|
|
373
|
-
VENDOR_OWNER_GROUP_NAME: () => VENDOR_OWNER_GROUP_NAME,
|
|
374
|
-
VENDOR_SCOPED_STORE_ENTITIES: () => VENDOR_SCOPED_STORE_ENTITIES,
|
|
375
|
-
VENDOR_STORE_RBAC_ENTITIES: () => VENDOR_STORE_RBAC_ENTITIES,
|
|
376
|
-
canManageRoles: () => canManageRoles,
|
|
377
|
-
canManageVendorRoles: () => canManageVendorRoles,
|
|
378
|
-
canManageVendorTeam: () => canManageVendorTeam,
|
|
379
|
-
canOnboardVendors: () => canOnboardVendors,
|
|
380
|
-
createAuthHelpers: () => createAuthHelpers,
|
|
381
|
-
createCmsAuthBundle: () => createCmsAuthBundle,
|
|
382
|
-
createCmsMiddleware: () => createCmsMiddleware,
|
|
383
|
-
defaultPublicApiMethods: () => defaultPublicApiMethods,
|
|
384
|
-
explainSessionEntityAccess: () => explainSessionEntityAccess,
|
|
385
|
-
getNextAuthOptions: () => getNextAuthOptions,
|
|
386
|
-
getPermissionableEntityKeys: () => getPermissionableEntityKeys,
|
|
387
|
-
getRequiredPermission: () => getRequiredPermission,
|
|
388
|
-
hasEntityPermission: () => hasEntityPermission,
|
|
389
|
-
isAuthDebugClientEnabled: () => isAuthDebugClientEnabled,
|
|
390
|
-
isAuthDebugEnabled: () => isAuthDebugEnabled,
|
|
391
|
-
isOpenEndpoint: () => isOpenEndpoint,
|
|
392
|
-
isPlatformAdministrator: () => isPlatformAdministrator,
|
|
393
|
-
isPublicMethod: () => isPublicMethod,
|
|
394
|
-
isRbacDebugEnabled: () => isRbacDebugEnabled,
|
|
395
|
-
isSuperAdminGroupName: () => isSuperAdminGroupName,
|
|
396
|
-
isVendorGroupName: () => isVendorGroupName,
|
|
397
|
-
isVendorOwner: () => isVendorOwner,
|
|
398
|
-
isVendorPortalUser: () => isVendorPortalUser,
|
|
399
|
-
isVendorStaff: () => isVendorStaff,
|
|
400
|
-
logAuth: () => logAuth,
|
|
401
|
-
logAuthClient: () => logAuthClient,
|
|
402
|
-
logEntityAccessDecision: () => logEntityAccessDecision,
|
|
403
|
-
logRbac: () => logRbac,
|
|
404
|
-
nextAuthCookieDebugInfo: () => nextAuthCookieDebugInfo,
|
|
405
|
-
permissionRowsToRecord: () => permissionRowsToRecord,
|
|
406
|
-
resolveVendorScopeFromSessionUser: () => resolveVendorScopeFromSessionUser,
|
|
407
|
-
seedAdministratorPermissions: () => seedAdministratorPermissions,
|
|
408
|
-
sessionHasEntityAccess: () => sessionHasEntityAccess,
|
|
409
|
-
summarizeEntityPerms: () => summarizeEntityPerms,
|
|
410
|
-
summarizeSessionUserForLog: () => summarizeSessionUserForLog,
|
|
411
|
-
vendorPortalFlagsFromUser: () => vendorPortalFlagsFromUser
|
|
412
|
-
});
|
|
413
|
-
module.exports = __toCommonJS(auth_exports);
|
|
414
|
-
|
|
415
|
-
// src/auth/helpers.ts
|
|
416
|
-
init_rbac_debug();
|
|
417
|
-
init_vendor_scope();
|
|
418
|
-
var RBAC_ADMIN_ONLY_ENTITIES = /* @__PURE__ */ new Set(["users", "user_groups", "permissions"]);
|
|
419
|
-
function sessionHasEntityAccess(user, entity, action) {
|
|
420
|
-
return explainSessionEntityAccess(user, entity, action).allowed;
|
|
421
|
-
}
|
|
422
|
-
function canManageRoles(user) {
|
|
423
|
-
return !!(user?.email && user.isRBACAdmin);
|
|
424
|
-
}
|
|
425
|
-
var OPEN_ENDPOINTS = [
|
|
426
|
-
{ "/api/contacts": ["POST"] },
|
|
427
|
-
{ "/api/form-submissions": ["POST"] },
|
|
428
|
-
{ "/api/blogs": ["GET"] }
|
|
429
|
-
];
|
|
430
|
-
var PERMISSION_REQUIRED_ENDPOINTS = {};
|
|
431
|
-
function isOpenEndpoint(pathname) {
|
|
432
|
-
return OPEN_ENDPOINTS.some((endpoint) => pathname.startsWith(Object.keys(endpoint)[0]));
|
|
433
|
-
}
|
|
434
|
-
function getRequiredPermission(pathname) {
|
|
435
|
-
return null;
|
|
436
|
-
}
|
|
437
|
-
function isPublicMethod(pathname, method) {
|
|
438
|
-
for (const endpoint of OPEN_ENDPOINTS) {
|
|
439
|
-
const key = Object.keys(endpoint)[0];
|
|
440
|
-
if (pathname.startsWith(key) && endpoint[key].includes(method)) return true;
|
|
441
|
-
}
|
|
442
|
-
return false;
|
|
443
|
-
}
|
|
444
|
-
function createAuthHelpers(getSession, NextResponse) {
|
|
445
|
-
return createAuthHelpersFromGetSession(getSession, NextResponse);
|
|
446
|
-
}
|
|
447
|
-
function createCmsAuthBundle(getSession, NextResponse) {
|
|
448
|
-
const auth = createAuthHelpers(getSession, NextResponse);
|
|
449
|
-
return {
|
|
450
|
-
requireAuth: auth.requireAuth,
|
|
451
|
-
requireAdminAccess: auth.requireAdminAccess,
|
|
452
|
-
requireEntityPermission: auth.requireEntityPermission,
|
|
453
|
-
getSessionUser: auth.getAuthenticatedUser,
|
|
454
|
-
getAuthenticatedUser: auth.getAuthenticatedUser
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
function createAuthHelpersFromGetSession(getSession, NextResponse) {
|
|
458
|
-
return {
|
|
459
|
-
async requireAuth() {
|
|
460
|
-
const session = await getSession();
|
|
461
|
-
if (!session?.user?.email) {
|
|
462
|
-
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
463
|
-
}
|
|
464
|
-
return null;
|
|
465
|
-
},
|
|
466
|
-
async requirePermission() {
|
|
467
|
-
const session = await getSession();
|
|
468
|
-
if (!session?.user?.email) {
|
|
469
|
-
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
470
|
-
}
|
|
471
|
-
return null;
|
|
472
|
-
},
|
|
473
|
-
async requireEntityPermission(_req, entity, action) {
|
|
474
|
-
const session = await getSession();
|
|
475
|
-
if (!session?.user?.email) {
|
|
476
|
-
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
477
|
-
}
|
|
478
|
-
const u = session.user;
|
|
479
|
-
const allowed = sessionHasEntityAccess(u, entity, action);
|
|
480
|
-
const { reason } = explainSessionEntityAccess(u, entity, action);
|
|
481
|
-
logRbac("authHelpers.requireEntityPermission", {
|
|
482
|
-
entity,
|
|
483
|
-
action,
|
|
484
|
-
allowed,
|
|
485
|
-
reason,
|
|
486
|
-
email: u.email,
|
|
487
|
-
groupName: u.groupName,
|
|
488
|
-
vendorIds: u.vendorIds,
|
|
489
|
-
isVendorPortal: u.isVendorPortal,
|
|
490
|
-
isVendorOwner: u.isVendorOwner
|
|
491
|
-
});
|
|
492
|
-
if (allowed) return null;
|
|
493
|
-
return NextResponse.json({ error: "Forbidden", entity, action, reason }, { status: 403 });
|
|
494
|
-
},
|
|
495
|
-
async requireAdminAccess() {
|
|
496
|
-
const session = await getSession();
|
|
497
|
-
if (!session?.user?.email) {
|
|
498
|
-
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
|
|
499
|
-
}
|
|
500
|
-
const u = session.user;
|
|
501
|
-
if (u.isRBACAdmin) return null;
|
|
502
|
-
if (isVendorPortalUser(u)) return null;
|
|
503
|
-
if (u.adminAccess === true) return null;
|
|
504
|
-
if (u.adminAccess === false) {
|
|
505
|
-
logRbac("requireAdminAccess denied (adminAccess:false)", {
|
|
506
|
-
email: u.email,
|
|
507
|
-
groupName: u.groupName,
|
|
508
|
-
isVendorPortal: u.isVendorPortal
|
|
509
|
-
});
|
|
510
|
-
return NextResponse.json({ error: "Forbidden", reason: "admin_access" }, { status: 403 });
|
|
511
|
-
}
|
|
512
|
-
logRbac("requireAdminAccess denied (no matching rule)", {
|
|
513
|
-
email: u.email,
|
|
514
|
-
adminAccess: u.adminAccess,
|
|
515
|
-
groupName: u.groupName,
|
|
516
|
-
isVendorPortal: u.isVendorPortal
|
|
517
|
-
});
|
|
518
|
-
return NextResponse.json({ error: "Forbidden", reason: "admin_access" }, { status: 403 });
|
|
519
|
-
},
|
|
520
|
-
async getAuthenticatedUser() {
|
|
521
|
-
const session = await getSession();
|
|
522
|
-
return session?.user ?? null;
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
// src/auth/index.ts
|
|
528
|
-
init_rbac_debug();
|
|
529
|
-
init_vendor_scope();
|
|
530
|
-
init_permission_entities();
|
|
531
|
-
|
|
532
|
-
// src/auth/seed-permissions.ts
|
|
533
|
-
init_permission_entities();
|
|
534
|
-
async function seedAdministratorPermissions(dataSource, entityMap) {
|
|
535
|
-
const entities = getPermissionableEntityKeys(entityMap);
|
|
536
|
-
const groupRepo = dataSource.getRepository(entityMap.user_groups);
|
|
537
|
-
const permRepo = dataSource.getRepository(entityMap.permissions);
|
|
538
|
-
const adminGroup = await groupRepo.findOne({ where: { name: ADMIN_GROUP_NAME, deleted: false } });
|
|
539
|
-
console.log("ADMIN GROUP", adminGroup);
|
|
540
|
-
if (!adminGroup) return;
|
|
541
|
-
const fullCrud = { canCreate: true, canRead: true, canUpdate: true, canDelete: true };
|
|
542
|
-
for (const entity of entities) {
|
|
543
|
-
const existing = await permRepo.findOne({
|
|
544
|
-
where: { groupId: adminGroup.id, entity }
|
|
545
|
-
});
|
|
546
|
-
console.log("EXISTING", existing);
|
|
547
|
-
if (existing) {
|
|
548
|
-
existing.canCreate = true;
|
|
549
|
-
existing.canRead = true;
|
|
550
|
-
existing.canUpdate = true;
|
|
551
|
-
existing.canDelete = true;
|
|
552
|
-
await permRepo.save(existing);
|
|
553
|
-
} else {
|
|
554
|
-
await permRepo.save(
|
|
555
|
-
permRepo.create({
|
|
556
|
-
groupId: adminGroup.id,
|
|
557
|
-
entity,
|
|
558
|
-
...fullCrud
|
|
559
|
-
})
|
|
560
|
-
);
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
// src/auth/middleware.ts
|
|
566
|
-
var import_jwt = require("next-auth/jwt");
|
|
567
|
-
|
|
568
|
-
// src/auth/auth-debug.ts
|
|
569
|
-
var LOG_PREFIX2 = "[cms-auth]";
|
|
570
|
-
function isAuthDebugEnabled() {
|
|
571
|
-
const v = process.env.CMS_AUTH_DEBUG?.trim().toLowerCase();
|
|
572
|
-
if (v === "1" || v === "true" || v === "yes") return true;
|
|
573
|
-
if (v === "0" || v === "false" || v === "no") return false;
|
|
574
|
-
return process.env.NODE_ENV === "development";
|
|
575
|
-
}
|
|
576
|
-
function isAuthDebugClientEnabled() {
|
|
577
|
-
if (typeof window === "undefined") return false;
|
|
578
|
-
const v = process.env.NEXT_PUBLIC_CMS_AUTH_DEBUG?.trim().toLowerCase();
|
|
579
|
-
if (v === "1" || v === "true" || v === "yes") return true;
|
|
580
|
-
if (v === "0" || v === "false" || v === "no") return false;
|
|
581
|
-
return process.env.NODE_ENV === "development";
|
|
582
|
-
}
|
|
583
|
-
function logAuth(message, data) {
|
|
584
|
-
if (!isAuthDebugEnabled()) return;
|
|
585
|
-
if (data) console.info(LOG_PREFIX2, message, data);
|
|
586
|
-
else console.info(LOG_PREFIX2, message);
|
|
587
|
-
}
|
|
588
|
-
function logAuthClient(message, data) {
|
|
589
|
-
if (!isAuthDebugClientEnabled()) return;
|
|
590
|
-
if (data) console.info(LOG_PREFIX2, message, data);
|
|
591
|
-
else console.info(LOG_PREFIX2, message);
|
|
592
|
-
}
|
|
593
|
-
function summarizeSessionUserForLog(user) {
|
|
594
|
-
if (!user || typeof user !== "object") return { present: false };
|
|
595
|
-
const u = user;
|
|
596
|
-
return {
|
|
597
|
-
present: true,
|
|
598
|
-
email: u.email ?? null,
|
|
599
|
-
id: u.id ?? null,
|
|
600
|
-
adminAccess: u.adminAccess ?? null,
|
|
601
|
-
isRBACAdmin: u.isRBACAdmin ?? null,
|
|
602
|
-
isVendorPortal: u.isVendorPortal ?? null,
|
|
603
|
-
groupName: u.groupName ?? null
|
|
604
|
-
};
|
|
605
|
-
}
|
|
606
|
-
function nextAuthCookieDebugInfo() {
|
|
607
|
-
const nextAuthUrl = process.env.NEXTAUTH_URL ?? "(unset)";
|
|
608
|
-
const isHttps = nextAuthUrl.startsWith("https");
|
|
609
|
-
return {
|
|
610
|
-
nextAuthUrl,
|
|
611
|
-
hasSecret: Boolean(process.env.NEXTAUTH_SECRET),
|
|
612
|
-
cookieName: isHttps ? "__Secure-next-auth.session-token" : "next-auth.session-token",
|
|
613
|
-
cookieSecure: isHttps,
|
|
614
|
-
nodeEnv: process.env.NODE_ENV ?? "(unset)"
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
// src/auth/middleware.ts
|
|
619
|
-
var defaultPublicApiMethods = {
|
|
620
|
-
"/api/contacts": ["POST"],
|
|
621
|
-
"/api/form-submissions": ["POST"],
|
|
622
|
-
"/api/blogs": ["GET"],
|
|
623
|
-
"/api/forms": ["GET"],
|
|
624
|
-
"/api/auth": ["GET", "POST"],
|
|
625
|
-
"/api/health": ["GET"],
|
|
626
|
-
"/api/users/forgot-password": ["POST"],
|
|
627
|
-
"/api/users/set-password": ["POST"],
|
|
628
|
-
"/api/users/invite": ["POST"]
|
|
629
|
-
};
|
|
630
|
-
function legacyGetSessionToken(request) {
|
|
631
|
-
const secure = request.cookies.get("__Secure-next-auth.session-token")?.value;
|
|
632
|
-
const regular = request.cookies.get("next-auth.session-token")?.value;
|
|
633
|
-
return secure ?? regular;
|
|
634
|
-
}
|
|
635
|
-
function sessionCookiePresence(request) {
|
|
636
|
-
const secure = request.cookies.get("__Secure-next-auth.session-token")?.value;
|
|
637
|
-
const regular = request.cookies.get("next-auth.session-token")?.value;
|
|
638
|
-
const hasChunked = Boolean(request.cookies.get("next-auth.session-token.0")?.value) || Boolean(request.cookies.get("__Secure-next-auth.session-token.0")?.value);
|
|
639
|
-
return {
|
|
640
|
-
hasSecureToken: Boolean(secure),
|
|
641
|
-
hasRegularToken: Boolean(regular),
|
|
642
|
-
hasChunkedToken: hasChunked,
|
|
643
|
-
resolved: Boolean(secure ?? regular)
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
function isPublicMethod2(pathname, method, publicApiMethods) {
|
|
647
|
-
for (const [endpoint, methods] of Object.entries(publicApiMethods)) {
|
|
648
|
-
if (pathname.startsWith(endpoint) && methods.includes(method)) return true;
|
|
649
|
-
}
|
|
650
|
-
return false;
|
|
651
|
-
}
|
|
652
|
-
async function hasValidSession(request, secret, legacyGetToken) {
|
|
653
|
-
if (request.req) {
|
|
654
|
-
const token = await (0, import_jwt.getToken)({ req: request.req, secret });
|
|
655
|
-
return token != null;
|
|
656
|
-
}
|
|
657
|
-
return Boolean(legacyGetToken(request));
|
|
658
|
-
}
|
|
659
|
-
function createCmsMiddleware(config = {}) {
|
|
660
|
-
const {
|
|
661
|
-
publicAdminPaths = ["/admin/signin", "/admin/forgot-password", "/admin/reset-password", "/admin/invite"],
|
|
662
|
-
publicApiMethods = defaultPublicApiMethods,
|
|
663
|
-
signInPath = "/admin/signin",
|
|
664
|
-
getSessionToken = legacyGetSessionToken,
|
|
665
|
-
secret = process.env.NEXTAUTH_SECRET
|
|
666
|
-
} = config;
|
|
667
|
-
return async function cmsMiddleware(request) {
|
|
668
|
-
const pathname = request.nextUrl.pathname;
|
|
669
|
-
const method = request.method;
|
|
670
|
-
if (publicAdminPaths.some((p) => pathname === p || pathname.startsWith(p + "/"))) {
|
|
671
|
-
return { type: "next" };
|
|
672
|
-
}
|
|
673
|
-
if (pathname.startsWith("/admin")) {
|
|
674
|
-
const authenticated = await hasValidSession(request, secret, getSessionToken);
|
|
675
|
-
const cookies = sessionCookiePresence(request);
|
|
676
|
-
if (!authenticated) {
|
|
677
|
-
logAuth("middleware: admin redirect to signin (no session)", {
|
|
678
|
-
pathname,
|
|
679
|
-
method,
|
|
680
|
-
usesGetToken: Boolean(request.req),
|
|
681
|
-
...cookies,
|
|
682
|
-
expectedCookieName: process.env.NEXTAUTH_URL?.startsWith("https") ? "__Secure-next-auth.session-token" : "next-auth.session-token"
|
|
683
|
-
});
|
|
684
|
-
return { type: "redirect", url: new URL(signInPath, request.url).toString() };
|
|
685
|
-
}
|
|
686
|
-
logAuth("middleware: admin allowed", {
|
|
687
|
-
pathname,
|
|
688
|
-
method,
|
|
689
|
-
usesGetToken: Boolean(request.req),
|
|
690
|
-
...cookies
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
if (pathname.startsWith("/api")) {
|
|
694
|
-
if (isPublicMethod2(pathname, method, publicApiMethods)) {
|
|
695
|
-
return { type: "next" };
|
|
696
|
-
}
|
|
697
|
-
const authenticated = await hasValidSession(request, secret, getSessionToken);
|
|
698
|
-
if (!authenticated) {
|
|
699
|
-
logAuth("middleware: api 401 (no session)", {
|
|
700
|
-
pathname,
|
|
701
|
-
method,
|
|
702
|
-
usesGetToken: Boolean(request.req),
|
|
703
|
-
...sessionCookiePresence(request)
|
|
704
|
-
});
|
|
705
|
-
return { type: "json", status: 401, body: { error: "Unauthorized" } };
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
return { type: "next" };
|
|
709
|
-
};
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
// src/auth/nextauth-options.ts
|
|
713
|
-
var import_credentials = __toESM(require("next-auth/providers/credentials"), 1);
|
|
714
|
-
init_permission_entities();
|
|
715
|
-
init_vendor_scope();
|
|
716
|
-
var CredentialsProvider = import_credentials.default.default ?? import_credentials.default;
|
|
717
|
-
function sessionUserFromNextAuthUser(user) {
|
|
718
|
-
const g = user.group;
|
|
719
|
-
const isRBACAdmin = isSuperAdminGroupName(g?.name);
|
|
720
|
-
const entityPerms = permissionRowsToRecord(g?.permissions);
|
|
721
|
-
const rawAdminAccess = user.adminAccess;
|
|
722
|
-
const adminAccess = rawAdminAccess === true ? true : rawAdminAccess === false ? false : void 0;
|
|
723
|
-
const vendorIds = user.vendorIds ?? [];
|
|
724
|
-
const vendorRole = user.vendorRole ?? null;
|
|
725
|
-
const { isVendorPortal, isVendorOwner: isVendorOwner2 } = vendorPortalFlagsFromUser({
|
|
726
|
-
email: user.email,
|
|
727
|
-
isRBACAdmin,
|
|
728
|
-
groupName: g?.name,
|
|
729
|
-
vendorIds,
|
|
730
|
-
vendorRole
|
|
731
|
-
});
|
|
732
|
-
return {
|
|
733
|
-
id: user.id.toString(),
|
|
734
|
-
email: user.email,
|
|
735
|
-
name: user.name,
|
|
736
|
-
groupId: user.groupId ?? void 0,
|
|
737
|
-
groupName: g?.name ?? void 0,
|
|
738
|
-
isRBACAdmin,
|
|
739
|
-
entityPerms,
|
|
740
|
-
adminAccess,
|
|
741
|
-
vendorIds,
|
|
742
|
-
activeVendorId: user.activeVendorId ?? vendorIds[0] ?? null,
|
|
743
|
-
vendorRole,
|
|
744
|
-
isVendorPortal,
|
|
745
|
-
isVendorOwner: isVendorOwner2
|
|
746
|
-
};
|
|
747
|
-
}
|
|
748
|
-
function getNextAuthOptions(config) {
|
|
749
|
-
const {
|
|
750
|
-
getUserByEmail,
|
|
751
|
-
comparePassword,
|
|
752
|
-
signInPage = "/admin/signin",
|
|
753
|
-
secret,
|
|
754
|
-
extend,
|
|
755
|
-
enablePasswordLogin = true,
|
|
756
|
-
enableOtpLogin = false,
|
|
757
|
-
authorizeOtp
|
|
758
|
-
} = config;
|
|
759
|
-
logAuth("getNextAuthOptions init", nextAuthCookieDebugInfo());
|
|
760
|
-
const providers = [];
|
|
761
|
-
if (enablePasswordLogin) {
|
|
762
|
-
providers.push(
|
|
763
|
-
CredentialsProvider({
|
|
764
|
-
name: "credentials",
|
|
765
|
-
credentials: {
|
|
766
|
-
email: { label: "Email", type: "email" },
|
|
767
|
-
password: { label: "Password", type: "password" }
|
|
768
|
-
},
|
|
769
|
-
async authorize(credentials) {
|
|
770
|
-
const email = credentials?.email?.trim() ?? "";
|
|
771
|
-
if (!email || !credentials?.password) {
|
|
772
|
-
logAuth("authorize(credentials) rejected", { reason: "missing_email_or_password" });
|
|
773
|
-
return null;
|
|
774
|
-
}
|
|
775
|
-
try {
|
|
776
|
-
const user = await getUserByEmail(email);
|
|
777
|
-
if (!user) {
|
|
778
|
-
logAuth("authorize(credentials) rejected", { reason: "user_not_found", email });
|
|
779
|
-
return null;
|
|
780
|
-
}
|
|
781
|
-
if (user.blocked) {
|
|
782
|
-
logAuth("authorize(credentials) rejected", { reason: "blocked", email, userId: user.id });
|
|
783
|
-
return null;
|
|
784
|
-
}
|
|
785
|
-
if (user.deleted) {
|
|
786
|
-
logAuth("authorize(credentials) rejected", { reason: "deleted", email, userId: user.id });
|
|
787
|
-
return null;
|
|
788
|
-
}
|
|
789
|
-
if (!user.password) {
|
|
790
|
-
logAuth("authorize(credentials) rejected", { reason: "no_password", email, userId: user.id });
|
|
791
|
-
return null;
|
|
792
|
-
}
|
|
793
|
-
const valid = await comparePassword(credentials.password, user.password);
|
|
794
|
-
if (!valid) {
|
|
795
|
-
logAuth("authorize(credentials) rejected", { reason: "invalid_password", email, userId: user.id });
|
|
796
|
-
return null;
|
|
797
|
-
}
|
|
798
|
-
const sessionUser = sessionUserFromNextAuthUser(user);
|
|
799
|
-
logAuth("authorize(credentials) ok", summarizeSessionUserForLog(sessionUser));
|
|
800
|
-
return sessionUser;
|
|
801
|
-
} catch (err) {
|
|
802
|
-
console.error("[cms-auth] authorize error (credentials):", err instanceof Error ? err.message : err);
|
|
803
|
-
logAuth("authorize(credentials) error", {
|
|
804
|
-
email,
|
|
805
|
-
message: err instanceof Error ? err.message : String(err)
|
|
806
|
-
});
|
|
807
|
-
return null;
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
})
|
|
811
|
-
);
|
|
812
|
-
}
|
|
813
|
-
if (enableOtpLogin && authorizeOtp) {
|
|
814
|
-
providers.push(
|
|
815
|
-
CredentialsProvider({
|
|
816
|
-
id: "otp",
|
|
817
|
-
name: "otp",
|
|
818
|
-
credentials: {
|
|
819
|
-
identifier: { label: "Email or phone", type: "text" },
|
|
820
|
-
code: { label: "Code", type: "text" },
|
|
821
|
-
channel: { label: "Channel", type: "text" }
|
|
822
|
-
},
|
|
823
|
-
async authorize(credentials) {
|
|
824
|
-
const identifier = typeof credentials?.identifier === "string" ? credentials.identifier.trim() : "";
|
|
825
|
-
const code = typeof credentials?.code === "string" ? credentials.code.trim() : "";
|
|
826
|
-
const ch = credentials?.channel === "sms" ? "sms" : "email";
|
|
827
|
-
if (!identifier || !code) return null;
|
|
828
|
-
try {
|
|
829
|
-
const user = await authorizeOtp({ identifier, channel: ch, code });
|
|
830
|
-
if (!user || user.blocked || user.deleted) return null;
|
|
831
|
-
return sessionUserFromNextAuthUser(user);
|
|
832
|
-
} catch (err) {
|
|
833
|
-
console.error("[cms-auth] authorize error (otp):", err instanceof Error ? err.message : err);
|
|
834
|
-
return null;
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
})
|
|
838
|
-
);
|
|
839
|
-
}
|
|
840
|
-
const options = {
|
|
841
|
-
secret: secret ?? process.env.NEXTAUTH_SECRET,
|
|
842
|
-
providers,
|
|
843
|
-
session: { strategy: "jwt" },
|
|
844
|
-
pages: { signIn: signInPage },
|
|
845
|
-
cookies: {
|
|
846
|
-
sessionToken: {
|
|
847
|
-
name: process.env.NEXTAUTH_URL?.startsWith("https") ? "__Secure-next-auth.session-token" : "next-auth.session-token",
|
|
848
|
-
options: {
|
|
849
|
-
httpOnly: true,
|
|
850
|
-
sameSite: "lax",
|
|
851
|
-
path: "/",
|
|
852
|
-
secure: process.env.NEXTAUTH_URL?.startsWith("https") ?? false
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
},
|
|
856
|
-
callbacks: {
|
|
857
|
-
async jwt({ token, user, trigger, session }) {
|
|
858
|
-
if (user) {
|
|
859
|
-
logAuth("jwt callback: new sign-in", {
|
|
860
|
-
trigger,
|
|
861
|
-
user: summarizeSessionUserForLog(user)
|
|
862
|
-
});
|
|
863
|
-
const u = user;
|
|
864
|
-
token.id = u.id;
|
|
865
|
-
token.groupId = u.groupId;
|
|
866
|
-
token.groupName = u.groupName;
|
|
867
|
-
token.isRBACAdmin = u.isRBACAdmin;
|
|
868
|
-
token.entityPerms = u.entityPerms;
|
|
869
|
-
token.adminAccess = u.adminAccess;
|
|
870
|
-
token.vendorIds = u.vendorIds;
|
|
871
|
-
token.activeVendorId = u.activeVendorId;
|
|
872
|
-
token.vendorRole = u.vendorRole;
|
|
873
|
-
token.isVendorPortal = u.isVendorPortal;
|
|
874
|
-
token.isVendorOwner = u.isVendorOwner;
|
|
875
|
-
}
|
|
876
|
-
if (trigger === "update" && session && typeof session === "object") {
|
|
877
|
-
logAuth("jwt callback: session update", { trigger });
|
|
878
|
-
const s = session;
|
|
879
|
-
const t = token;
|
|
880
|
-
if (typeof s.name === "string") t.name = s.name;
|
|
881
|
-
if (typeof s.email === "string") t.email = s.email;
|
|
882
|
-
if (typeof s.activeVendorId === "number") t.activeVendorId = s.activeVendorId;
|
|
883
|
-
}
|
|
884
|
-
return token;
|
|
885
|
-
},
|
|
886
|
-
async session({ session, token }) {
|
|
887
|
-
const t = token;
|
|
888
|
-
logAuth("session callback", {
|
|
889
|
-
tokenHasId: t.id != null,
|
|
890
|
-
tokenEmail: typeof t.email === "string" ? t.email : null,
|
|
891
|
-
sessionUser: summarizeSessionUserForLog(session.user)
|
|
892
|
-
});
|
|
893
|
-
if (session.user) {
|
|
894
|
-
if (typeof t.name === "string") session.user.name = t.name;
|
|
895
|
-
if (typeof t.email === "string") session.user.email = t.email;
|
|
896
|
-
session.user.id = t.id;
|
|
897
|
-
session.user.groupId = t.groupId;
|
|
898
|
-
session.user.groupName = t.groupName;
|
|
899
|
-
session.user.isRBACAdmin = t.isRBACAdmin;
|
|
900
|
-
session.user.entityPerms = t.entityPerms;
|
|
901
|
-
session.user.adminAccess = t.adminAccess;
|
|
902
|
-
session.user.vendorIds = t.vendorIds;
|
|
903
|
-
session.user.activeVendorId = t.activeVendorId;
|
|
904
|
-
session.user.vendorRole = t.vendorRole;
|
|
905
|
-
session.user.isVendorPortal = t.isVendorPortal;
|
|
906
|
-
session.user.isVendorOwner = t.isVendorOwner;
|
|
907
|
-
}
|
|
908
|
-
return session;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
};
|
|
912
|
-
return extend ? extend(options) : options;
|
|
913
|
-
}
|
|
914
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
915
|
-
0 && (module.exports = {
|
|
916
|
-
ADMIN_GROUP_NAME,
|
|
917
|
-
OPEN_ENDPOINTS,
|
|
918
|
-
PERMISSION_REQUIRED_ENDPOINTS,
|
|
919
|
-
RBAC_ADMIN_ONLY_ENTITIES,
|
|
920
|
-
VENDOR_OWNER_GROUP_NAME,
|
|
921
|
-
VENDOR_SCOPED_STORE_ENTITIES,
|
|
922
|
-
VENDOR_STORE_RBAC_ENTITIES,
|
|
923
|
-
canManageRoles,
|
|
924
|
-
canManageVendorRoles,
|
|
925
|
-
canManageVendorTeam,
|
|
926
|
-
canOnboardVendors,
|
|
927
|
-
createAuthHelpers,
|
|
928
|
-
createCmsAuthBundle,
|
|
929
|
-
createCmsMiddleware,
|
|
930
|
-
defaultPublicApiMethods,
|
|
931
|
-
explainSessionEntityAccess,
|
|
932
|
-
getNextAuthOptions,
|
|
933
|
-
getPermissionableEntityKeys,
|
|
934
|
-
getRequiredPermission,
|
|
935
|
-
hasEntityPermission,
|
|
936
|
-
isAuthDebugClientEnabled,
|
|
937
|
-
isAuthDebugEnabled,
|
|
938
|
-
isOpenEndpoint,
|
|
939
|
-
isPlatformAdministrator,
|
|
940
|
-
isPublicMethod,
|
|
941
|
-
isRbacDebugEnabled,
|
|
942
|
-
isSuperAdminGroupName,
|
|
943
|
-
isVendorGroupName,
|
|
944
|
-
isVendorOwner,
|
|
945
|
-
isVendorPortalUser,
|
|
946
|
-
isVendorStaff,
|
|
947
|
-
logAuth,
|
|
948
|
-
logAuthClient,
|
|
949
|
-
logEntityAccessDecision,
|
|
950
|
-
logRbac,
|
|
951
|
-
nextAuthCookieDebugInfo,
|
|
952
|
-
permissionRowsToRecord,
|
|
953
|
-
resolveVendorScopeFromSessionUser,
|
|
954
|
-
seedAdministratorPermissions,
|
|
955
|
-
sessionHasEntityAccess,
|
|
956
|
-
summarizeEntityPerms,
|
|
957
|
-
summarizeSessionUserForLog,
|
|
958
|
-
vendorPortalFlagsFromUser
|
|
959
|
-
});
|
|
960
|
-
//# sourceMappingURL=auth.cjs.map
|