@bevel-software/platform-core-backend 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/core-ports.d.ts +11 -1
- package/dist/core/core-ports.d.ts.map +1 -1
- package/dist/core/core-ports.js.map +1 -1
- package/dist/core/create-core-server.d.ts +3 -3
- package/dist/core/create-core-server.d.ts.map +1 -1
- package/dist/core/create-core-server.js +30 -11
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +9 -2
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +112 -23
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/core/lifecycle.d.ts +34 -1
- package/dist/core/lifecycle.d.ts.map +1 -1
- package/dist/core/lifecycle.js +89 -13
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core-config.d.ts +0 -12
- package/dist/core-config.d.ts.map +1 -1
- package/dist/core-config.js +11 -13
- package/dist/core-config.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/access/access-control.interface.d.ts +42 -12
- package/dist/modules/access/access-control.interface.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.d.ts +67 -10
- package/dist/modules/access/access-control.service.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.js +214 -35
- package/dist/modules/access/access-control.service.js.map +1 -1
- package/dist/modules/access/access.routes.d.ts.map +1 -1
- package/dist/modules/access/access.routes.js +13 -15
- package/dist/modules/access/access.routes.js.map +1 -1
- package/dist/modules/auth/account-admission.d.ts +58 -7
- package/dist/modules/auth/account-admission.d.ts.map +1 -1
- package/dist/modules/auth/account-admission.js +44 -1
- package/dist/modules/auth/account-admission.js.map +1 -1
- package/dist/modules/auth/account.routes.d.ts +1 -1
- package/dist/modules/auth/account.routes.d.ts.map +1 -1
- package/dist/modules/auth/account.routes.js +61 -5
- package/dist/modules/auth/account.routes.js.map +1 -1
- package/dist/modules/auth/auth.middleware.d.ts +1 -1
- package/dist/modules/auth/auth.middleware.d.ts.map +1 -1
- package/dist/modules/auth/auth.middleware.js +18 -7
- package/dist/modules/auth/auth.middleware.js.map +1 -1
- package/dist/modules/auth/auth.routes.d.ts.map +1 -1
- package/dist/modules/auth/auth.routes.js +8 -0
- package/dist/modules/auth/auth.routes.js.map +1 -1
- package/dist/modules/auth/auth.service.d.ts +70 -2
- package/dist/modules/auth/auth.service.d.ts.map +1 -1
- package/dist/modules/auth/auth.service.js +176 -7
- package/dist/modules/auth/auth.service.js.map +1 -1
- package/dist/modules/auth/oidc-auth-provider.d.ts.map +1 -1
- package/dist/modules/auth/oidc-auth-provider.js +7 -2
- package/dist/modules/auth/oidc-auth-provider.js.map +1 -1
- package/dist/modules/database/core-schema.d.ts +41 -24
- package/dist/modules/database/core-schema.d.ts.map +1 -1
- package/dist/modules/database/core-schema.js +35 -27
- package/dist/modules/database/core-schema.js.map +1 -1
- package/dist/modules/kb-fs/branch-name.d.ts.map +1 -1
- package/dist/modules/kb-fs/branch-name.js +12 -2
- package/dist/modules/kb-fs/branch-name.js.map +1 -1
- package/dist/modules/kb-fs/repo-path.d.ts +11 -16
- package/dist/modules/kb-fs/repo-path.d.ts.map +1 -1
- package/dist/modules/kb-fs/repo-path.js +79 -0
- package/dist/modules/kb-fs/repo-path.js.map +1 -1
- package/dist/modules/kb-sync/kb-sync.routes.d.ts +2 -2
- package/dist/modules/kb-sync/kb-sync.routes.d.ts.map +1 -1
- package/dist/modules/kb-sync/kb-sync.routes.js +14 -3
- package/dist/modules/kb-sync/kb-sync.routes.js.map +1 -1
- package/dist/modules/kb-sync/sync-auth.d.ts +3 -1
- package/dist/modules/kb-sync/sync-auth.d.ts.map +1 -1
- package/dist/modules/kb-sync/sync-auth.js +1 -1
- package/dist/modules/kb-sync/sync-auth.js.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.d.ts.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.js +21 -6
- package/dist/modules/mcp/mcp-auth.middleware.js.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js +3 -2
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -1
- package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
- package/dist/modules/settings/deployment-settings.service.js +8 -3
- package/dist/modules/settings/deployment-settings.service.js.map +1 -1
- package/dist/modules/settings/setup.routes.d.ts +52 -1
- package/dist/modules/settings/setup.routes.d.ts.map +1 -1
- package/dist/modules/settings/setup.routes.js +207 -19
- package/dist/modules/settings/setup.routes.js.map +1 -1
- package/dist/modules/skills/skills.contract.d.ts +90 -18
- package/dist/modules/skills/skills.contract.d.ts.map +1 -1
- package/dist/modules/skills/skills.contract.js +4 -1
- package/dist/modules/skills/skills.contract.js.map +1 -1
- package/dist/modules/skills/skills.service.d.ts +98 -9
- package/dist/modules/skills/skills.service.d.ts.map +1 -1
- package/dist/modules/skills/skills.service.js +239 -37
- package/dist/modules/skills/skills.service.js.map +1 -1
- package/dist/modules/skills/skills.tools.d.ts +7 -0
- package/dist/modules/skills/skills.tools.d.ts.map +1 -1
- package/dist/modules/skills/skills.tools.js +71 -7
- package/dist/modules/skills/skills.tools.js.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.js +4 -2
- package/dist/modules/tool-auth/external-api-key.service.js.map +1 -1
- package/dist/modules/tool-auth/internal-token.service.d.ts +3 -3
- package/dist/modules/tool-auth/tool-auth.middleware.d.ts +16 -7
- package/dist/modules/tool-auth/tool-auth.middleware.d.ts.map +1 -1
- package/dist/modules/tool-auth/tool-auth.middleware.js +34 -12
- package/dist/modules/tool-auth/tool-auth.middleware.js.map +1 -1
- package/dist/modules/tool-helpers/tool-handler.d.ts +2 -1
- package/dist/modules/tool-helpers/tool-handler.d.ts.map +1 -1
- package/dist/modules/tool-helpers/tool-handler.js +25 -4
- package/dist/modules/tool-helpers/tool-handler.js.map +1 -1
- package/dist/modules/tool-helpers/tool.contract.d.ts +3 -2
- package/dist/modules/tool-helpers/tool.contract.d.ts.map +1 -1
- package/dist/modules/tool-helpers/tool.contract.js.map +1 -1
- package/dist/modules/tool-helpers/validate-token.js +1 -1
- package/dist/modules/tool-helpers/validate-token.js.map +1 -1
- package/dist/modules/workflow/agent-tools/change-request-summary.d.ts +98 -0
- package/dist/modules/workflow/agent-tools/change-request-summary.d.ts.map +1 -0
- package/dist/modules/workflow/agent-tools/change-request-summary.js +81 -0
- package/dist/modules/workflow/agent-tools/change-request-summary.js.map +1 -0
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +1 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.js +75 -35
- package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -1
- package/dist/modules/workflow/file-lock.service.d.ts +24 -0
- package/dist/modules/workflow/file-lock.service.d.ts.map +1 -1
- package/dist/modules/workflow/file-lock.service.js +30 -0
- package/dist/modules/workflow/file-lock.service.js.map +1 -1
- package/dist/modules/workflow/git/git.service.d.ts +69 -0
- package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/git.service.js +153 -2
- package/dist/modules/workflow/git/git.service.js.map +1 -1
- package/dist/modules/workflow/pending-commits.service.d.ts +38 -0
- package/dist/modules/workflow/pending-commits.service.d.ts.map +1 -1
- package/dist/modules/workflow/pending-commits.service.js +55 -0
- package/dist/modules/workflow/pending-commits.service.js.map +1 -1
- package/dist/modules/workflow/workflow-hooks.d.ts +54 -32
- package/dist/modules/workflow/workflow-hooks.d.ts.map +1 -1
- package/dist/modules/workflow/workflow-hooks.js +16 -1
- package/dist/modules/workflow/workflow-hooks.js.map +1 -1
- package/dist/modules/workflow/workflow.service.d.ts +60 -6
- package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.service.js +111 -4
- package/dist/modules/workflow/workflow.service.js.map +1 -1
- package/dist/modules/workspace/agent-access.gate.d.ts +94 -0
- package/dist/modules/workspace/agent-access.gate.d.ts.map +1 -0
- package/dist/modules/workspace/agent-access.gate.js +123 -0
- package/dist/modules/workspace/agent-access.gate.js.map +1 -0
- package/dist/modules/workspace/routine-write-policy.d.ts +5 -6
- package/dist/modules/workspace/routine-write-policy.d.ts.map +1 -1
- package/dist/modules/workspace/routine-write-policy.js +5 -6
- package/dist/modules/workspace/routine-write-policy.js.map +1 -1
- package/dist/modules/workspace/session-sink.d.ts +5 -5
- package/dist/modules/workspace/set-aside-clone.d.ts +46 -0
- package/dist/modules/workspace/set-aside-clone.d.ts.map +1 -0
- package/dist/modules/workspace/set-aside-clone.js +92 -0
- package/dist/modules/workspace/set-aside-clone.js.map +1 -0
- package/dist/modules/workspace/startup/kb-startup-runner.d.ts +59 -9
- package/dist/modules/workspace/startup/kb-startup-runner.d.ts.map +1 -1
- package/dist/modules/workspace/startup/kb-startup-runner.js +65 -24
- package/dist/modules/workspace/startup/kb-startup-runner.js.map +1 -1
- package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.routes.js +92 -3
- package/dist/modules/workspace/workspace.routes.js.map +1 -1
- package/dist/modules/workspace/workspace.service.d.ts +115 -5
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +255 -25
- package/dist/modules/workspace/workspace.service.js.map +1 -1
- package/dist/modules/workspace/workspace.tools.d.ts +2 -2
- package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.tools.js +309 -115
- package/dist/modules/workspace/workspace.tools.js.map +1 -1
- package/dist/modules/write-access/write-access.d.ts +60 -0
- package/dist/modules/write-access/write-access.d.ts.map +1 -0
- package/dist/modules/write-access/write-access.js +129 -0
- package/dist/modules/write-access/write-access.js.map +1 -0
- package/dist/shared/domain-errors.d.ts +25 -0
- package/dist/shared/domain-errors.d.ts.map +1 -1
- package/dist/shared/domain-errors.js +28 -0
- package/dist/shared/domain-errors.js.map +1 -1
- package/dist/shared/git.contract.d.ts +20 -0
- package/dist/shared/git.contract.d.ts.map +1 -1
- package/dist/shared/git.contract.js +26 -0
- package/dist/shared/git.contract.js.map +1 -1
- package/dist/tenancy/static-tenant-source.d.ts +0 -1
- package/dist/tenancy/static-tenant-source.d.ts.map +1 -1
- package/dist/tenancy/static-tenant-source.js +0 -2
- package/dist/tenancy/static-tenant-source.js.map +1 -1
- package/migrations/0014_change_request_closed_reason.sql +1 -0
- package/migrations/0015_account_deactivation.sql +3 -0
- package/migrations/meta/0014_snapshot.json +2265 -0
- package/migrations/meta/0015_snapshot.json +2271 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +3 -3
- package/src/__tests__/kb-layout-config.test.ts +0 -2
- package/src/__tests__/retired-settings.test.ts +96 -0
- package/src/core/__tests__/gated-boot.test.ts +132 -0
- package/src/core/__tests__/lifecycle.test.ts +170 -1
- package/src/core/__tests__/set-aside-root-is-one-place.test.ts +63 -0
- package/src/core/core-ports.ts +11 -1
- package/src/core/create-core-server.ts +32 -14
- package/src/core/create-core-services.ts +129 -23
- package/src/core/lifecycle.ts +98 -13
- package/src/core-config.ts +13 -14
- package/src/index.ts +12 -1
- package/src/modules/access/__tests__/access-control.preview-relocation.test.ts +385 -0
- package/src/modules/access/__tests__/access-control.prospective.test.ts +94 -18
- package/src/modules/access/__tests__/access.routes.prospective.test.ts +6 -7
- package/src/modules/access/access-control.interface.ts +43 -12
- package/src/modules/access/access-control.service.ts +234 -36
- package/src/modules/access/access.routes.ts +13 -15
- package/src/modules/agent-instructions/__tests__/agent-instructions.route.test.ts +3 -1
- package/src/modules/auth/__tests__/account-deactivation.test.ts +252 -0
- package/src/modules/auth/__tests__/account.routes.test.ts +81 -3
- package/src/modules/auth/__tests__/auth.middleware.test.ts +45 -22
- package/src/modules/auth/__tests__/auth.service.test.ts +1 -1
- package/src/modules/auth/account-admission.ts +78 -9
- package/src/modules/auth/account.routes.ts +63 -7
- package/src/modules/auth/auth.middleware.ts +19 -8
- package/src/modules/auth/auth.routes.ts +8 -0
- package/src/modules/auth/auth.service.ts +179 -6
- package/src/modules/auth/oidc-auth-provider.ts +7 -2
- package/src/modules/database/core-schema.ts +35 -27
- package/src/modules/kb-fs/__tests__/branch-name.test.ts +10 -0
- package/src/modules/kb-fs/__tests__/repo-path.test.ts +123 -0
- package/src/modules/kb-fs/branch-name.ts +14 -1
- package/src/modules/kb-fs/repo-path.ts +85 -0
- package/src/modules/kb-sync/__tests__/kb-sync.routes.test.ts +26 -1
- package/src/modules/kb-sync/kb-sync.routes.ts +14 -4
- package/src/modules/kb-sync/sync-auth.ts +2 -2
- package/src/modules/mcp/__tests__/mcp-auth.middleware.test.ts +60 -3
- package/src/modules/mcp/__tests__/mcp.service.test.ts +68 -6
- package/src/modules/mcp/mcp-auth.middleware.ts +20 -6
- package/src/modules/mcp/oauth/bevel-oauth-provider.ts +3 -1
- package/src/modules/plugins/__tests__/plugins.tools.test.ts +2 -1
- package/src/modules/settings/__tests__/deployment-settings.service.test.ts +16 -0
- package/src/modules/settings/__tests__/setup.routes.git-mode.test.ts +91 -58
- package/src/modules/settings/__tests__/setup.routes.github-app.test.ts +25 -8
- package/src/modules/settings/__tests__/setup.routes.managed-phase.test.ts +14 -11
- package/src/modules/settings/__tests__/setup.routes.repository-change.test.ts +390 -0
- package/src/modules/settings/__tests__/setup.routes.test.ts +3 -0
- package/src/modules/settings/deployment-settings.service.ts +8 -3
- package/src/modules/settings/setup.routes.ts +263 -19
- package/src/modules/skills/__tests__/allowed-tools-warn.tools.test.ts +2 -1
- package/src/modules/skills/__tests__/branch-skills.tools.test.ts +218 -0
- package/src/modules/skills/__tests__/skills.service.test.ts +229 -5
- package/src/modules/skills/skills.contract.ts +91 -18
- package/src/modules/skills/skills.service.ts +278 -41
- package/src/modules/skills/skills.tools.ts +80 -8
- package/src/modules/tool-auth/__tests__/manual-auth.middleware.test.ts +14 -1
- package/src/modules/tool-auth/external-api-key.service.ts +4 -2
- package/src/modules/tool-auth/internal-token.service.ts +3 -3
- package/src/modules/tool-auth/tool-auth.middleware.ts +34 -11
- package/src/modules/tool-helpers/__tests__/agent-roles-write.test.ts +5 -3
- package/src/modules/tool-helpers/__tests__/phase4-tools.test.ts +3 -3
- package/src/modules/tool-helpers/__tests__/validate-token.test.ts +11 -1
- package/src/modules/tool-helpers/tool-handler.ts +24 -4
- package/src/modules/tool-helpers/tool.contract.ts +3 -2
- package/src/modules/tool-helpers/validate-token.ts +1 -1
- package/src/modules/workflow/__tests__/pending-commits.repository-replaced.test.ts +111 -0
- package/src/modules/workflow/__tests__/workflow.routes.history-read-gate.test.ts +25 -0
- package/src/modules/workflow/__tests__/workflow.service.repository-replaced.test.ts +249 -0
- package/src/modules/workflow/agent-tools/__tests__/workflow.tools.test.ts +264 -6
- package/src/modules/workflow/agent-tools/change-request-summary.ts +182 -0
- package/src/modules/workflow/agent-tools/workflow.tools.ts +86 -35
- package/src/modules/workflow/file-lock.service.ts +31 -0
- package/src/modules/workflow/git/__tests__/git.service.fileBytesAtCommit.test.ts +260 -0
- package/src/modules/workflow/git/git.service.ts +168 -0
- package/src/modules/workflow/pending-commits.service.ts +59 -1
- package/src/modules/workflow/workflow-hooks.ts +64 -26
- package/src/modules/workflow/workflow.service.ts +121 -4
- package/src/modules/workspace/__tests__/agent-access.gate.test.ts +208 -0
- package/src/modules/workspace/__tests__/escape-sequences.routes.test.ts +384 -0
- package/src/modules/workspace/__tests__/file-stat-access.test.ts +2 -1
- package/src/modules/workspace/__tests__/git-internals.security.test.ts +2 -1
- package/src/modules/workspace/__tests__/set-aside-clone.test.ts +52 -0
- package/src/modules/workspace/__tests__/workspace.routes.at-ref.test.ts +305 -0
- package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +2 -0
- package/src/modules/workspace/__tests__/workspace.service.forget-clone-races.test.ts +147 -0
- package/src/modules/workspace/__tests__/workspace.service.replaced-repository.test.ts +326 -0
- package/src/modules/workspace/__tests__/workspace.service.test.ts +20 -9
- package/src/modules/workspace/__tests__/workspace.tools.agents-file.test.ts +2 -3
- package/src/modules/workspace/__tests__/workspace.tools.branch-errors.test.ts +2 -3
- package/src/modules/workspace/__tests__/workspace.tools.test.ts +685 -14
- package/src/modules/workspace/agent-access.gate.ts +164 -0
- package/src/modules/workspace/routine-write-policy.ts +5 -6
- package/src/modules/workspace/session-sink.ts +5 -5
- package/src/modules/workspace/set-aside-clone.ts +96 -0
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.test.ts +86 -0
- package/src/modules/workspace/startup/kb-startup-runner.ts +115 -34
- package/src/modules/workspace/workspace.routes.ts +95 -3
- package/src/modules/workspace/workspace.service.ts +256 -24
- package/src/modules/workspace/workspace.tools.ts +338 -119
- package/src/modules/write-access/__tests__/write-access.test.ts +248 -0
- package/src/modules/write-access/write-access.ts +153 -0
- package/src/shared/domain-errors.ts +31 -0
- package/src/shared/git.contract.ts +27 -0
- package/src/tenancy/__tests__/static-tenant-source.test.ts +0 -1
- package/src/tenancy/static-tenant-source.ts +0 -3
- package/dist/modules/workflow/session-ontology.policy.d.ts +0 -52
- package/dist/modules/workflow/session-ontology.policy.d.ts.map +0 -1
- package/dist/modules/workflow/session-ontology.policy.js +0 -62
- package/dist/modules/workflow/session-ontology.policy.js.map +0 -1
- package/dist/modules/workflow/session-ontology.service.d.ts +0 -105
- package/dist/modules/workflow/session-ontology.service.d.ts.map +0 -1
- package/dist/modules/workflow/session-ontology.service.js +0 -147
- package/dist/modules/workflow/session-ontology.service.js.map +0 -1
- package/dist/modules/workspace/session-ontology.gate.d.ts +0 -114
- package/dist/modules/workspace/session-ontology.gate.d.ts.map +0 -1
- package/dist/modules/workspace/session-ontology.gate.js +0 -161
- package/dist/modules/workspace/session-ontology.gate.js.map +0 -1
- package/dist/shared/kb-layout.d.ts +0 -39
- package/dist/shared/kb-layout.d.ts.map +0 -1
- package/dist/shared/kb-layout.js +0 -103
- package/dist/shared/kb-layout.js.map +0 -1
- package/dist/shared/kb-layout.test.d.ts +0 -2
- package/dist/shared/kb-layout.test.d.ts.map +0 -1
- package/dist/shared/kb-layout.test.js +0 -75
- package/dist/shared/kb-layout.test.js.map +0 -1
- package/src/modules/workflow/__tests__/session-ontology.policy.test.ts +0 -62
- package/src/modules/workflow/__tests__/session-ontology.service.test.ts +0 -201
- package/src/modules/workflow/session-ontology.policy.ts +0 -70
- package/src/modules/workflow/session-ontology.service.ts +0 -183
- package/src/modules/workspace/__tests__/session-ontology.gate.test.ts +0 -239
- package/src/modules/workspace/session-ontology.gate.ts +0 -191
- package/src/shared/kb-layout.test.ts +0 -98
- package/src/shared/kb-layout.ts +0 -102
|
@@ -93,13 +93,20 @@ export type PathHolders = {
|
|
|
93
93
|
write: HolderList;
|
|
94
94
|
};
|
|
95
95
|
/**
|
|
96
|
-
* One file's holders where it is now and where a move would put
|
|
97
|
-
* {@link IAccessControl.prospectiveHolders}.
|
|
96
|
+
* One file's or folder's holders where it is now and where a move would put
|
|
97
|
+
* it — see {@link IAccessControl.prospectiveHolders}.
|
|
98
98
|
*/
|
|
99
99
|
export type ProspectiveHolders = {
|
|
100
100
|
before: PathHolders;
|
|
101
101
|
after: PathHolders;
|
|
102
102
|
};
|
|
103
|
+
/** One caller's own verdict per access verb on one path. */
|
|
104
|
+
export type PathVerbs = {
|
|
105
|
+
read: boolean;
|
|
106
|
+
write: boolean;
|
|
107
|
+
download: boolean;
|
|
108
|
+
owner: boolean;
|
|
109
|
+
};
|
|
103
110
|
/**
|
|
104
111
|
* Per-verb sources of a principal's access on a target. Only verbs the principal
|
|
105
112
|
* actually holds (via a named file entry) appear; each maps to the closest-first
|
|
@@ -316,21 +323,44 @@ export interface IAccessControl {
|
|
|
316
323
|
}[];
|
|
317
324
|
}>;
|
|
318
325
|
/**
|
|
319
|
-
* Who can open and who can edit one file where it IS, and where a
|
|
320
|
-
* would put it. `toPath` names a path that does not exist yet — the
|
|
321
|
-
* of the call is to answer before the move happens — so the
|
|
322
|
-
*
|
|
323
|
-
*
|
|
326
|
+
* Who can open and who can edit one file or folder where it IS, and where a
|
|
327
|
+
* move would put it. `toPath` names a path that does not exist yet — the
|
|
328
|
+
* point of the call is to answer before the move happens — so the
|
|
329
|
+
* resolution is over what travels with the bytes: a file's OWN rules (its
|
|
330
|
+
* frontmatter, read from `fromPath`) layered over the destination's folder
|
|
331
|
+
* chain, or a folder's `access.md` files keyed at the directories they
|
|
332
|
+
* land in. Either way the rules the source inherited from its old parent
|
|
333
|
+
* are left behind and the new parent's apply.
|
|
324
334
|
*
|
|
325
335
|
* Writes nothing and moves nothing. The move confirmation diffs the two
|
|
326
336
|
* sides to name who loses and who gains access.
|
|
327
|
-
*
|
|
328
|
-
* A FILE question only: a `fromPath` that is a directory is refused with a
|
|
329
|
-
* 400. A folder's access is its own `access.md` — which moves with it and
|
|
330
|
-
* governs everything beneath it — so resolving it as a file would name the
|
|
331
|
-
* wrong principals with the same confidence as the right ones.
|
|
332
337
|
*/
|
|
333
338
|
prospectiveHolders(workspaceId: string, fromPath: string, toPath: string): Promise<ProspectiveHolders>;
|
|
339
|
+
/**
|
|
340
|
+
* The CALLER'S OWN `{ read, write, download, owner }` at `toPath` as they
|
|
341
|
+
* will be once `fromPath` has been moved (`sourceRemains: false`, the
|
|
342
|
+
* default) or copied (`sourceRemains: true`) there — the question a move's
|
|
343
|
+
* or copy's dry run asks, which the same four gates at `toPath` cannot
|
|
344
|
+
* answer because what travels with the bytes is not at the destination yet:
|
|
345
|
+
* the `access.md` files inside a folder, keyed at the directories they land
|
|
346
|
+
* in, and a file's own frontmatter.
|
|
347
|
+
*
|
|
348
|
+
* What a single file's rules GOVERN follows the name it lands under, not the
|
|
349
|
+
* one it leaves: landing as a directory's `access.md` they are that
|
|
350
|
+
* directory's rules (so copying `Sales/access.md` to `Legal/access.md`
|
|
351
|
+
* previews the access `Legal/` is about to have), and landing under any
|
|
352
|
+
* other name they are the file's own and govern nothing but it. Either way
|
|
353
|
+
* the answer is the one the gates will give a moment later.
|
|
354
|
+
*
|
|
355
|
+
* PREVIEW ONLY. It describes a tree that does not exist, so it must never
|
|
356
|
+
* decide whether an operation may run: the gates keep resolving against the
|
|
357
|
+
* tree that does. It writes nothing and moves nothing, and it answers the
|
|
358
|
+
* caller's own verbs only — never the content of an `access.md` they may
|
|
359
|
+
* not read.
|
|
360
|
+
*/
|
|
361
|
+
previewAccessAfterRelocation(workspaceId: string, userEmail: string, fromPath: string, toPath: string, opts?: {
|
|
362
|
+
sourceRemains?: boolean;
|
|
363
|
+
}): Promise<PathVerbs>;
|
|
334
364
|
/**
|
|
335
365
|
* Finite expanded email set for configured users who could approve this path
|
|
336
366
|
* — role members + direct user grants, minus anyone denied. The built-in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-control.interface.d.ts","sourceRoot":"","sources":["../../../src/modules/access/access-control.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,EAAE,CAAC;AAExC,mFAAmF;AACnF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEjD,kFAAkF;AAClF,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,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AAE,MAAM,EAAE,CAAC;KACtB,CAAC,CAAC;IAEH;;;;;;;OAOG;IACH,mBAAmB,CACjB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC;QACT,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;QACjC,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KAC1C,CAAC,CAAC;IAEH
|
|
1
|
+
{"version":3,"file":"access-control.interface.d.ts","sourceRoot":"","sources":["../../../src/modules/access/access-control.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,EAAE,CAAC;AAExC,mFAAmF;AACnF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEjD,kFAAkF;AAClF,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;CAAE,CAAC;AAEpF;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACjC,KAAK,EAAE,M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E,MAAM,GACnB,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAEjF;;;;;OAKG;IACH,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9E;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,sBAAsB,CACpB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,uBAAuB,EAAE,MAAM,GAC9B,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB;;;;;;;OAOG;IACH,4BAA4B,CAC1B,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EAAE,GACtB,OAAO,CAAC,GAAG,CACZ,MAAM,EACN;QACE,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QACzC,4EAA4E;QAC5E,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB;;;;;WAKG;QACH,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;KAC9B,CACF,GAAG,IAAI,CAAC,CAAC;CACX"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ITreeWalker } from '../../shared/fs.contract.js';
|
|
2
2
|
import { type IGitRunner } from '../../shared/git.contract.js';
|
|
3
3
|
import type { WorkspaceService } from '../workspace/workspace.service.js';
|
|
4
|
-
import type { IAccessControl, AccessDecision, AccessTargetKind, DenialSources, GrantPrincipal, GrantSources, ProspectiveHolders, ResolvedPrincipal } from './access-control.interface.js';
|
|
4
|
+
import type { IAccessControl, AccessDecision, AccessTargetKind, DenialSources, GrantPrincipal, GrantSources, PathVerbs, ProspectiveHolders, ResolvedPrincipal } from './access-control.interface.js';
|
|
5
5
|
import type { KbContext } from '../../shared/kb-context.js';
|
|
6
6
|
import { type GroupsIndex } from '../access-model/group-files.js';
|
|
7
7
|
import { type Verb } from '../access-model/access-grammar.js';
|
|
@@ -235,18 +235,48 @@ export declare class AccessControlService implements IAccessControl {
|
|
|
235
235
|
}[];
|
|
236
236
|
}>;
|
|
237
237
|
/**
|
|
238
|
-
* The read and write holders of one file at its current path and
|
|
239
|
-
* it has not moved to yet (see the interface).
|
|
238
|
+
* The read and write holders of one file or folder at its current path and
|
|
239
|
+
* at a path it has not moved to yet (see the interface).
|
|
240
240
|
*
|
|
241
|
-
* A move changes nothing about the
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
241
|
+
* A move changes nothing about what the thing itself carries — a file's
|
|
242
|
+
* frontmatter and a folder's `access.md` files travel with the bytes — and
|
|
243
|
+
* everything about the folder chain above it. So the hypothetical side is
|
|
244
|
+
* the ordinary resolution at the destination path, over what travels:
|
|
245
|
+
*
|
|
246
|
+
* - a FILE's own-entries, read from the SOURCE (nothing sits at the
|
|
247
|
+
* destination to read) and parsed as the name they LAND under, layered
|
|
248
|
+
* over the destination's ancestors — the two sides can differ, because
|
|
249
|
+
* the same frontmatter is a folder's rules in an `access.md` and the
|
|
250
|
+
* file's own anywhere else;
|
|
251
|
+
* - a FOLDER's `access.md` files, keyed at the directories they land in,
|
|
252
|
+
* and a file landing as a directory's `access.md` at the directory it
|
|
253
|
+
* lands in (`withRelocatedAccessFiles`). A folder has no frontmatter of
|
|
254
|
+
* its own, so it passes none.
|
|
255
|
+
*
|
|
256
|
+
* One model load and one file read serve all four lookups.
|
|
248
257
|
*/
|
|
249
258
|
prospectiveHolders(workspaceId: string, fromPath: string, toPath: string): Promise<ProspectiveHolders>;
|
|
259
|
+
/**
|
|
260
|
+
* The caller's own verbs at `toPath` as they will be once `fromPath` has
|
|
261
|
+
* been moved or copied there (see the interface).
|
|
262
|
+
*
|
|
263
|
+
* Identical to asking `canRead`/`canWrite`/`canDownload`/`canOwner` at
|
|
264
|
+
* `toPath` whenever nothing travels — an ordinary file with no rules of its
|
|
265
|
+
* own, or a folder with no `access.md` of its own — so the cases this was
|
|
266
|
+
* not written for answer exactly as they always did.
|
|
267
|
+
*
|
|
268
|
+
* What travels is what `prospectiveHolders` says travels, and for the same
|
|
269
|
+
* reason: the preview and the dialog's holder lists must not disagree about
|
|
270
|
+
* one move. A file's own-entries come from the SOURCE, where the bytes
|
|
271
|
+
* carrying them still are — asking the destination, which does not exist
|
|
272
|
+
* yet, always answered null and so dropped the frontmatter a rename hands
|
|
273
|
+
* straight back (requirement 6: what the caller has afterwards equals what
|
|
274
|
+
* the preview said) — and they are parsed as the name they LAND under,
|
|
275
|
+
* because that is the parse the gates will use a moment later.
|
|
276
|
+
*/
|
|
277
|
+
previewAccessAfterRelocation(workspaceId: string, userEmail: string, fromPath: string, toPath: string, opts?: {
|
|
278
|
+
sourceRemains?: boolean;
|
|
279
|
+
}): Promise<PathVerbs>;
|
|
250
280
|
eligibleWriterEmails(workspaceId: string, relativePath: string): Promise<Map<string, {
|
|
251
281
|
name: string;
|
|
252
282
|
email: string;
|
|
@@ -327,6 +357,33 @@ export declare class AccessControlService implements IAccessControl {
|
|
|
327
357
|
* its frontmatter IS the folder rules the dir chain already applies.
|
|
328
358
|
*/
|
|
329
359
|
private readOwnEntries;
|
|
360
|
+
/**
|
|
361
|
+
* What a move or a copy of `fromPath` to `toPath` CARRIES — the one disk
|
|
362
|
+
* read both preview surfaces need:
|
|
363
|
+
*
|
|
364
|
+
* - `isFolder`: the source is a folder, so the `access.md` files under it
|
|
365
|
+
* travel, keyed at the directories they land in;
|
|
366
|
+
* - `ownHere` / `ownThere`: a file's own-entries as the SOURCE's name reads
|
|
367
|
+
* them and as the DESTINATION's name will. They differ because the same
|
|
368
|
+
* frontmatter means two things by name (see `ownEntriesFromText`), so
|
|
369
|
+
* `Sales/access.md` copied to `Legal/rules-copy.md` arrives as an
|
|
370
|
+
* ordinary file whose frontmatter is its own — reading it as the source's
|
|
371
|
+
* name had the preview contradict the copy it was previewing;
|
|
372
|
+
* - `landing`: the folder rules the bytes WILL be, when they land under the
|
|
373
|
+
* name `access.md`. Parsed as the destination path, so the directory it
|
|
374
|
+
* governs is already the right one. An `access.md` that will not parse
|
|
375
|
+
* travels as nothing, as the loader treats it.
|
|
376
|
+
*
|
|
377
|
+
* `lstat`, not `stat`: a SYMLINK is none of this. `move_file` refuses a
|
|
378
|
+
* symlink source outright, so a link to a directory must not be previewed
|
|
379
|
+
* as a folder taking access files along, and nothing is read THROUGH the
|
|
380
|
+
* link either — the link's target is not what would move.
|
|
381
|
+
*
|
|
382
|
+
* Only absence is an answer (see `isAbsence`): a probe that failed on
|
|
383
|
+
* permissions or I/O does not say "this is a file", and reading a folder as
|
|
384
|
+
* one would resolve it through frontmatter it does not have.
|
|
385
|
+
*/
|
|
386
|
+
private relocationSubject;
|
|
330
387
|
/**
|
|
331
388
|
* Same as `readOwnEntries` but reads the file at a specific git ref. The ref
|
|
332
389
|
* MUST be the same one the dir model was loaded at — otherwise a user could
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-control.service.d.ts","sourceRoot":"","sources":["../../../src/modules/access/access-control.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAa,KAAK,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAC7F,OAAO,
|
|
1
|
+
{"version":3,"file":"access-control.service.d.ts","sourceRoot":"","sources":["../../../src/modules/access/access-control.service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAa,KAAK,WAAW,EAAqB,MAAM,6BAA6B,CAAC;AAC7F,OAAO,EAAsC,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAGnG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAA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C,aAAa;IAQrB;;;;;;;OAOG;YACW,kBAAkB;CAoGjC"}
|
|
@@ -3,12 +3,11 @@ import path from 'node:path';
|
|
|
3
3
|
import { logger } from '../../shared/logging.js';
|
|
4
4
|
const log = logger('access');
|
|
5
5
|
import { isAbsence } from '../../shared/fs.contract.js';
|
|
6
|
-
import { isGitTimeout } from '../../shared/git.contract.js';
|
|
6
|
+
import { assertOneSpecPerLine, isGitTimeout } from '../../shared/git.contract.js';
|
|
7
7
|
import { hashEmail } from '../../shared/email-identity.js';
|
|
8
8
|
import { NodeGitRunner } from '../workflow/git/node-git-runner.js';
|
|
9
9
|
import { DEFAULT_KB_LAYOUT, PLUGIN_MANIFEST_FILE, isPersonalPluginDir, pluginIdentityOf, platformRestoreDestination, } from '@bevel-software/platform-shared';
|
|
10
10
|
import { AccessConfigError, AccessUnreadableError } from '../access-model/access-errors.js';
|
|
11
|
-
import { WorkflowDomainError } from '../../shared/domain-errors.js';
|
|
12
11
|
import { synthesizePluginPrincipals } from '../access-model/plugin-principals.js';
|
|
13
12
|
import { GROUPS_YAML, SYNCED_GROUPS_YAML, parseGroupsFile, } from '../access-model/group-files.js';
|
|
14
13
|
import { ADMIN_CANONICAL, EVERYONE_CANONICAL, EVERYONE_DISPLAY, KNOWN_VERBS, ROLE_TOKEN_PREFIX, accessMdSelfEntries, canonicalEmail, canonicalRoleName, isAccessMdPath, mergeGroupsIntoRoles, parseAccessFile, parseOwnAccessEntries, parseRolesYaml, requiredVerbsFor, sourceVerbsFor, } from '../access-model/access-grammar.js';
|
|
@@ -24,6 +23,12 @@ import { DIRECTORY_SYNC_BOT_EMAIL, DIRECTORY_SYNC_BOT_NAME, } from './directory-
|
|
|
24
23
|
async function catFileBatch(runner, repoDir, specs) {
|
|
25
24
|
// Bytes, not text: every `<size>` in the header counts bytes, and the walk
|
|
26
25
|
// below has to step by that count through content that is not all ASCII.
|
|
26
|
+
// One spec per LINE is the protocol, and this walk depends on getting back
|
|
27
|
+
// exactly as many answers as it sent: a spec carrying a line break would
|
|
28
|
+
// insert an extra answer and shift every result after it, so each directory
|
|
29
|
+
// would be handed the NEXT one's `access.md`. Paths are refused a control
|
|
30
|
+
// character at the normaliser; this is the fence at the protocol.
|
|
31
|
+
assertOneSpecPerLine(specs);
|
|
27
32
|
const { stdout: out } = await runner.run(repoDir, ['cat-file', '--batch'], {
|
|
28
33
|
input: `${specs.join('\n')}\n`,
|
|
29
34
|
encoding: 'buffer',
|
|
@@ -723,6 +728,95 @@ function resolveDenialSourcesForVerb(model, verb, kind, relativePath, principal,
|
|
|
723
728
|
}
|
|
724
729
|
return out;
|
|
725
730
|
}
|
|
731
|
+
/**
|
|
732
|
+
* The model as it will be once `fromPath` has been moved or copied to
|
|
733
|
+
* `toPath`: every `access.md` the operation carries, keyed at the directory
|
|
734
|
+
* it lands in, since the rules a folder carries travel with its bytes.
|
|
735
|
+
*
|
|
736
|
+
* What travels is BYTES, and the name they land under decides what they
|
|
737
|
+
* govern — `landing` is the caller's answer to that (see
|
|
738
|
+
* `relocationSubject`), already parsed as the destination path:
|
|
739
|
+
*
|
|
740
|
+
* - a FOLDER takes every `access.md` at or under it, each re-keyed to the
|
|
741
|
+
* directory it lands in, and `landing` plays no part;
|
|
742
|
+
* - a FILE governs a directory exactly when it lands as that directory's
|
|
743
|
+
* `access.md`, whatever it was called before — a copy `copy_file` allows,
|
|
744
|
+
* and one that governs the destination folder the moment it lands. Its key
|
|
745
|
+
* is a PARENT directory, never a path under `fromPath`, which is why the
|
|
746
|
+
* prefix walk above cannot see it.
|
|
747
|
+
*
|
|
748
|
+
* The emptied side is the mirror: an `access.md` that MOVES stops governing
|
|
749
|
+
* the directory it left, whether or not it governs anything where it lands.
|
|
750
|
+
*
|
|
751
|
+
* PREVIEW ONLY. Nothing here reads disk and nothing here decides whether an
|
|
752
|
+
* operation may run — the gates resolve against the model as it IS. This
|
|
753
|
+
* answers the other question, the one a dry run asks: what will be true
|
|
754
|
+
* afterwards. Judging the destination as it stands today is what made a
|
|
755
|
+
* rename warn about losing the owner access the folder's own `access.md` was
|
|
756
|
+
* about to hand straight back.
|
|
757
|
+
*
|
|
758
|
+
* `sourceRemains` is the difference between a copy and a move: a copy leaves
|
|
759
|
+
* the rules where they were, a move takes them away. It changes the answer
|
|
760
|
+
* only when the destination resolves through a directory the source
|
|
761
|
+
* occupied; nothing else consults those keys.
|
|
762
|
+
*/
|
|
763
|
+
function withRelocatedAccessFiles(model, fromPath, toPath, opts) {
|
|
764
|
+
/** Directories the operation takes an `access.md` AWAY from. */
|
|
765
|
+
const emptied = [];
|
|
766
|
+
/** Directories it leaves one IN, with the file as it will be read there. */
|
|
767
|
+
const landing = [];
|
|
768
|
+
if (opts.sourceIsFolder) {
|
|
769
|
+
for (const [dir, file] of model.accessFilesByDir) {
|
|
770
|
+
if (dir !== fromPath && !dir.startsWith(`${fromPath}/`))
|
|
771
|
+
continue;
|
|
772
|
+
emptied.push(dir);
|
|
773
|
+
landing.push({ toDir: `${toPath}${dir.slice(fromPath.length)}`, file });
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
else {
|
|
777
|
+
const fromDir = parentDirOf(fromPath);
|
|
778
|
+
if (isAccessMdPath(fromPath) && model.accessFilesByDir.has(fromDir))
|
|
779
|
+
emptied.push(fromDir);
|
|
780
|
+
if (opts.landing)
|
|
781
|
+
landing.push({ toDir: parentDirOf(toPath), file: opts.landing });
|
|
782
|
+
}
|
|
783
|
+
if (emptied.length === 0 && landing.length === 0)
|
|
784
|
+
return model;
|
|
785
|
+
const accessFilesByDir = new Map(model.accessFilesByDir);
|
|
786
|
+
if (!opts.sourceRemains)
|
|
787
|
+
for (const dir of emptied)
|
|
788
|
+
accessFilesByDir.delete(dir);
|
|
789
|
+
for (const { toDir, file } of landing) {
|
|
790
|
+
// A directory that already has an `access.md` keeps it. The operation
|
|
791
|
+
// would be refused for landing on something that exists long before the
|
|
792
|
+
// two files could meet, so the model must not invent a merge either.
|
|
793
|
+
if (accessFilesByDir.has(toDir))
|
|
794
|
+
continue;
|
|
795
|
+
accessFilesByDir.set(toDir, {
|
|
796
|
+
...file,
|
|
797
|
+
dir: toDir,
|
|
798
|
+
path: toDir ? `${toDir}/access.md` : 'access.md',
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
return { ...model, accessFilesByDir };
|
|
802
|
+
}
|
|
803
|
+
/** The directory a repo-relative file path sits in; `''` for the repo root. */
|
|
804
|
+
function parentDirOf(relativePath) {
|
|
805
|
+
const cut = relativePath.lastIndexOf('/');
|
|
806
|
+
return cut === -1 ? '' : relativePath.slice(0, cut);
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* One file's own-entries, parsed as the path `asName` would be read.
|
|
810
|
+
*
|
|
811
|
+
* The same frontmatter means two different things by name: in an `access.md`
|
|
812
|
+
* it is the FOLDER's rules (and the file governs itself only through the
|
|
813
|
+
* body format — see {@link accessMdSelfEntries}), and anywhere else it is the
|
|
814
|
+
* file's own. Which is why a preview must read the bytes as the name they
|
|
815
|
+
* LAND under, not the one they are leaving.
|
|
816
|
+
*/
|
|
817
|
+
function ownEntriesFromText(text, asName) {
|
|
818
|
+
return isAccessMdPath(asName) ? accessMdSelfEntries(text) : parseOwnAccessEntries(text);
|
|
819
|
+
}
|
|
726
820
|
/**
|
|
727
821
|
* Build the repo-root → path chain of directory scopes that govern
|
|
728
822
|
* `relativePath`, e.g. `Knowledge/Sales/Foo.md` →
|
|
@@ -1230,43 +1324,73 @@ export class AccessControlService {
|
|
|
1230
1324
|
return eligibleHoldersResolved(model, 'download', relativePath, own);
|
|
1231
1325
|
}
|
|
1232
1326
|
/**
|
|
1233
|
-
* The read and write holders of one file at its current path and
|
|
1234
|
-
* it has not moved to yet (see the interface).
|
|
1327
|
+
* The read and write holders of one file or folder at its current path and
|
|
1328
|
+
* at a path it has not moved to yet (see the interface).
|
|
1329
|
+
*
|
|
1330
|
+
* A move changes nothing about what the thing itself carries — a file's
|
|
1331
|
+
* frontmatter and a folder's `access.md` files travel with the bytes — and
|
|
1332
|
+
* everything about the folder chain above it. So the hypothetical side is
|
|
1333
|
+
* the ordinary resolution at the destination path, over what travels:
|
|
1235
1334
|
*
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1238
|
-
*
|
|
1239
|
-
*
|
|
1240
|
-
*
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
1335
|
+
* - a FILE's own-entries, read from the SOURCE (nothing sits at the
|
|
1336
|
+
* destination to read) and parsed as the name they LAND under, layered
|
|
1337
|
+
* over the destination's ancestors — the two sides can differ, because
|
|
1338
|
+
* the same frontmatter is a folder's rules in an `access.md` and the
|
|
1339
|
+
* file's own anywhere else;
|
|
1340
|
+
* - a FOLDER's `access.md` files, keyed at the directories they land in,
|
|
1341
|
+
* and a file landing as a directory's `access.md` at the directory it
|
|
1342
|
+
* lands in (`withRelocatedAccessFiles`). A folder has no frontmatter of
|
|
1343
|
+
* its own, so it passes none.
|
|
1344
|
+
*
|
|
1345
|
+
* One model load and one file read serve all four lookups.
|
|
1243
1346
|
*/
|
|
1244
1347
|
async prospectiveHolders(workspaceId, fromPath, toPath) {
|
|
1245
1348
|
const model = await this.loadModel(workspaceId);
|
|
1246
1349
|
const repoDir = await this.repoDir(workspaceId);
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
//
|
|
1253
|
-
// Only absence is an answer here (see `isAbsence`): a probe that failed on
|
|
1254
|
-
// permissions or I/O does not say "this is a file", and folding it into
|
|
1255
|
-
// one would let the very case above through on an unreadable source.
|
|
1256
|
-
const fromStat = await fs.stat(path.join(repoDir, fromPath)).catch((err) => {
|
|
1257
|
-
if (isAbsence(err))
|
|
1258
|
-
return null;
|
|
1259
|
-
throw err;
|
|
1350
|
+
const { isFolder, ownHere, ownThere, landing } = await this.relocationSubject(repoDir, fromPath, toPath);
|
|
1351
|
+
const after = withRelocatedAccessFiles(model, fromPath, toPath, {
|
|
1352
|
+
sourceRemains: false,
|
|
1353
|
+
sourceIsFolder: isFolder,
|
|
1354
|
+
landing,
|
|
1260
1355
|
});
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
const own = await this.readOwnEntries(repoDir, fromPath);
|
|
1265
|
-
const holdersAt = (relativePath) => ({
|
|
1266
|
-
read: eligibleHoldersResolved(model, 'read', relativePath, own),
|
|
1267
|
-
write: eligibleHoldersResolved(model, 'write', relativePath, own),
|
|
1356
|
+
const holdersAt = (m, relativePath, own) => ({
|
|
1357
|
+
read: eligibleHoldersResolved(m, 'read', relativePath, own),
|
|
1358
|
+
write: eligibleHoldersResolved(m, 'write', relativePath, own),
|
|
1268
1359
|
});
|
|
1269
|
-
return {
|
|
1360
|
+
return {
|
|
1361
|
+
before: holdersAt(model, fromPath, ownHere),
|
|
1362
|
+
after: holdersAt(after, toPath, ownThere),
|
|
1363
|
+
};
|
|
1364
|
+
}
|
|
1365
|
+
/**
|
|
1366
|
+
* The caller's own verbs at `toPath` as they will be once `fromPath` has
|
|
1367
|
+
* been moved or copied there (see the interface).
|
|
1368
|
+
*
|
|
1369
|
+
* Identical to asking `canRead`/`canWrite`/`canDownload`/`canOwner` at
|
|
1370
|
+
* `toPath` whenever nothing travels — an ordinary file with no rules of its
|
|
1371
|
+
* own, or a folder with no `access.md` of its own — so the cases this was
|
|
1372
|
+
* not written for answer exactly as they always did.
|
|
1373
|
+
*
|
|
1374
|
+
* What travels is what `prospectiveHolders` says travels, and for the same
|
|
1375
|
+
* reason: the preview and the dialog's holder lists must not disagree about
|
|
1376
|
+
* one move. A file's own-entries come from the SOURCE, where the bytes
|
|
1377
|
+
* carrying them still are — asking the destination, which does not exist
|
|
1378
|
+
* yet, always answered null and so dropped the frontmatter a rename hands
|
|
1379
|
+
* straight back (requirement 6: what the caller has afterwards equals what
|
|
1380
|
+
* the preview said) — and they are parsed as the name they LAND under,
|
|
1381
|
+
* because that is the parse the gates will use a moment later.
|
|
1382
|
+
*/
|
|
1383
|
+
async previewAccessAfterRelocation(workspaceId, userEmail, fromPath, toPath, opts) {
|
|
1384
|
+
const repoDir = await this.repoDir(workspaceId);
|
|
1385
|
+
const { isFolder, ownThere: own, landing } = await this.relocationSubject(repoDir, fromPath, toPath);
|
|
1386
|
+
const model = withRelocatedAccessFiles(await this.loadModel(workspaceId), fromPath, toPath, { sourceRemains: opts?.sourceRemains === true, sourceIsFolder: isFolder, landing });
|
|
1387
|
+
const machineOwned = this.machineOwnedWriteRule(userEmail, toPath);
|
|
1388
|
+
return {
|
|
1389
|
+
read: canReadResolved(model, userEmail, toPath, own),
|
|
1390
|
+
write: machineOwned ?? hasPermissionResolved(model, 'write', userEmail, toPath, own),
|
|
1391
|
+
download: hasPermissionResolved(model, 'download', userEmail, toPath, own),
|
|
1392
|
+
owner: hasPermissionResolved(model, 'owner', userEmail, toPath, own),
|
|
1393
|
+
};
|
|
1270
1394
|
}
|
|
1271
1395
|
async eligibleWriterEmails(workspaceId, relativePath) {
|
|
1272
1396
|
const model = await this.loadModel(workspaceId);
|
|
@@ -1744,9 +1868,64 @@ export class AccessControlService {
|
|
|
1744
1868
|
catch {
|
|
1745
1869
|
return null;
|
|
1746
1870
|
}
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1871
|
+
return ownEntriesFromText(text, relativePath);
|
|
1872
|
+
}
|
|
1873
|
+
/**
|
|
1874
|
+
* What a move or a copy of `fromPath` to `toPath` CARRIES — the one disk
|
|
1875
|
+
* read both preview surfaces need:
|
|
1876
|
+
*
|
|
1877
|
+
* - `isFolder`: the source is a folder, so the `access.md` files under it
|
|
1878
|
+
* travel, keyed at the directories they land in;
|
|
1879
|
+
* - `ownHere` / `ownThere`: a file's own-entries as the SOURCE's name reads
|
|
1880
|
+
* them and as the DESTINATION's name will. They differ because the same
|
|
1881
|
+
* frontmatter means two things by name (see `ownEntriesFromText`), so
|
|
1882
|
+
* `Sales/access.md` copied to `Legal/rules-copy.md` arrives as an
|
|
1883
|
+
* ordinary file whose frontmatter is its own — reading it as the source's
|
|
1884
|
+
* name had the preview contradict the copy it was previewing;
|
|
1885
|
+
* - `landing`: the folder rules the bytes WILL be, when they land under the
|
|
1886
|
+
* name `access.md`. Parsed as the destination path, so the directory it
|
|
1887
|
+
* governs is already the right one. An `access.md` that will not parse
|
|
1888
|
+
* travels as nothing, as the loader treats it.
|
|
1889
|
+
*
|
|
1890
|
+
* `lstat`, not `stat`: a SYMLINK is none of this. `move_file` refuses a
|
|
1891
|
+
* symlink source outright, so a link to a directory must not be previewed
|
|
1892
|
+
* as a folder taking access files along, and nothing is read THROUGH the
|
|
1893
|
+
* link either — the link's target is not what would move.
|
|
1894
|
+
*
|
|
1895
|
+
* Only absence is an answer (see `isAbsence`): a probe that failed on
|
|
1896
|
+
* permissions or I/O does not say "this is a file", and reading a folder as
|
|
1897
|
+
* one would resolve it through frontmatter it does not have.
|
|
1898
|
+
*/
|
|
1899
|
+
async relocationSubject(repoDir, fromPath, toPath) {
|
|
1900
|
+
const nothing = { isFolder: false, ownHere: null, ownThere: null, landing: null };
|
|
1901
|
+
const fromStat = await fs.lstat(path.join(repoDir, fromPath)).catch((err) => {
|
|
1902
|
+
if (isAbsence(err))
|
|
1903
|
+
return null;
|
|
1904
|
+
throw err;
|
|
1905
|
+
});
|
|
1906
|
+
if (fromStat?.isSymbolicLink() === true)
|
|
1907
|
+
return nothing;
|
|
1908
|
+
if (fromStat?.isDirectory() === true)
|
|
1909
|
+
return { ...nothing, isFolder: true };
|
|
1910
|
+
// `roles.yaml` carries no own-entries wherever it sits, exactly as
|
|
1911
|
+
// `readOwnEntries` has it; a read that fails for any reason is no rules,
|
|
1912
|
+
// which is what the gates would say about the same file.
|
|
1913
|
+
if (fromPath === 'roles.yaml' || toPath === 'roles.yaml')
|
|
1914
|
+
return nothing;
|
|
1915
|
+
let text;
|
|
1916
|
+
try {
|
|
1917
|
+
text = await fs.readFile(path.join(repoDir, fromPath), 'utf-8');
|
|
1918
|
+
}
|
|
1919
|
+
catch {
|
|
1920
|
+
return nothing;
|
|
1921
|
+
}
|
|
1922
|
+
const parsed = isAccessMdPath(toPath) ? parseAccessFile(text, toPath) : null;
|
|
1923
|
+
return {
|
|
1924
|
+
isFolder: false,
|
|
1925
|
+
ownHere: ownEntriesFromText(text, fromPath),
|
|
1926
|
+
ownThere: ownEntriesFromText(text, toPath),
|
|
1927
|
+
landing: parsed?.ok === true ? parsed.file : null,
|
|
1928
|
+
};
|
|
1750
1929
|
}
|
|
1751
1930
|
/**
|
|
1752
1931
|
* Same as `readOwnEntries` but reads the file at a specific git ref. The ref
|