@ozdao/martyrs 0.2.473 → 0.2.474
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/{Media-DW8RLbfM.js → Media-_vz04tII.js} +1 -1
- package/dist/{Media-y_TX6us_.mjs → Media-sGk7Bp9b.mjs} +1 -1
- package/dist/auth.server.js +6 -2
- package/dist/auth.server.mjs +6 -2
- package/dist/authJwt-CELQKF2s.js +82 -0
- package/dist/authJwt-DnXu3BFq.mjs +83 -0
- package/dist/builder.js +7 -4
- package/dist/builder.mjs +7 -4
- package/dist/chats.server.js +1 -1
- package/dist/chats.server.mjs +1 -1
- package/dist/community.server.js +4 -4
- package/dist/community.server.mjs +4 -4
- package/dist/events.server.js +4 -4
- package/dist/events.server.mjs +4 -4
- package/dist/files.server.js +1 -1
- package/dist/files.server.mjs +1 -1
- package/dist/gallery.server.js +3 -3
- package/dist/gallery.server.mjs +3 -3
- package/dist/{globals.abac-DT0VjfaZ.js → globals.abac-Bn-4tbX8.js} +110 -16
- package/dist/{globals.abac-CvmZM8XG.mjs → globals.abac-DZpTRxKR.mjs} +110 -16
- package/dist/globals.server.js +70 -10
- package/dist/globals.server.mjs +70 -10
- package/dist/{globals.verifier-C_VZYebB.mjs → globals.verifier-BdJxc8-8.mjs} +34 -0
- package/dist/{globals.verifier-ChDpCdy_.js → globals.verifier-CKYpYfQl.js} +34 -0
- package/dist/{index-CVXl1rB5.js → index-BOmxJQ5W.js} +7 -86
- package/dist/{index-Df8vtZx7.mjs → index-C_Fw0Umg.mjs} +7 -86
- package/dist/{main-CgmHzhq5.mjs → main-CqMtW7Hq.mjs} +274 -276
- package/dist/{main-CCfQH-Dd.js → main-CsGkbSyK.js} +2 -2
- package/dist/martyrs/src/components/Select/Select.vue.cjs +4 -4
- package/dist/martyrs/src/components/Select/Select.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Select/Select.vue.js +4 -4
- package/dist/martyrs/src/components/Select/Select.vue.js.map +1 -1
- package/dist/martyrs/src/modules/community/community.client.js +27 -27
- package/dist/martyrs/src/modules/community/community.client.js.map +1 -1
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs +2 -3
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js +2 -3
- package/dist/martyrs/src/modules/community/components/sections/HotPosts.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs +88 -27
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js +89 -28
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreate.vue.js.map +1 -1
- package/dist/martyrs/src/modules/orders/store/shopcart.cjs +1 -0
- package/dist/martyrs/src/modules/orders/store/shopcart.cjs.map +1 -1
- package/dist/martyrs/src/modules/orders/store/shopcart.js +1 -0
- package/dist/martyrs/src/modules/orders/store/shopcart.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +19 -0
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +19 -0
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +1 -0
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +1 -0
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/store/categories.cjs +2 -0
- package/dist/martyrs/src/modules/products/store/categories.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/store/categories.js +2 -0
- package/dist/martyrs/src/modules/products/store/categories.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +30 -24
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +30 -24
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs +807 -0
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.cjs.map +1 -0
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js +807 -0
- package/dist/martyrs/src/modules/spots/components/sections/WorktimeEdit.vue.js.map +1 -0
- package/dist/martyrs/src/modules/spots/store/spots.cjs +4 -1
- package/dist/martyrs/src/modules/spots/store/spots.cjs.map +1 -1
- package/dist/martyrs/src/modules/spots/store/spots.js +4 -1
- package/dist/martyrs/src/modules/spots/store/spots.js.map +1 -1
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/notifications.server.js +1 -1
- package/dist/notifications.server.mjs +1 -1
- package/dist/orders.server.js +5 -4
- package/dist/orders.server.mjs +5 -4
- package/dist/organizations.server.js +120 -47
- package/dist/organizations.server.mjs +120 -47
- package/dist/{ownership.schema-C0w02Vw1.mjs → ownership.schema-CNCotD3D.mjs} +10 -4
- package/dist/{ownership.schema-Ck2H9clB.js → ownership.schema-MxfJlPtq.js} +10 -4
- package/dist/products.server.js +415 -149
- package/dist/products.server.mjs +415 -149
- package/dist/{profile.schema-h61hhB2w.js → profile.schema-BLSuV_VC.js} +0 -4
- package/dist/{profile.schema-kP_zKXNt.mjs → profile.schema-BRuvQ7QV.mjs} +0 -4
- package/dist/{queryProcessor-CWnMIe2U.mjs → queryProcessor-CVKI651_.mjs} +62 -8
- package/dist/{queryProcessor-D6GuKfTV.js → queryProcessor-DSUqSk3I.js} +62 -8
- package/dist/rents.server.js +4 -4
- package/dist/rents.server.mjs +4 -4
- package/dist/spots.server.js +162 -8
- package/dist/spots.server.mjs +162 -8
- package/dist/style.css +27 -4
- package/dist/wallet.server.js +2 -2
- package/dist/wallet.server.mjs +2 -2
- package/package.json +1 -1
- package/src/builder/rspack/rspack.config.base.js +1 -1
- package/src/builder/rspack/rspack.config.client.js +13 -5
- package/src/components/Select/Select.vue +4 -2
- package/src/modules/auth/models/user.model.js +4 -1
- package/src/modules/community/components/sections/HotPosts.vue +1 -1
- package/src/modules/globals/controllers/classes/globals.abac.js +148 -23
- package/src/modules/globals/controllers/classes/globals.validator.js +37 -0
- package/src/modules/globals/controllers/classes/globals.verifier.js +2 -0
- package/src/modules/globals/controllers/policies/globals.policies.js +91 -74
- package/src/modules/globals/controllers/utils/queryProcessor.js +59 -11
- package/src/modules/globals/models/schemas/ownership.schema.js +11 -6
- package/src/modules/globals/models/schemas/profile.schema.js +0 -4
- package/src/modules/music/components/layouts/MusicLayout.vue +10 -58
- package/src/modules/music/components/pages/MusicHome.vue +5 -5
- package/src/modules/orders/components/pages/OrderCreate.vue +85 -12
- package/src/modules/orders/controllers/orders.controller.js +3 -0
- package/src/modules/orders/store/shopcart.js +1 -0
- package/src/modules/organizations/models/schemas/accesses.schema.js +18 -0
- package/src/modules/organizations/policies/organizations.policies.js +117 -61
- package/src/modules/products/components/pages/CategoryEdit.vue +27 -2
- package/src/modules/products/components/pages/Product.vue +1 -0
- package/src/modules/products/components/pages/ProductEdit.vue +2 -2
- package/src/modules/products/controllers/categories.controller.js +297 -133
- package/src/modules/products/middlewares/categories.verifier.js +177 -0
- package/src/modules/products/models/category.model.js +12 -14
- package/src/modules/products/routes/categories.routes.js +50 -11
- package/src/modules/products/store/categories.js +2 -0
- package/src/modules/spots/components/pages/SpotEdit.vue +21 -17
- package/src/modules/spots/components/sections/WorktimeEdit.vue +840 -0
- package/src/modules/spots/controllers/queries/getIsOpenNowStage.js +109 -0
- package/src/modules/spots/controllers/spots.controller.js +2 -1
- package/src/modules/spots/models/spot.model.js +59 -13
- package/src/modules/spots/store/spots.js +4 -1
- package/src/modules/products/middlewares/index.js +0 -11
- package/src/modules/products/middlewares/verifyCategory.js +0 -25
package/dist/martyrs.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as o, t, b as d, c as r, u as l, v as i, w as p, d as u, x as n, e as m, y as M, F as S, z as c, f as F, A as g, L as h, g as b, M as k, E as x, n as B, o as C, h as T, i as U, S as f, j as w, B as D, C as E, k as I, D as L, l as P, q, p as y, U as A, r as j, s as v, m as z } from "./main-
|
|
1
|
+
import { a as o, t, b as d, c as r, u as l, v as i, w as p, d as u, x as n, e as m, y as M, F as S, z as c, f as F, A as g, L as h, g as b, M as k, E as x, n as B, o as C, h as T, i as U, S as f, j as w, B as D, C as E, k as I, D as L, l as P, q, p as y, U as A, r as j, s as v, m as z } from "./main-CqMtW7Hq.mjs";
|
|
2
2
|
import "vue";
|
|
3
3
|
export {
|
|
4
4
|
o as Address,
|
|
@@ -9,7 +9,7 @@ const mailing = require("./mailing-D4kWlk3_.js");
|
|
|
9
9
|
require("dotenv");
|
|
10
10
|
require("nodemailer");
|
|
11
11
|
require("axios");
|
|
12
|
-
const globals_abac = require("./globals.abac-
|
|
12
|
+
const globals_abac = require("./globals.abac-Bn-4tbX8.js");
|
|
13
13
|
var apns_service;
|
|
14
14
|
var hasRequiredApns_service;
|
|
15
15
|
function requireApns_service() {
|
|
@@ -8,7 +8,7 @@ import { r as requireMailing } from "./mailing-DvCT5ijo.mjs";
|
|
|
8
8
|
import "dotenv";
|
|
9
9
|
import "nodemailer";
|
|
10
10
|
import "axios";
|
|
11
|
-
import { r as requireGlobals_abac } from "./globals.abac-
|
|
11
|
+
import { r as requireGlobals_abac } from "./globals.abac-DZpTRxKR.mjs";
|
|
12
12
|
var apns_service;
|
|
13
13
|
var hasRequiredApns_service;
|
|
14
14
|
function requireApns_service() {
|
package/dist/orders.server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
|
3
|
-
const ownership_schema = require("./ownership.schema-
|
|
4
|
-
const profile_schema = require("./profile.schema-
|
|
3
|
+
const ownership_schema = require("./ownership.schema-MxfJlPtq.js");
|
|
4
|
+
const profile_schema = require("./profile.schema-BLSuV_VC.js");
|
|
5
5
|
const credentials_schema = require("./credentials.schema-BmOPv6FD.js");
|
|
6
|
-
const queryProcessor = require("./queryProcessor-
|
|
6
|
+
const queryProcessor = require("./queryProcessor-DSUqSk3I.js");
|
|
7
7
|
const mailing = require("./mailing-D4kWlk3_.js");
|
|
8
|
-
const index = require("./index-
|
|
8
|
+
const index = require("./index-BOmxJQ5W.js");
|
|
9
9
|
const require$$0 = require("axios");
|
|
10
10
|
const globals_cache = require("./globals.cache-CwWvNGFQ.js");
|
|
11
11
|
const globals_logger = require("./globals.logger-BdjooLaD.js");
|
|
@@ -514,6 +514,7 @@ ${formatPositions(order.positions)}
|
|
|
514
514
|
// Assuming creator.target holds the user ID
|
|
515
515
|
};
|
|
516
516
|
console.log("notifiocatio data", JSON.stringify(notificationData));
|
|
517
|
+
console.log("notification api is", `${process.env.API_URL || ""}/api/notifications`);
|
|
517
518
|
const notificationResponse = await fetch(`${process.env.API_URL || ""}/api/notifications`, {
|
|
518
519
|
method: "POST",
|
|
519
520
|
headers: {
|
package/dist/orders.server.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
|
2
|
-
import { r as requireOwnership_schema } from "./ownership.schema-
|
|
3
|
-
import { r as requireProfile_schema } from "./profile.schema-
|
|
2
|
+
import { r as requireOwnership_schema } from "./ownership.schema-CNCotD3D.mjs";
|
|
3
|
+
import { r as requireProfile_schema } from "./profile.schema-BRuvQ7QV.mjs";
|
|
4
4
|
import { r as requireCredentials_schema } from "./credentials.schema-oOC8B5KL.mjs";
|
|
5
|
-
import { r as requireQueryProcessor } from "./queryProcessor-
|
|
5
|
+
import { r as requireQueryProcessor } from "./queryProcessor-CVKI651_.mjs";
|
|
6
6
|
import { r as requireMailing } from "./mailing-DvCT5ijo.mjs";
|
|
7
|
-
import { r as requireMiddlewares } from "./index-
|
|
7
|
+
import { r as requireMiddlewares } from "./index-C_Fw0Umg.mjs";
|
|
8
8
|
import require$$0 from "axios";
|
|
9
9
|
import { r as requireGlobals_cache } from "./globals.cache-BT6q3vOf.mjs";
|
|
10
10
|
import { r as requireGlobals_logger } from "./globals.logger-DusiFsxN.mjs";
|
|
@@ -513,6 +513,7 @@ ${formatPositions(order.positions)}
|
|
|
513
513
|
// Assuming creator.target holds the user ID
|
|
514
514
|
};
|
|
515
515
|
console.log("notifiocatio data", JSON.stringify(notificationData));
|
|
516
|
+
console.log("notification api is", `${process.env.API_URL || ""}/api/notifications`);
|
|
516
517
|
const notificationResponse = await fetch(`${process.env.API_URL || ""}/api/notifications`, {
|
|
517
518
|
method: "POST",
|
|
518
519
|
headers: {
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
const _commonjsHelpers = require("./_commonjsHelpers-DHfMLFPC.js");
|
|
3
3
|
const require$$0$1 = require("jsonwebtoken");
|
|
4
4
|
const globals_cache = require("./globals.cache-CwWvNGFQ.js");
|
|
5
|
-
const queryProcessor = require("./queryProcessor-
|
|
5
|
+
const queryProcessor = require("./queryProcessor-DSUqSk3I.js");
|
|
6
6
|
const require$$0 = require("mongoose");
|
|
7
7
|
const require$$1 = require("@googlemaps/google-maps-services-js");
|
|
8
8
|
const addMembersQuantity = require("./addMembersQuantity-DxWjHK1K.js");
|
|
9
9
|
const require$$0$2 = require("uuidv4");
|
|
10
10
|
const mailing = require("./mailing-D4kWlk3_.js");
|
|
11
|
-
const index = require("./index-
|
|
12
|
-
const globals_abac = require("./globals.abac-
|
|
11
|
+
const index = require("./index-BOmxJQ5W.js");
|
|
12
|
+
const globals_abac = require("./globals.abac-Bn-4tbX8.js");
|
|
13
13
|
const engagement_schema = require("./engagement.schema-DAiXsvh1.js");
|
|
14
|
-
const ownership_schema = require("./ownership.schema-
|
|
14
|
+
const ownership_schema = require("./ownership.schema-MxfJlPtq.js");
|
|
15
15
|
const credentials_schema = require("./credentials.schema-BmOPv6FD.js");
|
|
16
|
-
const globals_verifier = require("./globals.verifier-
|
|
16
|
+
const globals_verifier = require("./globals.verifier-CKYpYfQl.js");
|
|
17
17
|
var departments_controller;
|
|
18
18
|
var hasRequiredDepartments_controller;
|
|
19
19
|
function requireDepartments_controller() {
|
|
@@ -942,6 +942,24 @@ function requireAccesses_schema() {
|
|
|
942
942
|
if (hasRequiredAccesses_schema) return accesses_schema;
|
|
943
943
|
hasRequiredAccesses_schema = 1;
|
|
944
944
|
const accessesSchema = {
|
|
945
|
+
categories: {
|
|
946
|
+
create: {
|
|
947
|
+
type: Boolean,
|
|
948
|
+
default: false
|
|
949
|
+
},
|
|
950
|
+
read: {
|
|
951
|
+
type: Boolean,
|
|
952
|
+
default: false
|
|
953
|
+
},
|
|
954
|
+
edit: {
|
|
955
|
+
type: Boolean,
|
|
956
|
+
default: false
|
|
957
|
+
},
|
|
958
|
+
delete: {
|
|
959
|
+
type: Boolean,
|
|
960
|
+
default: false
|
|
961
|
+
}
|
|
962
|
+
},
|
|
945
963
|
rents: {
|
|
946
964
|
create: {
|
|
947
965
|
type: Boolean,
|
|
@@ -1378,7 +1396,11 @@ function requireOrganizations_policies() {
|
|
|
1378
1396
|
abacAccessControl.registerGlobalPolicy("OrganizationAccessPolicy", async (context) => {
|
|
1379
1397
|
const { user, resource, data, action, currentResource, req } = context;
|
|
1380
1398
|
if (!resource || !action) {
|
|
1381
|
-
return
|
|
1399
|
+
return {
|
|
1400
|
+
allow: false,
|
|
1401
|
+
force: false,
|
|
1402
|
+
reason: "MISSING_REQUIRED_PARAMETERS"
|
|
1403
|
+
};
|
|
1382
1404
|
}
|
|
1383
1405
|
const findOrgId = () => {
|
|
1384
1406
|
try {
|
|
@@ -1394,52 +1416,103 @@ function requireOrganizations_policies() {
|
|
|
1394
1416
|
return null;
|
|
1395
1417
|
};
|
|
1396
1418
|
const orgId = findOrgId();
|
|
1397
|
-
if (orgId) {
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
}
|
|
1419
|
-
} catch (error) {
|
|
1420
|
-
console.error("Error checking user access:", error);
|
|
1421
|
-
return false;
|
|
1419
|
+
if (!orgId) {
|
|
1420
|
+
return {
|
|
1421
|
+
allow: true,
|
|
1422
|
+
force: false,
|
|
1423
|
+
reason: "NOT_ORGANIZATION_RESOURCE"
|
|
1424
|
+
};
|
|
1425
|
+
}
|
|
1426
|
+
if (user) {
|
|
1427
|
+
try {
|
|
1428
|
+
const objectId = new db.mongoose.Types.ObjectId(orgId);
|
|
1429
|
+
const isOrgOwner = await Organization.exists({
|
|
1430
|
+
_id: objectId,
|
|
1431
|
+
owner: user
|
|
1432
|
+
});
|
|
1433
|
+
if (isOrgOwner) {
|
|
1434
|
+
return {
|
|
1435
|
+
allow: true,
|
|
1436
|
+
force: true,
|
|
1437
|
+
// Владелец организации получает принудительный доступ
|
|
1438
|
+
reason: "ORGANIZATION_OWNER_ACCESS"
|
|
1439
|
+
};
|
|
1422
1440
|
}
|
|
1441
|
+
const departments = await Department.find({
|
|
1442
|
+
organization: objectId,
|
|
1443
|
+
"members.user": user
|
|
1444
|
+
});
|
|
1445
|
+
const hasAccess = departments.some((department) => {
|
|
1446
|
+
const accessRights = department.accesses?.[resource];
|
|
1447
|
+
return accessRights && accessRights[action];
|
|
1448
|
+
});
|
|
1449
|
+
if (hasAccess) {
|
|
1450
|
+
return {
|
|
1451
|
+
allow: true,
|
|
1452
|
+
force: false,
|
|
1453
|
+
// Доступ через департамент не является принудительным
|
|
1454
|
+
reason: "DEPARTMENT_MEMBER_ACCESS"
|
|
1455
|
+
};
|
|
1456
|
+
}
|
|
1457
|
+
} catch (error) {
|
|
1458
|
+
console.error("Error checking user access:", error);
|
|
1459
|
+
return {
|
|
1460
|
+
allow: false,
|
|
1461
|
+
force: false,
|
|
1462
|
+
reason: "ORGANIZATION_ACCESS_CHECK_ERROR"
|
|
1463
|
+
};
|
|
1423
1464
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1465
|
+
}
|
|
1466
|
+
if (action === "read" && req && req.query) {
|
|
1467
|
+
try {
|
|
1468
|
+
const validationResult = publicAccessVerifier.verify(req.query, {
|
|
1469
|
+
only: ["status"]
|
|
1470
|
+
});
|
|
1471
|
+
req.query = validationResult.verifiedData;
|
|
1472
|
+
req.queryValidation = validationResult;
|
|
1473
|
+
if (currentResource && !publicAccessVerifier.verifyParam("status", currentResource.status)) {
|
|
1474
|
+
return {
|
|
1475
|
+
allow: false,
|
|
1476
|
+
force: false,
|
|
1477
|
+
// Принудительно запрещаем доступ к непубличным ресурсам
|
|
1478
|
+
reason: "INVALID_RESOURCE_STATUS_FOR_PUBLIC_ACCESS"
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
if (validationResult.isValid) {
|
|
1482
|
+
return {
|
|
1483
|
+
allow: true,
|
|
1484
|
+
force: false,
|
|
1485
|
+
reason: "PUBLIC_ACCESS_ALLOWED"
|
|
1486
|
+
};
|
|
1487
|
+
} else {
|
|
1488
|
+
return {
|
|
1489
|
+
allow: false,
|
|
1490
|
+
force: false,
|
|
1491
|
+
// Принудительно запрещаем, если невалидные параметры
|
|
1492
|
+
reason: "INVALID_PUBLIC_ACCESS_PARAMETERS"
|
|
1493
|
+
};
|
|
1438
1494
|
}
|
|
1495
|
+
} catch (error) {
|
|
1496
|
+
console.error("Error validating query:", error);
|
|
1497
|
+
return {
|
|
1498
|
+
allow: false,
|
|
1499
|
+
force: false,
|
|
1500
|
+
reason: "QUERY_VALIDATION_ERROR"
|
|
1501
|
+
};
|
|
1439
1502
|
}
|
|
1440
|
-
return false;
|
|
1441
1503
|
}
|
|
1442
|
-
|
|
1504
|
+
if (action !== "read") {
|
|
1505
|
+
return {
|
|
1506
|
+
allow: false,
|
|
1507
|
+
force: false,
|
|
1508
|
+
reason: "ORGANIZATION_RESOURCE_OPERATION_FORBIDDEN"
|
|
1509
|
+
};
|
|
1510
|
+
}
|
|
1511
|
+
return {
|
|
1512
|
+
allow: false,
|
|
1513
|
+
force: false,
|
|
1514
|
+
reason: "ORGANIZATION_RESOURCE_ACCESS_DENIED"
|
|
1515
|
+
};
|
|
1443
1516
|
});
|
|
1444
1517
|
abacAccessControl.updatePublicAccessConfig = (newConfig) => {
|
|
1445
1518
|
if (typeof newConfig !== "object" || newConfig === null) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./_commonjsHelpers-CUmg6egw.mjs";
|
|
2
2
|
import require$$0$1 from "jsonwebtoken";
|
|
3
3
|
import { r as requireGlobals_cache } from "./globals.cache-BT6q3vOf.mjs";
|
|
4
|
-
import { r as requireQueryProcessor } from "./queryProcessor-
|
|
4
|
+
import { r as requireQueryProcessor } from "./queryProcessor-CVKI651_.mjs";
|
|
5
5
|
import require$$0 from "mongoose";
|
|
6
6
|
import require$$1 from "@googlemaps/google-maps-services-js";
|
|
7
7
|
import { r as requireAddUserStatusFields, a as requireAddMembersQuantity } from "./addMembersQuantity-DBfuUEx_.mjs";
|
|
8
8
|
import require$$0$2 from "uuidv4";
|
|
9
9
|
import { r as requireMailing } from "./mailing-DvCT5ijo.mjs";
|
|
10
|
-
import { r as requireMiddlewares } from "./index-
|
|
11
|
-
import { r as requireGlobals_abac } from "./globals.abac-
|
|
10
|
+
import { r as requireMiddlewares } from "./index-C_Fw0Umg.mjs";
|
|
11
|
+
import { r as requireGlobals_abac } from "./globals.abac-DZpTRxKR.mjs";
|
|
12
12
|
import { r as requireEngagement_schema } from "./engagement.schema-DnDD7Bn3.mjs";
|
|
13
|
-
import { r as requireOwnership_schema } from "./ownership.schema-
|
|
13
|
+
import { r as requireOwnership_schema } from "./ownership.schema-CNCotD3D.mjs";
|
|
14
14
|
import { r as requireCredentials_schema } from "./credentials.schema-oOC8B5KL.mjs";
|
|
15
|
-
import { r as requireGlobals_verifier, a as requireGlobals_validator } from "./globals.verifier-
|
|
15
|
+
import { r as requireGlobals_verifier, a as requireGlobals_validator } from "./globals.verifier-BdJxc8-8.mjs";
|
|
16
16
|
var departments_controller;
|
|
17
17
|
var hasRequiredDepartments_controller;
|
|
18
18
|
function requireDepartments_controller() {
|
|
@@ -941,6 +941,24 @@ function requireAccesses_schema() {
|
|
|
941
941
|
if (hasRequiredAccesses_schema) return accesses_schema;
|
|
942
942
|
hasRequiredAccesses_schema = 1;
|
|
943
943
|
const accessesSchema = {
|
|
944
|
+
categories: {
|
|
945
|
+
create: {
|
|
946
|
+
type: Boolean,
|
|
947
|
+
default: false
|
|
948
|
+
},
|
|
949
|
+
read: {
|
|
950
|
+
type: Boolean,
|
|
951
|
+
default: false
|
|
952
|
+
},
|
|
953
|
+
edit: {
|
|
954
|
+
type: Boolean,
|
|
955
|
+
default: false
|
|
956
|
+
},
|
|
957
|
+
delete: {
|
|
958
|
+
type: Boolean,
|
|
959
|
+
default: false
|
|
960
|
+
}
|
|
961
|
+
},
|
|
944
962
|
rents: {
|
|
945
963
|
create: {
|
|
946
964
|
type: Boolean,
|
|
@@ -1377,7 +1395,11 @@ function requireOrganizations_policies() {
|
|
|
1377
1395
|
abacAccessControl.registerGlobalPolicy("OrganizationAccessPolicy", async (context) => {
|
|
1378
1396
|
const { user, resource, data, action, currentResource, req } = context;
|
|
1379
1397
|
if (!resource || !action) {
|
|
1380
|
-
return
|
|
1398
|
+
return {
|
|
1399
|
+
allow: false,
|
|
1400
|
+
force: false,
|
|
1401
|
+
reason: "MISSING_REQUIRED_PARAMETERS"
|
|
1402
|
+
};
|
|
1381
1403
|
}
|
|
1382
1404
|
const findOrgId = () => {
|
|
1383
1405
|
try {
|
|
@@ -1393,52 +1415,103 @@ function requireOrganizations_policies() {
|
|
|
1393
1415
|
return null;
|
|
1394
1416
|
};
|
|
1395
1417
|
const orgId = findOrgId();
|
|
1396
|
-
if (orgId) {
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
}
|
|
1418
|
-
} catch (error) {
|
|
1419
|
-
console.error("Error checking user access:", error);
|
|
1420
|
-
return false;
|
|
1418
|
+
if (!orgId) {
|
|
1419
|
+
return {
|
|
1420
|
+
allow: true,
|
|
1421
|
+
force: false,
|
|
1422
|
+
reason: "NOT_ORGANIZATION_RESOURCE"
|
|
1423
|
+
};
|
|
1424
|
+
}
|
|
1425
|
+
if (user) {
|
|
1426
|
+
try {
|
|
1427
|
+
const objectId = new db.mongoose.Types.ObjectId(orgId);
|
|
1428
|
+
const isOrgOwner = await Organization.exists({
|
|
1429
|
+
_id: objectId,
|
|
1430
|
+
owner: user
|
|
1431
|
+
});
|
|
1432
|
+
if (isOrgOwner) {
|
|
1433
|
+
return {
|
|
1434
|
+
allow: true,
|
|
1435
|
+
force: true,
|
|
1436
|
+
// Владелец организации получает принудительный доступ
|
|
1437
|
+
reason: "ORGANIZATION_OWNER_ACCESS"
|
|
1438
|
+
};
|
|
1421
1439
|
}
|
|
1440
|
+
const departments = await Department.find({
|
|
1441
|
+
organization: objectId,
|
|
1442
|
+
"members.user": user
|
|
1443
|
+
});
|
|
1444
|
+
const hasAccess = departments.some((department) => {
|
|
1445
|
+
const accessRights = department.accesses?.[resource];
|
|
1446
|
+
return accessRights && accessRights[action];
|
|
1447
|
+
});
|
|
1448
|
+
if (hasAccess) {
|
|
1449
|
+
return {
|
|
1450
|
+
allow: true,
|
|
1451
|
+
force: false,
|
|
1452
|
+
// Доступ через департамент не является принудительным
|
|
1453
|
+
reason: "DEPARTMENT_MEMBER_ACCESS"
|
|
1454
|
+
};
|
|
1455
|
+
}
|
|
1456
|
+
} catch (error) {
|
|
1457
|
+
console.error("Error checking user access:", error);
|
|
1458
|
+
return {
|
|
1459
|
+
allow: false,
|
|
1460
|
+
force: false,
|
|
1461
|
+
reason: "ORGANIZATION_ACCESS_CHECK_ERROR"
|
|
1462
|
+
};
|
|
1422
1463
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1464
|
+
}
|
|
1465
|
+
if (action === "read" && req && req.query) {
|
|
1466
|
+
try {
|
|
1467
|
+
const validationResult = publicAccessVerifier.verify(req.query, {
|
|
1468
|
+
only: ["status"]
|
|
1469
|
+
});
|
|
1470
|
+
req.query = validationResult.verifiedData;
|
|
1471
|
+
req.queryValidation = validationResult;
|
|
1472
|
+
if (currentResource && !publicAccessVerifier.verifyParam("status", currentResource.status)) {
|
|
1473
|
+
return {
|
|
1474
|
+
allow: false,
|
|
1475
|
+
force: false,
|
|
1476
|
+
// Принудительно запрещаем доступ к непубличным ресурсам
|
|
1477
|
+
reason: "INVALID_RESOURCE_STATUS_FOR_PUBLIC_ACCESS"
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
if (validationResult.isValid) {
|
|
1481
|
+
return {
|
|
1482
|
+
allow: true,
|
|
1483
|
+
force: false,
|
|
1484
|
+
reason: "PUBLIC_ACCESS_ALLOWED"
|
|
1485
|
+
};
|
|
1486
|
+
} else {
|
|
1487
|
+
return {
|
|
1488
|
+
allow: false,
|
|
1489
|
+
force: false,
|
|
1490
|
+
// Принудительно запрещаем, если невалидные параметры
|
|
1491
|
+
reason: "INVALID_PUBLIC_ACCESS_PARAMETERS"
|
|
1492
|
+
};
|
|
1437
1493
|
}
|
|
1494
|
+
} catch (error) {
|
|
1495
|
+
console.error("Error validating query:", error);
|
|
1496
|
+
return {
|
|
1497
|
+
allow: false,
|
|
1498
|
+
force: false,
|
|
1499
|
+
reason: "QUERY_VALIDATION_ERROR"
|
|
1500
|
+
};
|
|
1438
1501
|
}
|
|
1439
|
-
return false;
|
|
1440
1502
|
}
|
|
1441
|
-
|
|
1503
|
+
if (action !== "read") {
|
|
1504
|
+
return {
|
|
1505
|
+
allow: false,
|
|
1506
|
+
force: false,
|
|
1507
|
+
reason: "ORGANIZATION_RESOURCE_OPERATION_FORBIDDEN"
|
|
1508
|
+
};
|
|
1509
|
+
}
|
|
1510
|
+
return {
|
|
1511
|
+
allow: false,
|
|
1512
|
+
force: false,
|
|
1513
|
+
reason: "ORGANIZATION_RESOURCE_ACCESS_DENIED"
|
|
1514
|
+
};
|
|
1442
1515
|
});
|
|
1443
1516
|
abacAccessControl.updatePublicAccessConfig = (newConfig) => {
|
|
1444
1517
|
if (typeof newConfig !== "object" || newConfig === null) {
|
|
@@ -8,12 +8,15 @@ function requireOwnership_schema() {
|
|
|
8
8
|
owner: {
|
|
9
9
|
type: {
|
|
10
10
|
type: String,
|
|
11
|
-
required: true
|
|
11
|
+
required: true,
|
|
12
|
+
enum: ["user", "organization", "platform"]
|
|
12
13
|
},
|
|
13
14
|
target: {
|
|
14
15
|
type: db.mongoose.Schema.Types.ObjectId,
|
|
15
16
|
refPath: "owner.type",
|
|
16
|
-
required:
|
|
17
|
+
required: function() {
|
|
18
|
+
return this.owner.type !== "platform";
|
|
19
|
+
}
|
|
17
20
|
}
|
|
18
21
|
},
|
|
19
22
|
creator: {
|
|
@@ -23,12 +26,15 @@ function requireOwnership_schema() {
|
|
|
23
26
|
},
|
|
24
27
|
type: {
|
|
25
28
|
type: String,
|
|
26
|
-
required: true
|
|
29
|
+
required: true,
|
|
30
|
+
enum: ["user", "organization", "platform"]
|
|
27
31
|
},
|
|
28
32
|
target: {
|
|
29
33
|
type: db.mongoose.Schema.Types.ObjectId,
|
|
30
34
|
refPath: "creator.type",
|
|
31
|
-
required:
|
|
35
|
+
required: function() {
|
|
36
|
+
return this.creator.type !== "platform";
|
|
37
|
+
}
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
});
|
|
@@ -9,12 +9,15 @@ function requireOwnership_schema() {
|
|
|
9
9
|
owner: {
|
|
10
10
|
type: {
|
|
11
11
|
type: String,
|
|
12
|
-
required: true
|
|
12
|
+
required: true,
|
|
13
|
+
enum: ["user", "organization", "platform"]
|
|
13
14
|
},
|
|
14
15
|
target: {
|
|
15
16
|
type: db.mongoose.Schema.Types.ObjectId,
|
|
16
17
|
refPath: "owner.type",
|
|
17
|
-
required:
|
|
18
|
+
required: function() {
|
|
19
|
+
return this.owner.type !== "platform";
|
|
20
|
+
}
|
|
18
21
|
}
|
|
19
22
|
},
|
|
20
23
|
creator: {
|
|
@@ -24,12 +27,15 @@ function requireOwnership_schema() {
|
|
|
24
27
|
},
|
|
25
28
|
type: {
|
|
26
29
|
type: String,
|
|
27
|
-
required: true
|
|
30
|
+
required: true,
|
|
31
|
+
enum: ["user", "organization", "platform"]
|
|
28
32
|
},
|
|
29
33
|
target: {
|
|
30
34
|
type: db.mongoose.Schema.Types.ObjectId,
|
|
31
35
|
refPath: "creator.type",
|
|
32
|
-
required:
|
|
36
|
+
required: function() {
|
|
37
|
+
return this.creator.type !== "platform";
|
|
38
|
+
}
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
});
|