@aglyn/plugins-data 1.12.0 → 1.13.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 +10 -10
- package/src/lib/components/dataset-schema-dialog.component.d.ts +14 -0
- package/src/lib/components/dataset-schema-dialog.component.js +150 -117
- package/src/lib/components/dataset-schema-dialog.component.js.map +1 -1
- package/src/lib/components/host-datasets-card.component.js +71 -34
- package/src/lib/components/host-datasets-card.component.js.map +1 -1
- package/src/lib/components/use-dataset-writes-blocked.d.ts +49 -12
- package/src/lib/components/use-dataset-writes-blocked.js +87 -19
- package/src/lib/components/use-dataset-writes-blocked.js.map +1 -1
- package/src/lib/declarations.d.ts +25 -0
- package/src/lib/declarations.js +37 -0
- package/src/lib/declarations.js.map +1 -0
- package/src/lib/model/data-permissions.d.ts +34 -0
- package/src/lib/model/data-permissions.js +108 -0
- package/src/lib/model/data-permissions.js.map +1 -0
- package/src/lib/model/dataset-access.d.ts +22 -0
- package/src/lib/model/dataset-access.js +30 -0
- package/src/lib/model/dataset-access.js.map +1 -0
- package/src/lib/plugin.js +4 -1
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/server/dataset-access.server.d.ts +40 -0
- package/src/lib/server/dataset-access.server.js +47 -0
- package/src/lib/server/dataset-access.server.js.map +1 -0
- package/src/lib/server/dataset-figures.js +12 -0
- package/src/lib/server/dataset-figures.js.map +1 -1
- package/src/lib/server/datasets-route.js +61 -15
- package/src/lib/server/datasets-route.js.map +1 -1
- package/src/lib/transfer/dataset-transfer-access.server.d.ts +23 -0
- package/src/lib/transfer/dataset-transfer-access.server.js +45 -0
- package/src/lib/transfer/dataset-transfer-access.server.js.map +1 -0
- package/src/lib/transfer/dataset-transfer-resource.js +2 -1
- package/src/lib/transfer/dataset-transfer-resource.js.map +1 -1
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import { type OrgPermission, resolveOrgPermissions } from '@aglyn/aglyn/app-utils/org-permissions';
|
|
17
|
+
import { type AglynOrgCustomRole, type OrgPermission, resolveOrgPermissions } from '@aglyn/aglyn/app-utils/org-permissions';
|
|
18
|
+
import type { TransferInstanceImportAnswer, TransferInstanceImportSubject } from '@aglyn/aglyn/plugin-manager/plugin-transfer-resources';
|
|
18
19
|
/** What the doors read off a membership document. */
|
|
19
20
|
type DatasetWriter = NonNullable<Parameters<typeof resolveOrgPermissions>[0]> & {
|
|
20
21
|
resolvedPermissions?: Readonly<Record<string, unknown>>;
|
|
@@ -26,22 +27,58 @@ export declare const DATASETS_WRITE_PERMISSION: OrgPermission;
|
|
|
26
27
|
export declare const DATASETS_DELETE_PERMISSION: OrgPermission;
|
|
27
28
|
export declare const DATASETS_WRITE_REFUSAL: string;
|
|
28
29
|
export declare const DATASETS_DELETE_REFUSAL: string;
|
|
30
|
+
export declare const DATASETS_VIEW_RECORDS_REFUSAL: string;
|
|
31
|
+
export declare const DATASETS_EXPORT_REFUSAL: string;
|
|
29
32
|
/**
|
|
30
|
-
* A member's answer for a dataset key (AGL-4047), as the rules' `
|
|
33
|
+
* A member's answer for a dataset key (AGL-4047), as the rules' `memberKeyOrOverride`
|
|
31
34
|
* and the routes' `memberHasOrgPermission` read it: the decision written on
|
|
32
35
|
* `resolvedPermissions`, or, for a member the projection never stamped, on their
|
|
33
|
-
* own `permissions`; else their workspace role's default.
|
|
34
|
-
* site narrows it, so a site's Data page asks the same thing as the workspace's.
|
|
36
|
+
* own `permissions`; else their workspace role's default.
|
|
35
37
|
*/
|
|
36
38
|
export declare function holdsDatasetPermission(member: DatasetWriter, permission: OrgPermission): boolean;
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
/** What the signed-in member is known not to be able to do with a dataset, and why. */
|
|
40
|
+
export interface DatasetAccessBlocked {
|
|
41
|
+
/** Whether these answers rest on the member's reads, rather than on their not having landed. */
|
|
42
|
+
known: boolean;
|
|
43
|
+
/** Making a new dataset: "Manage data". */
|
|
44
|
+
creates: boolean;
|
|
45
|
+
/** Changing this dataset's schema or records, or importing into it. */
|
|
44
46
|
writes: boolean;
|
|
47
|
+
writesReason: string;
|
|
48
|
+
/**
|
|
49
|
+
* The writes are off, and changing who it is shared with stays this member's:
|
|
50
|
+
* they hold "Manage data" across every site, and a site narrows them on the one
|
|
51
|
+
* this dataset sits on. Sharing is not among what a narrowing takes.
|
|
52
|
+
*/
|
|
53
|
+
sharingOnly: boolean;
|
|
54
|
+
/** Deleting this dataset. */
|
|
45
55
|
deletes: boolean;
|
|
46
|
-
|
|
56
|
+
deletesReason: string;
|
|
57
|
+
/** Reading this dataset's records. */
|
|
58
|
+
records: boolean;
|
|
59
|
+
/** Taking this dataset's records out as a file. */
|
|
60
|
+
exports: boolean;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The verdict for a member and a dataset placed at `visibleTo`, as the rule's
|
|
64
|
+
* `canWriteDatasetOn` and the routes' `memberMayActOnDataset` give it, resolved
|
|
65
|
+
* from what the site's stamp is written from. `customRole` is the member's custom
|
|
66
|
+
* role when they carry one and it was read.
|
|
67
|
+
*/
|
|
68
|
+
export declare function datasetAccessBlocked(member: DatasetWriter, visibleTo: unknown, customRole?: AglynOrgCustomRole | null): DatasetAccessBlocked;
|
|
69
|
+
/**
|
|
70
|
+
* Importing into one dataset, for the Import & export hub's row (AGL-4047): the
|
|
71
|
+
* same verdict the Data page's Import reads, and the transfer routes' `importAccess`.
|
|
72
|
+
*/
|
|
73
|
+
export declare function datasetInstanceImportAccess(subject: TransferInstanceImportSubject): TransferInstanceImportAnswer;
|
|
74
|
+
/**
|
|
75
|
+
* Which dataset controls switch off with the reason named rather than failing on
|
|
76
|
+
* save, for the dataset placed at `visibleTo`. Nothing is blocked until the reads
|
|
77
|
+
* land, nor for a reader with no membership, who is staff. Not a security
|
|
78
|
+
* boundary: the rules and routes refuse regardless.
|
|
79
|
+
*
|
|
80
|
+
* Costs the membership the page already reads, and one read of a custom role
|
|
81
|
+
* only for a member of the whole workspace whom the site decides.
|
|
82
|
+
*/
|
|
83
|
+
export declare function useDatasetWritesBlocked(orgId: string | null | undefined, visibleTo?: unknown): DatasetAccessBlocked;
|
|
47
84
|
export {};
|
|
@@ -14,18 +14,23 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/ import { permissionRefusalText, resolveOrgPermissions } from "@aglyn/aglyn/app-utils/org-permissions";
|
|
17
|
+
import { siteMayNarrow } from "@aglyn/aglyn/app-utils/host-permissions";
|
|
18
|
+
import { isOrgWideMember } from "@aglyn/aglyn/app-utils/organizations";
|
|
19
|
+
import { deleteBeyondReach, deleteBeyondReachRefusal, oneSitePlacement, placementVerdict, resolvedPlacementKey } from "@aglyn/aglyn/app-utils/site-placement";
|
|
17
20
|
import { useFirestore, useFirestoreDoc, useUser } from "@aglyn/tenant-feature-instance";
|
|
18
21
|
import { doc } from "firebase/firestore";
|
|
19
|
-
|
|
20
|
-
/**
|
|
22
|
+
import { DATA_ERASE_PERMISSION, DATA_EXPORT_PERMISSION, DATA_MANAGE_PERMISSION, DATA_SITE_DELETE_PERMISSION, DATA_SITE_MANAGE_PERMISSION, DATA_VIEW_RECORDS_PERMISSION, dataPermissionRefusal } from "../model/dataset-access.js";
|
|
23
|
+
/** Creating, editing and sharing datasets, and every record write. */ export const DATASETS_WRITE_PERMISSION = DATA_MANAGE_PERMISSION;
|
|
24
|
+
/** Deleting a whole dataset, which the erase route asks. */ export const DATASETS_DELETE_PERMISSION = DATA_ERASE_PERMISSION;
|
|
21
25
|
export const DATASETS_WRITE_REFUSAL = permissionRefusalText(DATASETS_WRITE_PERMISSION);
|
|
22
26
|
export const DATASETS_DELETE_REFUSAL = permissionRefusalText(DATASETS_DELETE_PERMISSION);
|
|
27
|
+
export const DATASETS_VIEW_RECORDS_REFUSAL = dataPermissionRefusal(DATA_VIEW_RECORDS_PERMISSION);
|
|
28
|
+
export const DATASETS_EXPORT_REFUSAL = dataPermissionRefusal(DATA_EXPORT_PERMISSION);
|
|
23
29
|
/**
|
|
24
|
-
* A member's answer for a dataset key (AGL-4047), as the rules' `
|
|
30
|
+
* A member's answer for a dataset key (AGL-4047), as the rules' `memberKeyOrOverride`
|
|
25
31
|
* and the routes' `memberHasOrgPermission` read it: the decision written on
|
|
26
32
|
* `resolvedPermissions`, or, for a member the projection never stamped, on their
|
|
27
|
-
* own `permissions`; else their workspace role's default.
|
|
28
|
-
* site narrows it, so a site's Data page asks the same thing as the workspace's.
|
|
33
|
+
* own `permissions`; else their workspace role's default.
|
|
29
34
|
*/ export function holdsDatasetPermission(member, permission) {
|
|
30
35
|
var _member_resolvedPermissions;
|
|
31
36
|
var _this;
|
|
@@ -33,13 +38,72 @@ export const DATASETS_DELETE_REFUSAL = permissionRefusalText(DATASETS_DELETE_PER
|
|
|
33
38
|
if (typeof stamped === 'boolean') return stamped;
|
|
34
39
|
return resolveOrgPermissions(member)[permission] === true;
|
|
35
40
|
}
|
|
41
|
+
const NOTHING_BLOCKED = {
|
|
42
|
+
known: false,
|
|
43
|
+
creates: false,
|
|
44
|
+
writes: false,
|
|
45
|
+
writesReason: DATASETS_WRITE_REFUSAL,
|
|
46
|
+
sharingOnly: false,
|
|
47
|
+
deletes: false,
|
|
48
|
+
deletesReason: DATASETS_DELETE_REFUSAL,
|
|
49
|
+
records: false,
|
|
50
|
+
exports: false
|
|
51
|
+
};
|
|
36
52
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*/ export function
|
|
42
|
-
|
|
53
|
+
* The verdict for a member and a dataset placed at `visibleTo`, as the rule's
|
|
54
|
+
* `canWriteDatasetOn` and the routes' `memberMayActOnDataset` give it, resolved
|
|
55
|
+
* from what the site's stamp is written from. `customRole` is the member's custom
|
|
56
|
+
* role when they carry one and it was read.
|
|
57
|
+
*/ export function datasetAccessBlocked(member, visibleTo, customRole) {
|
|
58
|
+
const seat = member;
|
|
59
|
+
const site = oneSitePlacement(visibleTo);
|
|
60
|
+
const writes = placementVerdict({
|
|
61
|
+
member: seat,
|
|
62
|
+
visibleTo,
|
|
63
|
+
workspace: holdsDatasetPermission(member, DATA_MANAGE_PERMISSION),
|
|
64
|
+
site: (hostId)=>resolvedPlacementKey(seat, hostId, DATA_SITE_MANAGE_PERMISSION, customRole)
|
|
65
|
+
});
|
|
66
|
+
const deletes = placementVerdict({
|
|
67
|
+
member: seat,
|
|
68
|
+
visibleTo,
|
|
69
|
+
workspace: holdsDatasetPermission(member, DATA_ERASE_PERMISSION),
|
|
70
|
+
site: (hostId)=>resolvedPlacementKey(seat, hostId, DATA_SITE_DELETE_PERMISSION, customRole)
|
|
71
|
+
});
|
|
72
|
+
const beyond = deleteBeyondReach(seat, visibleTo);
|
|
73
|
+
const holdsManage = holdsDatasetPermission(member, DATA_MANAGE_PERMISSION);
|
|
74
|
+
return {
|
|
75
|
+
known: true,
|
|
76
|
+
creates: !holdsManage,
|
|
77
|
+
writes: !writes,
|
|
78
|
+
sharingOnly: !writes && holdsManage && isOrgWideMember(seat),
|
|
79
|
+
writesReason: site ? dataPermissionRefusal(DATA_SITE_MANAGE_PERMISSION) : DATASETS_WRITE_REFUSAL,
|
|
80
|
+
deletes: beyond || !deletes,
|
|
81
|
+
deletesReason: beyond ? deleteBeyondReachRefusal('dataset') : site ? dataPermissionRefusal(DATA_SITE_DELETE_PERMISSION) : DATASETS_DELETE_REFUSAL,
|
|
82
|
+
records: !holdsDatasetPermission(member, DATA_VIEW_RECORDS_PERMISSION),
|
|
83
|
+
exports: !holdsDatasetPermission(member, DATA_EXPORT_PERMISSION)
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Importing into one dataset, for the Import & export hub's row (AGL-4047): the
|
|
88
|
+
* same verdict the Data page's Import reads, and the transfer routes' `importAccess`.
|
|
89
|
+
*/ export function datasetInstanceImportAccess(subject) {
|
|
90
|
+
var _subject_record_facts;
|
|
91
|
+
const blocked = datasetAccessBlocked(subject.member, (_subject_record_facts = subject.record.facts) == null ? void 0 : _subject_record_facts['visibleTo'], subject.customRole);
|
|
92
|
+
return {
|
|
93
|
+
allowed: !blocked.writes,
|
|
94
|
+
reason: blocked.writesReason
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Which dataset controls switch off with the reason named rather than failing on
|
|
99
|
+
* save, for the dataset placed at `visibleTo`. Nothing is blocked until the reads
|
|
100
|
+
* land, nor for a reader with no membership, who is staff. Not a security
|
|
101
|
+
* boundary: the rules and routes refuse regardless.
|
|
102
|
+
*
|
|
103
|
+
* Costs the membership the page already reads, and one read of a custom role
|
|
104
|
+
* only for a member of the whole workspace whom the site decides.
|
|
105
|
+
*/ export function useDatasetWritesBlocked(orgId, visibleTo) {
|
|
106
|
+
var _ref, _role_data;
|
|
43
107
|
const firestore = useFirestore();
|
|
44
108
|
const { data: user } = useUser();
|
|
45
109
|
const uid = (_ref = user == null ? void 0 : user.uid) != null ? _ref : '';
|
|
@@ -48,14 +112,18 @@ export const DATASETS_DELETE_REFUSAL = permissionRefusalText(DATASETS_DELETE_PER
|
|
|
48
112
|
orgId,
|
|
49
113
|
uid
|
|
50
114
|
]);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
115
|
+
const seat = status === 'success' ? member : null;
|
|
116
|
+
const site = oneSitePlacement(visibleTo);
|
|
117
|
+
// Only someone the site decides: narrowed on it, or on a role wider or narrower here.
|
|
118
|
+
const siteDecides = Boolean(seat && site) && isOrgWideMember(seat) && (Boolean(siteMayNarrow(seat, site)) || !holdsDatasetPermission(seat, DATA_MANAGE_PERMISSION));
|
|
119
|
+
const roleId = siteDecides && typeof (seat == null ? void 0 : seat.roleId) === 'string' ? seat.roleId : '';
|
|
120
|
+
const role = useFirestoreDoc(()=>orgId && roleId ? doc(firestore, 'orgs', orgId, 'roles', roleId) : null, [
|
|
121
|
+
firestore,
|
|
122
|
+
orgId,
|
|
123
|
+
roleId
|
|
124
|
+
]);
|
|
125
|
+
if (!seat || roleId && role.status === 'loading') return NOTHING_BLOCKED;
|
|
126
|
+
return datasetAccessBlocked(seat, visibleTo, roleId && role.status === 'success' ? (_role_data = role.data) != null ? _role_data : null : null);
|
|
59
127
|
}
|
|
60
128
|
|
|
61
129
|
//# sourceMappingURL=use-dataset-writes-blocked.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/data/src/lib/components/use-dataset-writes-blocked.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n type OrgPermission,\n permissionRefusalText,\n resolveOrgPermissions,\n} from '@aglyn/aglyn/app-utils/org-permissions'\nimport { useFirestore, useFirestoreDoc, useUser } from '@aglyn/tenant-feature-instance'\nimport { doc } from 'firebase/firestore'\n\n/** What the doors read off a membership document. */\ntype DatasetWriter = NonNullable<Parameters<typeof resolveOrgPermissions>[0]> & {\n resolvedPermissions?: Readonly<Record<string, unknown>>\n permissions?: Readonly<Record<string, unknown>>\n}\n\n/** Creating, editing and sharing datasets, and every record write. */\nexport const DATASETS_WRITE_PERMISSION: OrgPermission = 'data.manage'\n/** Deleting a whole dataset, which the erase route asks. */\nexport const DATASETS_DELETE_PERMISSION: OrgPermission = 'org.eraseRecords'\n\nexport const DATASETS_WRITE_REFUSAL = permissionRefusalText(DATASETS_WRITE_PERMISSION)\nexport const DATASETS_DELETE_REFUSAL = permissionRefusalText(DATASETS_DELETE_PERMISSION)\n\n/**\n * A member's answer for a dataset key (AGL-4047), as the rules' `canWriteOrgDatasets`\n * and the routes' `memberHasOrgPermission` read it: the decision written on\n * `resolvedPermissions`, or, for a member the projection never stamped, on their\n * own `permissions`; else their workspace role's default. A workspace key: no\n * site narrows it, so a site's Data page asks the same thing as the workspace's.\n */\nexport function holdsDatasetPermission(member: DatasetWriter, permission: OrgPermission): boolean {\n const stamped = (member.resolvedPermissions ?? member.permissions)?.[permission]\n if (typeof stamped === 'boolean') return stamped\n return resolveOrgPermissions(member)[permission] === true\n}\n\n/**\n * Which dataset writes the signed-in member is known not to hold, so those\n * controls switch off with the permission named rather than failing on save.\n * Neither is blocked until the read lands, nor for a reader with no membership,\n * who is staff. Not a security boundary: the rules and routes refuse regardless.\n */\nexport function useDatasetWritesBlocked(orgId: string | null | undefined): {\n writes: boolean\n deletes: boolean\n} {\n const firestore = useFirestore()\n const { data: user } = useUser()\n const uid = (user as { uid?: string } | undefined)?.uid ?? ''\n const { data: member, status } = useFirestoreDoc<DatasetWriter>(\n () => (orgId && uid ? doc(firestore, 'orgs', orgId, 'members', uid) : null),\n [firestore, orgId, uid],\n )\n if (status !== 'success' || !member) return { writes: false, deletes: false }\n return {\n writes: !holdsDatasetPermission(member, DATASETS_WRITE_PERMISSION),\n deletes: !holdsDatasetPermission(member, DATASETS_DELETE_PERMISSION),\n }\n}\n"],"names":["permissionRefusalText","resolveOrgPermissions","useFirestore","useFirestoreDoc","useUser","doc","DATASETS_WRITE_PERMISSION","DATASETS_DELETE_PERMISSION","DATASETS_WRITE_REFUSAL","DATASETS_DELETE_REFUSAL","holdsDatasetPermission","member","permission","stamped","resolvedPermissions","permissions","useDatasetWritesBlocked","orgId","firestore","data","user","uid","status","writes","deletes"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAEEA,qBAAqB,EACrBC,qBAAqB,QAChB,yCAAwC;AAC/C,SAASC,YAAY,EAAEC,eAAe,EAAEC,OAAO,QAAQ,iCAAgC;AACvF,SAASC,GAAG,QAAQ,qBAAoB;AAQxC,oEAAoE,GACpE,OAAO,MAAMC,4BAA2C,cAAa;AACrE,0DAA0D,GAC1D,OAAO,MAAMC,6BAA4C,mBAAkB;AAE3E,OAAO,MAAMC,yBAAyBR,sBAAsBM,2BAA0B;AACtF,OAAO,MAAMG,0BAA0BT,sBAAsBO,4BAA2B;AAExF;;;;;;CAMC,GACD,OAAO,SAASG,uBAAuBC,MAAqB,EAAEC,UAAyB;QACpED;QAAAA;IAAjB,MAAME,WAAWF,SAAAA,8BAAAA,OAAOG,mBAAmB,YAA1BH,8BAA8BA,OAAOI,WAAW,qBAAjD,AAACJ,KAAmD,CAACC,WAAW;IAChF,IAAI,OAAOC,YAAY,WAAW,OAAOA;IACzC,OAAOZ,sBAAsBU,OAAO,CAACC,WAAW,KAAK;AACvD;AAEA;;;;;CAKC,GACD,OAAO,SAASI,wBAAwBC,KAAgC;;IAItE,MAAMC,YAAYhB;IAClB,MAAM,EAAEiB,MAAMC,IAAI,EAAE,GAAGhB;IACvB,MAAMiB,cAAOD,wBAAD,AAACA,KAAuCC,GAAG,mBAAI;IAC3D,MAAM,EAAEF,MAAMR,MAAM,EAAEW,MAAM,EAAE,GAAGnB,gBAC/B,IAAOc,SAASI,MAAMhB,IAAIa,WAAW,QAAQD,OAAO,WAAWI,OAAO,MACtE;QAACH;QAAWD;QAAOI;KAAI;IAEzB,IAAIC,WAAW,aAAa,CAACX,QAAQ,OAAO;QAAEY,QAAQ;QAAOC,SAAS;IAAM;IAC5E,OAAO;QACLD,QAAQ,CAACb,uBAAuBC,QAAQL;QACxCkB,SAAS,CAACd,uBAAuBC,QAAQJ;IAC3C;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/data/src/lib/components/use-dataset-writes-blocked.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n type AglynOrgCustomRole,\n type OrgPermission,\n permissionRefusalText,\n resolveOrgPermissions,\n} from '@aglyn/aglyn/app-utils/org-permissions'\nimport { siteMayNarrow } from '@aglyn/aglyn/app-utils/host-permissions'\nimport { isOrgWideMember } from '@aglyn/aglyn/app-utils/organizations'\nimport {\n deleteBeyondReach,\n deleteBeyondReachRefusal,\n oneSitePlacement,\n placementVerdict,\n resolvedPlacementKey,\n} from '@aglyn/aglyn/app-utils/site-placement'\nimport type { AglynOrgMember } from '@aglyn/aglyn/foundation/definitions/organization.types'\nimport type {\n TransferInstanceImportAnswer,\n TransferInstanceImportSubject,\n} from '@aglyn/aglyn/plugin-manager/plugin-transfer-resources'\nimport { useFirestore, useFirestoreDoc, useUser } from '@aglyn/tenant-feature-instance'\nimport { doc } from 'firebase/firestore'\nimport {\n DATA_ERASE_PERMISSION,\n DATA_EXPORT_PERMISSION,\n DATA_MANAGE_PERMISSION,\n DATA_SITE_DELETE_PERMISSION,\n DATA_SITE_MANAGE_PERMISSION,\n DATA_VIEW_RECORDS_PERMISSION,\n dataPermissionRefusal,\n} from '../model/dataset-access'\n\n/** What the doors read off a membership document. */\ntype DatasetWriter = NonNullable<Parameters<typeof resolveOrgPermissions>[0]> & {\n resolvedPermissions?: Readonly<Record<string, unknown>>\n permissions?: Readonly<Record<string, unknown>>\n}\n\n/** Creating, editing and sharing datasets, and every record write. */\nexport const DATASETS_WRITE_PERMISSION: OrgPermission = DATA_MANAGE_PERMISSION\n/** Deleting a whole dataset, which the erase route asks. */\nexport const DATASETS_DELETE_PERMISSION: OrgPermission = DATA_ERASE_PERMISSION\n\nexport const DATASETS_WRITE_REFUSAL = permissionRefusalText(DATASETS_WRITE_PERMISSION)\nexport const DATASETS_DELETE_REFUSAL = permissionRefusalText(DATASETS_DELETE_PERMISSION)\nexport const DATASETS_VIEW_RECORDS_REFUSAL = dataPermissionRefusal(DATA_VIEW_RECORDS_PERMISSION)\nexport const DATASETS_EXPORT_REFUSAL = dataPermissionRefusal(DATA_EXPORT_PERMISSION)\n\n/**\n * A member's answer for a dataset key (AGL-4047), as the rules' `memberKeyOrOverride`\n * and the routes' `memberHasOrgPermission` read it: the decision written on\n * `resolvedPermissions`, or, for a member the projection never stamped, on their\n * own `permissions`; else their workspace role's default.\n */\nexport function holdsDatasetPermission(member: DatasetWriter, permission: OrgPermission): boolean {\n const stamped = (member.resolvedPermissions ?? member.permissions)?.[permission]\n if (typeof stamped === 'boolean') return stamped\n return resolveOrgPermissions(member)[permission] === true\n}\n\n/** What the signed-in member is known not to be able to do with a dataset, and why. */\nexport interface DatasetAccessBlocked {\n /** Whether these answers rest on the member's reads, rather than on their not having landed. */\n known: boolean\n /** Making a new dataset: \"Manage data\". */\n creates: boolean\n /** Changing this dataset's schema or records, or importing into it. */\n writes: boolean\n writesReason: string\n /**\n * The writes are off, and changing who it is shared with stays this member's:\n * they hold \"Manage data\" across every site, and a site narrows them on the one\n * this dataset sits on. Sharing is not among what a narrowing takes.\n */\n sharingOnly: boolean\n /** Deleting this dataset. */\n deletes: boolean\n deletesReason: string\n /** Reading this dataset's records. */\n records: boolean\n /** Taking this dataset's records out as a file. */\n exports: boolean\n}\n\nconst NOTHING_BLOCKED: DatasetAccessBlocked = {\n known: false,\n creates: false,\n writes: false,\n writesReason: DATASETS_WRITE_REFUSAL,\n sharingOnly: false,\n deletes: false,\n deletesReason: DATASETS_DELETE_REFUSAL,\n records: false,\n exports: false,\n}\n\n/**\n * The verdict for a member and a dataset placed at `visibleTo`, as the rule's\n * `canWriteDatasetOn` and the routes' `memberMayActOnDataset` give it, resolved\n * from what the site's stamp is written from. `customRole` is the member's custom\n * role when they carry one and it was read.\n */\nexport function datasetAccessBlocked(\n member: DatasetWriter,\n visibleTo: unknown,\n customRole?: AglynOrgCustomRole | null,\n): DatasetAccessBlocked {\n const seat = member as Partial<AglynOrgMember>\n const site = oneSitePlacement(visibleTo)\n const writes = placementVerdict<boolean>({\n member: seat,\n visibleTo,\n workspace: holdsDatasetPermission(member, DATA_MANAGE_PERMISSION),\n site: (hostId) => resolvedPlacementKey(seat, hostId, DATA_SITE_MANAGE_PERMISSION, customRole),\n })\n const deletes = placementVerdict<boolean>({\n member: seat,\n visibleTo,\n workspace: holdsDatasetPermission(member, DATA_ERASE_PERMISSION),\n site: (hostId) => resolvedPlacementKey(seat, hostId, DATA_SITE_DELETE_PERMISSION, customRole),\n })\n const beyond = deleteBeyondReach(seat, visibleTo)\n const holdsManage = holdsDatasetPermission(member, DATA_MANAGE_PERMISSION)\n return {\n known: true,\n creates: !holdsManage,\n writes: !writes,\n sharingOnly: !writes && holdsManage && isOrgWideMember(seat),\n writesReason: site ? dataPermissionRefusal(DATA_SITE_MANAGE_PERMISSION) : DATASETS_WRITE_REFUSAL,\n deletes: beyond || !deletes,\n deletesReason: beyond\n ? deleteBeyondReachRefusal('dataset')\n : site\n ? dataPermissionRefusal(DATA_SITE_DELETE_PERMISSION)\n : DATASETS_DELETE_REFUSAL,\n records: !holdsDatasetPermission(member, DATA_VIEW_RECORDS_PERMISSION),\n exports: !holdsDatasetPermission(member, DATA_EXPORT_PERMISSION),\n }\n}\n\n/**\n * Importing into one dataset, for the Import & export hub's row (AGL-4047): the\n * same verdict the Data page's Import reads, and the transfer routes' `importAccess`.\n */\nexport function datasetInstanceImportAccess(subject: TransferInstanceImportSubject): TransferInstanceImportAnswer {\n const blocked = datasetAccessBlocked(\n subject.member as DatasetWriter,\n subject.record.facts?.['visibleTo'],\n subject.customRole as AglynOrgCustomRole | null,\n )\n return { allowed: !blocked.writes, reason: blocked.writesReason }\n}\n\n/**\n * Which dataset controls switch off with the reason named rather than failing on\n * save, for the dataset placed at `visibleTo`. Nothing is blocked until the reads\n * land, nor for a reader with no membership, who is staff. Not a security\n * boundary: the rules and routes refuse regardless.\n *\n * Costs the membership the page already reads, and one read of a custom role\n * only for a member of the whole workspace whom the site decides.\n */\nexport function useDatasetWritesBlocked(\n orgId: string | null | undefined,\n visibleTo?: unknown,\n): DatasetAccessBlocked {\n const firestore = useFirestore()\n const { data: user } = useUser()\n const uid = (user as { uid?: string } | undefined)?.uid ?? ''\n const { data: member, status } = useFirestoreDoc<DatasetWriter>(\n () => (orgId && uid ? doc(firestore, 'orgs', orgId, 'members', uid) : null),\n [firestore, orgId, uid],\n )\n const seat = (status === 'success' ? member : null) as (DatasetWriter & { roleId?: unknown }) | null | undefined\n const site = oneSitePlacement(visibleTo)\n // Only someone the site decides: narrowed on it, or on a role wider or narrower here.\n const siteDecides =\n Boolean(seat && site) &&\n isOrgWideMember(seat as Partial<AglynOrgMember>) &&\n (Boolean(siteMayNarrow(seat as Partial<AglynOrgMember>, site)) || !holdsDatasetPermission(seat as DatasetWriter, DATA_MANAGE_PERMISSION))\n const roleId = siteDecides && typeof seat?.roleId === 'string' ? seat.roleId : ''\n const role = useFirestoreDoc<AglynOrgCustomRole>(\n () => (orgId && roleId ? doc(firestore, 'orgs', orgId, 'roles', roleId) : null),\n [firestore, orgId, roleId],\n )\n if (!seat || (roleId && role.status === 'loading')) return NOTHING_BLOCKED\n return datasetAccessBlocked(seat, visibleTo, roleId && role.status === 'success' ? (role.data ?? null) : null)\n}\n"],"names":["permissionRefusalText","resolveOrgPermissions","siteMayNarrow","isOrgWideMember","deleteBeyondReach","deleteBeyondReachRefusal","oneSitePlacement","placementVerdict","resolvedPlacementKey","useFirestore","useFirestoreDoc","useUser","doc","DATA_ERASE_PERMISSION","DATA_EXPORT_PERMISSION","DATA_MANAGE_PERMISSION","DATA_SITE_DELETE_PERMISSION","DATA_SITE_MANAGE_PERMISSION","DATA_VIEW_RECORDS_PERMISSION","dataPermissionRefusal","DATASETS_WRITE_PERMISSION","DATASETS_DELETE_PERMISSION","DATASETS_WRITE_REFUSAL","DATASETS_DELETE_REFUSAL","DATASETS_VIEW_RECORDS_REFUSAL","DATASETS_EXPORT_REFUSAL","holdsDatasetPermission","member","permission","stamped","resolvedPermissions","permissions","NOTHING_BLOCKED","known","creates","writes","writesReason","sharingOnly","deletes","deletesReason","records","exports","datasetAccessBlocked","visibleTo","customRole","seat","site","workspace","hostId","beyond","holdsManage","datasetInstanceImportAccess","subject","blocked","record","facts","allowed","reason","useDatasetWritesBlocked","orgId","role","firestore","data","user","uid","status","siteDecides","Boolean","roleId"],"mappings":"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"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The plugin's DECLARATIONS (AGL-4047): the dataset keys the one permission
|
|
19
|
+
* catalog lists beside the core keys. Loaded eagerly by the console (client and
|
|
20
|
+
* server) and the tenant's server through the generated declarations manifest,
|
|
21
|
+
* so the role editor offers them, a custom role or a per-member override keeps
|
|
22
|
+
* them, and the site's stamp carries them. Light by construction: nothing here
|
|
23
|
+
* reaches a provider, Firestore or React.
|
|
24
|
+
*/
|
|
25
|
+
export declare function registerDataDeclarations(): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { registerPluginEntitlements } from "@aglyn/aglyn/plugin-manager/plugin-entitlements";
|
|
17
|
+
import { BUNDLE_ID } from "./constants/bundle-common.js";
|
|
18
|
+
import { DATA_PERMISSIONS } from "./model/dataset-access.js";
|
|
19
|
+
let declared = false;
|
|
20
|
+
/**
|
|
21
|
+
* The plugin's DECLARATIONS (AGL-4047): the dataset keys the one permission
|
|
22
|
+
* catalog lists beside the core keys. Loaded eagerly by the console (client and
|
|
23
|
+
* server) and the tenant's server through the generated declarations manifest,
|
|
24
|
+
* so the role editor offers them, a custom role or a per-member override keeps
|
|
25
|
+
* them, and the site's stamp carries them. Light by construction: nothing here
|
|
26
|
+
* reaches a provider, Firestore or React.
|
|
27
|
+
*/ export function registerDataDeclarations() {
|
|
28
|
+
if (declared) return;
|
|
29
|
+
declared = true;
|
|
30
|
+
registerPluginEntitlements({
|
|
31
|
+
pluginId: BUNDLE_ID,
|
|
32
|
+
orgPermissions: DATA_PERMISSIONS
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
registerDataDeclarations();
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=declarations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/plugins/data/src/lib/declarations.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { registerPluginEntitlements } from '@aglyn/aglyn/plugin-manager/plugin-entitlements'\nimport { BUNDLE_ID } from './constants/bundle-common'\nimport { DATA_PERMISSIONS } from './model/dataset-access'\n\nlet declared = false\n\n/**\n * The plugin's DECLARATIONS (AGL-4047): the dataset keys the one permission\n * catalog lists beside the core keys. Loaded eagerly by the console (client and\n * server) and the tenant's server through the generated declarations manifest,\n * so the role editor offers them, a custom role or a per-member override keeps\n * them, and the site's stamp carries them. Light by construction: nothing here\n * reaches a provider, Firestore or React.\n */\nexport function registerDataDeclarations(): void {\n if (declared) return\n declared = true\n registerPluginEntitlements({ pluginId: BUNDLE_ID, orgPermissions: DATA_PERMISSIONS })\n}\n\nregisterDataDeclarations()\n"],"names":["registerPluginEntitlements","BUNDLE_ID","DATA_PERMISSIONS","declared","registerDataDeclarations","pluginId","orgPermissions"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,0BAA0B,QAAQ,kDAAiD;AAC5F,SAASC,SAAS,QAAQ,+BAA2B;AACrD,SAASC,gBAAgB,QAAQ,4BAAwB;AAEzD,IAAIC,WAAW;AAEf;;;;;;;CAOC,GACD,OAAO,SAASC;IACd,IAAID,UAAU;IACdA,WAAW;IACXH,2BAA2B;QAAEK,UAAUJ;QAAWK,gBAAgBJ;IAAiB;AACrF;AAEAE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { HostAccessRole } from '@aglyn/aglyn/foundation/definitions/organization.types';
|
|
18
|
+
import type { PluginOrgPermissionDeclaration } from '@aglyn/aglyn/plugin-manager/plugin-entitlements';
|
|
19
|
+
/** The workspace key on creating and writing datasets, which also covers the CRM and lists. */
|
|
20
|
+
export declare const DATA_MANAGE_PERMISSION = "data.manage";
|
|
21
|
+
/** The workspace key on deleting a whole dataset, which also covers contacts and lists. */
|
|
22
|
+
export declare const DATA_ERASE_PERMISSION = "org.eraseRecords";
|
|
23
|
+
/** The site's verdict on writing a dataset placed on that site alone. */
|
|
24
|
+
export declare const DATA_SITE_MANAGE_PERMISSION = "data.siteManage";
|
|
25
|
+
/** The site's verdict on deleting a dataset placed on that site alone. */
|
|
26
|
+
export declare const DATA_SITE_DELETE_PERMISSION = "data.siteDelete";
|
|
27
|
+
/** Reading a dataset's records. */
|
|
28
|
+
export declare const DATA_VIEW_RECORDS_PERMISSION = "data.viewRecords";
|
|
29
|
+
/** Taking a dataset's records out as a file. */
|
|
30
|
+
export declare const DATA_EXPORT_PERMISSION = "data.export";
|
|
31
|
+
/** Who holds the site's verdict by their access to it: the site's Admin and Editor. */
|
|
32
|
+
export declare const DATA_SITE_ROLE_PRESET: Readonly<Record<HostAccessRole, boolean>>;
|
|
33
|
+
/** The keys as this plugin declares them into the permission catalog. */
|
|
34
|
+
export declare const DATA_PERMISSIONS: readonly PluginOrgPermissionDeclaration[];
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ /*
|
|
17
|
+
* WHO MAY DO WHAT TO A DATASET (AGL-4047). Roles are only presets of these.
|
|
18
|
+
*
|
|
19
|
+
* A dataset placed on exactly one site belongs to that site, and its writes
|
|
20
|
+
* answer to that site's verdict as well as the workspace's (`site-placement` in
|
|
21
|
+
* the platform core is the verdict):
|
|
22
|
+
*
|
|
23
|
+
* - "Manage this site's data" and "Delete this site's datasets" are the site's
|
|
24
|
+
* verdict. For a member of the whole workspace each follows its workspace
|
|
25
|
+
* key ("Manage data", "Delete workspace records"), so a role or a member
|
|
26
|
+
* deciding those decides these. A site that narrows an editor to Author or
|
|
27
|
+
* Viewer takes them there, unless the member keeps them ("Keep this
|
|
28
|
+
* permission") or the site grants them back. A site that raises a viewer to
|
|
29
|
+
* Admin or Editor gives them. A site collaborator holds them by their site
|
|
30
|
+
* role, refined by the site's toggle.
|
|
31
|
+
* - Holding the workspace key still admits, on any site that does not narrow
|
|
32
|
+
* the member, so a collaborator handed "Manage data" keeps what it gave them.
|
|
33
|
+
*
|
|
34
|
+
* A dataset on every site or on several answers to the workspace key alone: no
|
|
35
|
+
* one site can be asked, and a rule cannot look through a list of them.
|
|
36
|
+
*
|
|
37
|
+
* Three doors ask this, and must keep answering alike: the rule's
|
|
38
|
+
* `canWriteDatasetOn` (`firebase-firestore.rules`), the routes through
|
|
39
|
+
* `dataset-access.server.ts`, and the console through `use-dataset-writes-blocked`.
|
|
40
|
+
*/ /** The workspace key on creating and writing datasets, which also covers the CRM and lists. */ export const DATA_MANAGE_PERMISSION = 'data.manage';
|
|
41
|
+
/** The workspace key on deleting a whole dataset, which also covers contacts and lists. */ export const DATA_ERASE_PERMISSION = 'org.eraseRecords';
|
|
42
|
+
/** The site's verdict on writing a dataset placed on that site alone. */ export const DATA_SITE_MANAGE_PERMISSION = 'data.siteManage';
|
|
43
|
+
/** The site's verdict on deleting a dataset placed on that site alone. */ export const DATA_SITE_DELETE_PERMISSION = 'data.siteDelete';
|
|
44
|
+
/** Reading a dataset's records. */ export const DATA_VIEW_RECORDS_PERMISSION = 'data.viewRecords';
|
|
45
|
+
/** Taking a dataset's records out as a file. */ export const DATA_EXPORT_PERMISSION = 'data.export';
|
|
46
|
+
/** Who holds the site's verdict by their access to it: the site's Admin and Editor. */ export const DATA_SITE_ROLE_PRESET = {
|
|
47
|
+
admin: true,
|
|
48
|
+
editor: true,
|
|
49
|
+
author: false,
|
|
50
|
+
viewer: false
|
|
51
|
+
};
|
|
52
|
+
const WORKSPACE_WRITERS = {
|
|
53
|
+
owner: true,
|
|
54
|
+
admin: true,
|
|
55
|
+
editor: true,
|
|
56
|
+
viewer: false
|
|
57
|
+
};
|
|
58
|
+
const EVERY_ROLE = {
|
|
59
|
+
owner: true,
|
|
60
|
+
admin: true,
|
|
61
|
+
editor: true,
|
|
62
|
+
viewer: true
|
|
63
|
+
};
|
|
64
|
+
/** The keys as this plugin declares them into the permission catalog. */ export const DATA_PERMISSIONS = [
|
|
65
|
+
{
|
|
66
|
+
key: DATA_SITE_MANAGE_PERMISSION,
|
|
67
|
+
label: 'Manage this site’s data',
|
|
68
|
+
description: 'Change the schema and records of a dataset placed on this site alone, and import into it. Follows “Manage data” for a member of the whole workspace.',
|
|
69
|
+
roleDefaults: WORKSPACE_WRITERS,
|
|
70
|
+
hostRoleDefaults: DATA_SITE_ROLE_PRESET,
|
|
71
|
+
group: 'datasets',
|
|
72
|
+
follows: DATA_MANAGE_PERMISSION,
|
|
73
|
+
narrowsPerSite: {
|
|
74
|
+
editor: true
|
|
75
|
+
},
|
|
76
|
+
raisesPerSite: true
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
key: DATA_SITE_DELETE_PERMISSION,
|
|
80
|
+
label: 'Delete this site’s datasets',
|
|
81
|
+
description: 'Delete a dataset placed on this site alone, with its records. Follows “Delete workspace records” for a member of the whole workspace.',
|
|
82
|
+
roleDefaults: WORKSPACE_WRITERS,
|
|
83
|
+
hostRoleDefaults: DATA_SITE_ROLE_PRESET,
|
|
84
|
+
group: 'datasets',
|
|
85
|
+
follows: DATA_ERASE_PERMISSION,
|
|
86
|
+
narrowsPerSite: {
|
|
87
|
+
editor: true
|
|
88
|
+
},
|
|
89
|
+
raisesPerSite: true
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
key: DATA_VIEW_RECORDS_PERMISSION,
|
|
93
|
+
label: 'View dataset records',
|
|
94
|
+
description: 'Read the records of the datasets this member can see. Published sites show records either way.',
|
|
95
|
+
roleDefaults: EVERY_ROLE,
|
|
96
|
+
group: 'datasets'
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: DATA_EXPORT_PERMISSION,
|
|
100
|
+
label: 'Export data',
|
|
101
|
+
description: 'Take the records of the datasets this member can see out as a file. Needs “View dataset records”.',
|
|
102
|
+
roleDefaults: EVERY_ROLE,
|
|
103
|
+
group: 'datasets',
|
|
104
|
+
refines: DATA_VIEW_RECORDS_PERMISSION
|
|
105
|
+
}
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
//# sourceMappingURL=data-permissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/data/src/lib/model/data-permissions.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { HostAccessRole } from '@aglyn/aglyn/foundation/definitions/organization.types'\nimport type { PluginOrgPermissionDeclaration } from '@aglyn/aglyn/plugin-manager/plugin-entitlements'\n\n/*\n * WHO MAY DO WHAT TO A DATASET (AGL-4047). Roles are only presets of these.\n *\n * A dataset placed on exactly one site belongs to that site, and its writes\n * answer to that site's verdict as well as the workspace's (`site-placement` in\n * the platform core is the verdict):\n *\n * - \"Manage this site's data\" and \"Delete this site's datasets\" are the site's\n * verdict. For a member of the whole workspace each follows its workspace\n * key (\"Manage data\", \"Delete workspace records\"), so a role or a member\n * deciding those decides these. A site that narrows an editor to Author or\n * Viewer takes them there, unless the member keeps them (\"Keep this\n * permission\") or the site grants them back. A site that raises a viewer to\n * Admin or Editor gives them. A site collaborator holds them by their site\n * role, refined by the site's toggle.\n * - Holding the workspace key still admits, on any site that does not narrow\n * the member, so a collaborator handed \"Manage data\" keeps what it gave them.\n *\n * A dataset on every site or on several answers to the workspace key alone: no\n * one site can be asked, and a rule cannot look through a list of them.\n *\n * Three doors ask this, and must keep answering alike: the rule's\n * `canWriteDatasetOn` (`firebase-firestore.rules`), the routes through\n * `dataset-access.server.ts`, and the console through `use-dataset-writes-blocked`.\n */\n\n/** The workspace key on creating and writing datasets, which also covers the CRM and lists. */\nexport const DATA_MANAGE_PERMISSION = 'data.manage'\n/** The workspace key on deleting a whole dataset, which also covers contacts and lists. */\nexport const DATA_ERASE_PERMISSION = 'org.eraseRecords'\n/** The site's verdict on writing a dataset placed on that site alone. */\nexport const DATA_SITE_MANAGE_PERMISSION = 'data.siteManage'\n/** The site's verdict on deleting a dataset placed on that site alone. */\nexport const DATA_SITE_DELETE_PERMISSION = 'data.siteDelete'\n/** Reading a dataset's records. */\nexport const DATA_VIEW_RECORDS_PERMISSION = 'data.viewRecords'\n/** Taking a dataset's records out as a file. */\nexport const DATA_EXPORT_PERMISSION = 'data.export'\n\n/** Who holds the site's verdict by their access to it: the site's Admin and Editor. */\nexport const DATA_SITE_ROLE_PRESET: Readonly<Record<HostAccessRole, boolean>> = {\n admin: true,\n editor: true,\n author: false,\n viewer: false,\n}\n\nconst WORKSPACE_WRITERS = { owner: true, admin: true, editor: true, viewer: false } as const\nconst EVERY_ROLE = { owner: true, admin: true, editor: true, viewer: true } as const\n\n/** The keys as this plugin declares them into the permission catalog. */\nexport const DATA_PERMISSIONS: readonly PluginOrgPermissionDeclaration[] = [\n {\n key: DATA_SITE_MANAGE_PERMISSION,\n label: 'Manage this site’s data',\n description:\n 'Change the schema and records of a dataset placed on this site alone, and import into it. Follows “Manage data” for a member of the whole workspace.',\n roleDefaults: WORKSPACE_WRITERS,\n hostRoleDefaults: DATA_SITE_ROLE_PRESET,\n group: 'datasets',\n follows: DATA_MANAGE_PERMISSION,\n narrowsPerSite: { editor: true },\n raisesPerSite: true,\n },\n {\n key: DATA_SITE_DELETE_PERMISSION,\n label: 'Delete this site’s datasets',\n description:\n 'Delete a dataset placed on this site alone, with its records. Follows “Delete workspace records” for a member of the whole workspace.',\n roleDefaults: WORKSPACE_WRITERS,\n hostRoleDefaults: DATA_SITE_ROLE_PRESET,\n group: 'datasets',\n follows: DATA_ERASE_PERMISSION,\n narrowsPerSite: { editor: true },\n raisesPerSite: true,\n },\n {\n key: DATA_VIEW_RECORDS_PERMISSION,\n label: 'View dataset records',\n description: 'Read the records of the datasets this member can see. Published sites show records either way.',\n roleDefaults: EVERY_ROLE,\n group: 'datasets',\n },\n {\n key: DATA_EXPORT_PERMISSION,\n label: 'Export data',\n description: 'Take the records of the datasets this member can see out as a file. Needs “View dataset records”.',\n roleDefaults: EVERY_ROLE,\n group: 'datasets',\n refines: DATA_VIEW_RECORDS_PERMISSION,\n },\n]\n"],"names":["DATA_MANAGE_PERMISSION","DATA_ERASE_PERMISSION","DATA_SITE_MANAGE_PERMISSION","DATA_SITE_DELETE_PERMISSION","DATA_VIEW_RECORDS_PERMISSION","DATA_EXPORT_PERMISSION","DATA_SITE_ROLE_PRESET","admin","editor","author","viewer","WORKSPACE_WRITERS","owner","EVERY_ROLE","DATA_PERMISSIONS","key","label","description","roleDefaults","hostRoleDefaults","group","follows","narrowsPerSite","raisesPerSite","refines"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAKD;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,GAED,6FAA6F,GAC7F,OAAO,MAAMA,yBAAyB,cAAa;AACnD,yFAAyF,GACzF,OAAO,MAAMC,wBAAwB,mBAAkB;AACvD,uEAAuE,GACvE,OAAO,MAAMC,8BAA8B,kBAAiB;AAC5D,wEAAwE,GACxE,OAAO,MAAMC,8BAA8B,kBAAiB;AAC5D,iCAAiC,GACjC,OAAO,MAAMC,+BAA+B,mBAAkB;AAC9D,8CAA8C,GAC9C,OAAO,MAAMC,yBAAyB,cAAa;AAEnD,qFAAqF,GACrF,OAAO,MAAMC,wBAAmE;IAC9EC,OAAO;IACPC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;AACV,EAAC;AAED,MAAMC,oBAAoB;IAAEC,OAAO;IAAML,OAAO;IAAMC,QAAQ;IAAME,QAAQ;AAAM;AAClF,MAAMG,aAAa;IAAED,OAAO;IAAML,OAAO;IAAMC,QAAQ;IAAME,QAAQ;AAAK;AAE1E,uEAAuE,GACvE,OAAO,MAAMI,mBAA8D;IACzE;QACEC,KAAKb;QACLc,OAAO;QACPC,aACE;QACFC,cAAcP;QACdQ,kBAAkBb;QAClBc,OAAO;QACPC,SAASrB;QACTsB,gBAAgB;YAAEd,QAAQ;QAAK;QAC/Be,eAAe;IACjB;IACA;QACER,KAAKZ;QACLa,OAAO;QACPC,aACE;QACFC,cAAcP;QACdQ,kBAAkBb;QAClBc,OAAO;QACPC,SAASpB;QACTqB,gBAAgB;YAAEd,QAAQ;QAAK;QAC/Be,eAAe;IACjB;IACA;QACER,KAAKX;QACLY,OAAO;QACPC,aAAa;QACbC,cAAcL;QACdO,OAAO;IACT;IACA;QACEL,KAAKV;QACLW,OAAO;QACPC,aAAa;QACbC,cAAcL;QACdO,OAAO;QACPI,SAASpB;IACX;CACD,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export { DATA_ERASE_PERMISSION, DATA_EXPORT_PERMISSION, DATA_MANAGE_PERMISSION, DATA_PERMISSIONS, DATA_SITE_DELETE_PERMISSION, DATA_SITE_MANAGE_PERMISSION, DATA_SITE_ROLE_PRESET, DATA_VIEW_RECORDS_PERMISSION, } from './data-permissions';
|
|
18
|
+
/**
|
|
19
|
+
* The refusal for one of these keys, naming it, from this table rather than the
|
|
20
|
+
* live catalog: a module can ask before the declarations have registered.
|
|
21
|
+
*/
|
|
22
|
+
export declare function dataPermissionRefusal(key: string): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { permissionRefusalText } from "@aglyn/aglyn/app-utils/org-permissions";
|
|
17
|
+
import { DATA_PERMISSIONS } from "./data-permissions.js";
|
|
18
|
+
// The keys live in `data-permissions.ts`, which imports only types so that the
|
|
19
|
+
// native contracts can assemble them into `ORG_ROLE_GRANTS`.
|
|
20
|
+
export { DATA_ERASE_PERMISSION, DATA_EXPORT_PERMISSION, DATA_MANAGE_PERMISSION, DATA_PERMISSIONS, DATA_SITE_DELETE_PERMISSION, DATA_SITE_MANAGE_PERMISSION, DATA_SITE_ROLE_PRESET, DATA_VIEW_RECORDS_PERMISSION } from "./data-permissions.js";
|
|
21
|
+
/**
|
|
22
|
+
* The refusal for one of these keys, naming it, from this table rather than the
|
|
23
|
+
* live catalog: a module can ask before the declarations have registered.
|
|
24
|
+
*/ export function dataPermissionRefusal(key) {
|
|
25
|
+
var _DATA_PERMISSIONS_find;
|
|
26
|
+
const label = (_DATA_PERMISSIONS_find = DATA_PERMISSIONS.find((permission)=>permission.key === key)) == null ? void 0 : _DATA_PERMISSIONS_find.label;
|
|
27
|
+
return label ? `Your role does not include "${label}" — ask an organization admin` : permissionRefusalText(key);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=dataset-access.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/data/src/lib/model/dataset-access.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type OrgPermission, permissionRefusalText } from '@aglyn/aglyn/app-utils/org-permissions'\nimport { DATA_PERMISSIONS } from './data-permissions'\n\n// The keys live in `data-permissions.ts`, which imports only types so that the\n// native contracts can assemble them into `ORG_ROLE_GRANTS`.\nexport {\n DATA_ERASE_PERMISSION,\n DATA_EXPORT_PERMISSION,\n DATA_MANAGE_PERMISSION,\n DATA_PERMISSIONS,\n DATA_SITE_DELETE_PERMISSION,\n DATA_SITE_MANAGE_PERMISSION,\n DATA_SITE_ROLE_PRESET,\n DATA_VIEW_RECORDS_PERMISSION,\n} from './data-permissions'\n\n/**\n * The refusal for one of these keys, naming it, from this table rather than the\n * live catalog: a module can ask before the declarations have registered.\n */\nexport function dataPermissionRefusal(key: string): string {\n const label = DATA_PERMISSIONS.find((permission) => permission.key === key)?.label\n return label ? `Your role does not include \"${label}\" — ask an organization admin` : permissionRefusalText(key as OrgPermission)\n}\n"],"names":["permissionRefusalText","DATA_PERMISSIONS","DATA_ERASE_PERMISSION","DATA_EXPORT_PERMISSION","DATA_MANAGE_PERMISSION","DATA_SITE_DELETE_PERMISSION","DATA_SITE_MANAGE_PERMISSION","DATA_SITE_ROLE_PRESET","DATA_VIEW_RECORDS_PERMISSION","dataPermissionRefusal","key","label","find","permission"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAA6BA,qBAAqB,QAAQ,yCAAwC;AAClG,SAASC,gBAAgB,QAAQ,wBAAoB;AAErD,+EAA+E;AAC/E,6DAA6D;AAC7D,SACEC,qBAAqB,EACrBC,sBAAsB,EACtBC,sBAAsB,EACtBH,gBAAgB,EAChBI,2BAA2B,EAC3BC,2BAA2B,EAC3BC,qBAAqB,EACrBC,4BAA4B,QACvB,wBAAoB;AAE3B;;;CAGC,GACD,OAAO,SAASC,sBAAsBC,GAAW;QACjCT;IAAd,MAAMU,SAAQV,yBAAAA,iBAAiBW,IAAI,CAAC,CAACC,aAAeA,WAAWH,GAAG,KAAKA,yBAAzDT,uBAA+DU,KAAK;IAClF,OAAOA,QAAQ,CAAC,4BAA4B,EAAEA,MAAM,6BAA6B,CAAC,GAAGX,sBAAsBU;AAC7G"}
|
package/src/lib/plugin.js
CHANGED
|
@@ -15,6 +15,7 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/ import HostDatasetsCard from "./components/host-datasets-card.component.js";
|
|
18
|
+
import { datasetInstanceImportAccess } from "./components/use-dataset-writes-blocked.js";
|
|
18
19
|
import * as Aglyn from "@aglyn/aglyn";
|
|
19
20
|
import { registerRepeatSource } from "@aglyn/aglyn/app-utils/repeat-sources";
|
|
20
21
|
import { mdiDatabaseOutline } from "@aglyn/shared-data-mdi";
|
|
@@ -77,12 +78,14 @@ import RecordTemplateSection from "./record-pages/record-template-section.compon
|
|
|
77
78
|
// A dataset's records in the import wizard and the export dialog
|
|
78
79
|
// (AGL-3530); the Data card names the dataset when it opens them.
|
|
79
80
|
registerPluginTransferResourceUi(DATASET_TRANSFER_RESOURCE, // The Import & export hub lists each dataset from the `dataset` record list (AGL-3535).
|
|
81
|
+
// Its Import there answers as this one's does on the Data page (AGL-4047).
|
|
80
82
|
{
|
|
81
83
|
label: 'Dataset records',
|
|
82
84
|
icon: {
|
|
83
85
|
path: mdiDatabaseOutline.path
|
|
84
86
|
},
|
|
85
|
-
instancesFrom: 'dataset'
|
|
87
|
+
instancesFrom: 'dataset',
|
|
88
|
+
instanceImportAccess: datasetInstanceImportAccess
|
|
86
89
|
}, {
|
|
87
90
|
pluginId: BUNDLE_ID
|
|
88
91
|
});
|