@conduction/nextcloud-vue 2.160.0 → 2.162.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/esm/components/CnActionsMenu/CnActionsMenu.vue2.js +3 -2
- package/dist/esm/components/CnActionsMenu/CnActionsMenu.vue2.js.map +1 -1
- package/dist/esm/components/CnActionsMenu/CnActionsMenu.vue3.js.map +1 -1
- package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue.js +1 -1
- package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue2.js +2 -1
- package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue2.js.map +1 -1
- package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue3.js.map +1 -1
- package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue.js +1 -1
- package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue2.js +20 -2
- package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue2.js.map +1 -1
- package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue3.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +2 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDataTable/CnDataTable.vue2.js +8 -8
- package/dist/esm/components/CnDataTable/CnDataTable.vue2.js.map +1 -1
- package/dist/esm/components/CnDataTable/CnDataTable.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue.js +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js +23 -0
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue3.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +48 -5
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js +2 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +4 -3
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js +6 -5
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js.map +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue.js +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue2.js +2 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue.js +1 -1
- package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue3.js +41 -39
- package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFolderSidebar/webdavFolders.js +2 -1
- package/dist/esm/components/CnFolderSidebar/webdavFolders.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +11 -3
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnMenuWidget/menuActive.js +2 -1
- package/dist/esm/components/CnMenuWidget/menuActive.js.map +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue.js +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js +39 -2
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue3.js +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue.js +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js +2 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue3.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +5 -5
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue.js +1 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue2.js +10 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue.js +1 -1
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue2.js +3 -2
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnTabsWidget/CnTabsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineWidget.vue.js +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineWidget.vue2.js +2 -2
- package/dist/esm/components/CnTimelineWidget/CnTimelineWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineWidget.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue.js +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue2.js +130 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue3.js +27 -16
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue3.js.map +1 -1
- package/dist/esm/l10n/en.json.js +9 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +9 -1
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +641 -569
- package/dist/esm/utils/auditEntries.js +25 -1
- package/dist/esm/utils/auditEntries.js.map +1 -1
- package/dist/esm/utils/buildManifestRoutes.js +2 -1
- package/dist/esm/utils/buildManifestRoutes.js.map +1 -1
- package/dist/esm/utils/cnFetch.js +1 -15
- package/dist/esm/utils/cnFetch.js.map +1 -1
- package/dist/esm/utils/fillTemplate.js +29 -2
- package/dist/esm/utils/fillTemplate.js.map +1 -1
- package/dist/esm/utils/forge.js +4 -1
- package/dist/esm/utils/forge.js.map +1 -1
- package/dist/esm/utils/myTeam.js +17 -3
- package/dist/esm/utils/myTeam.js.map +1 -1
- package/dist/esm/utils/rowAggregate.js +20 -1
- package/dist/esm/utils/rowAggregate.js.map +1 -1
- package/dist/esm/utils/trailingSlashes.js +24 -0
- package/dist/esm/utils/trailingSlashes.js.map +1 -0
- package/dist/nextcloud-vue.cjs.js +1069 -683
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +641 -569
- package/l10n/en.json +9 -1
- package/l10n/nl.json +9 -1
- package/package.json +1 -1
- package/src/components/CnActionsMenu/CnActionsMenu.vue +3 -2
- package/src/components/CnAddressSearch/CnAddressSearch.vue +2 -1
- package/src/components/CnAuditTrailCard/CnAuditTrailCard.vue +20 -2
- package/src/components/CnDashboardPage/CnDashboardPage.vue +2 -1
- package/src/components/CnDataTable/CnDataTable.vue +8 -8
- package/src/components/CnDetailWidgetHost/CnDetailWidgetHost.vue +23 -0
- package/src/components/CnFactsWidget/CnFactsWidget.vue +49 -5
- package/src/components/CnFilesBrowser/CnFilesBrowser.vue +4 -3
- package/src/components/CnFilesBrowser/filesBrowser.js +6 -5
- package/src/components/CnFilesWidget/CnFilesWidget.vue +2 -1
- package/src/components/CnFlowRunsWidget/CnFlowRunsWidget.vue +1 -1
- package/src/components/CnFolderSidebar/webdavFolders.js +2 -1
- package/src/components/CnIndexPage/CnIndexPage.vue +11 -3
- package/src/components/CnMenuWidget/menuActive.js +2 -1
- package/src/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue +40 -3
- package/src/components/CnPageTreeNode/CnPageTreeNode.vue +2 -1
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +5 -5
- package/src/components/CnStatWidget/CnStatWidget.vue +10 -1
- package/src/components/CnTabsWidget/CnTabsWidget.vue +3 -2
- package/src/components/CnTimelineWidget/CnTimelineWidget.vue +2 -2
- package/src/css/dialog.css +7 -0
- package/src/css/look-board-detail.css +35 -0
- package/src/css/look-board.css +18 -1
- package/src/integrations/builtin/email/CnEmailTab.vue +155 -4
- package/src/utils/auditEntries.js +24 -0
- package/src/utils/buildManifestRoutes.js +2 -1
- package/src/utils/cnFetch.js +3 -15
- package/src/utils/fillTemplate.js +29 -2
- package/src/utils/forge.js +3 -1
- package/src/utils/myTeam.js +17 -3
- package/src/utils/rowAggregate.js +19 -0
- package/src/utils/trailingSlashes.js +21 -0
|
@@ -3736,7 +3736,15 @@ var translations$s = {
|
|
|
3736
3736
|
"Filter on {name}": "Filter on {name}",
|
|
3737
3737
|
"(empty)": "(empty)",
|
|
3738
3738
|
"Drag, or use the arrow keys, to move": "Drag, or use the arrow keys, to move",
|
|
3739
|
-
"The new order could not be saved": "The new order could not be saved"
|
|
3739
|
+
"The new order could not be saved": "The new order could not be saved",
|
|
3740
|
+
"From {name}": "From {name}",
|
|
3741
|
+
"To {name}": "To {name}",
|
|
3742
|
+
"linked automatically": "linked automatically",
|
|
3743
|
+
"linked automatically via {mailbox}": "linked automatically via {mailbox}",
|
|
3744
|
+
"from a saved mail file": "from a saved mail file",
|
|
3745
|
+
"linked by {name}": "linked by {name}",
|
|
3746
|
+
"Archived as PDF": "Archived as PDF",
|
|
3747
|
+
"Archived as {format}": "Archived as {format}"
|
|
3740
3748
|
};
|
|
3741
3749
|
var plurals$1 = {
|
|
3742
3750
|
"{count} member": [
|
|
@@ -6908,7 +6916,15 @@ var translations$c = {
|
|
|
6908
6916
|
"Filter on {name}": "Filteren op {name}",
|
|
6909
6917
|
"(empty)": "(leeg)",
|
|
6910
6918
|
"Drag, or use the arrow keys, to move": "Sleep, of gebruik de pijltjestoetsen, om te verplaatsen",
|
|
6911
|
-
"The new order could not be saved": "De nieuwe volgorde kon niet worden opgeslagen"
|
|
6919
|
+
"The new order could not be saved": "De nieuwe volgorde kon niet worden opgeslagen",
|
|
6920
|
+
"From {name}": "Van {name}",
|
|
6921
|
+
"To {name}": "Aan {name}",
|
|
6922
|
+
"linked automatically": "automatisch gekoppeld",
|
|
6923
|
+
"linked automatically via {mailbox}": "automatisch gekoppeld via {mailbox}",
|
|
6924
|
+
"from a saved mail file": "uit een opgeslagen mailbestand",
|
|
6925
|
+
"linked by {name}": "door {name} gekoppeld",
|
|
6926
|
+
"Archived as PDF": "Als pdf gearchiveerd",
|
|
6927
|
+
"Archived as {format}": "Als {format} gearchiveerd"
|
|
6912
6928
|
};
|
|
6913
6929
|
var plurals = {
|
|
6914
6930
|
"{count} member": [
|
|
@@ -13967,9 +13983,23 @@ function fillMyTeamToken(text, name) {
|
|
|
13967
13983
|
if (typeof text !== 'string' || !text.includes('{myTeam}')) {
|
|
13968
13984
|
return text
|
|
13969
13985
|
}
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13986
|
+
let out = '';
|
|
13987
|
+
let pos = 0;
|
|
13988
|
+
for (;;) {
|
|
13989
|
+
const open = text.indexOf('[', pos);
|
|
13990
|
+
const close = open === -1 ? -1 : text.indexOf(']', open + 1);
|
|
13991
|
+
if (close === -1) {
|
|
13992
|
+
break
|
|
13993
|
+
}
|
|
13994
|
+
const part = text.slice(open + 1, close);
|
|
13995
|
+
if (part.includes('{myTeam}')) {
|
|
13996
|
+
out += text.slice(pos, open) + (name ? part.replaceAll('{myTeam}', name) : '');
|
|
13997
|
+
} else {
|
|
13998
|
+
out += text.slice(pos, close + 1);
|
|
13999
|
+
}
|
|
14000
|
+
pos = close + 1;
|
|
14001
|
+
}
|
|
14002
|
+
return (out + text.slice(pos)).replaceAll('{myTeam}', name)
|
|
13973
14003
|
}
|
|
13974
14004
|
|
|
13975
14005
|
/**
|
|
@@ -33364,6 +33394,28 @@ script$8t.render = render$8s;
|
|
|
33364
33394
|
script$8t.__scopeId = "data-v-f319dc6a";
|
|
33365
33395
|
const __sfc_main$8n = script$8t;
|
|
33366
33396
|
|
|
33397
|
+
/**
|
|
33398
|
+
* SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
33399
|
+
* SPDX-License-Identifier: EUPL-1.2
|
|
33400
|
+
*
|
|
33401
|
+
* Trailing-slash trimming, with no imports, so any module can use it.
|
|
33402
|
+
*/
|
|
33403
|
+
|
|
33404
|
+
/**
|
|
33405
|
+
* Drop trailing `/` characters in one linear pass (a `/\/+$/` pattern
|
|
33406
|
+
* backtracks quadratically on a long run of slashes).
|
|
33407
|
+
*
|
|
33408
|
+
* @param {string} value The string to trim.
|
|
33409
|
+
* @return {string} The string without trailing slashes.
|
|
33410
|
+
*/
|
|
33411
|
+
function stripTrailingSlashes(value) {
|
|
33412
|
+
let end = value.length;
|
|
33413
|
+
while (end > 0 && value.charCodeAt(end - 1) === 47) {
|
|
33414
|
+
end--;
|
|
33415
|
+
}
|
|
33416
|
+
return value.slice(0, end)
|
|
33417
|
+
}
|
|
33418
|
+
|
|
33367
33419
|
/**
|
|
33368
33420
|
* The one HTTP client for Conduction Nextcloud apps (ADR-071 Decision 1).
|
|
33369
33421
|
*
|
|
@@ -33428,21 +33480,6 @@ function configureCnFetch(config = {}) {
|
|
|
33428
33480
|
};
|
|
33429
33481
|
}
|
|
33430
33482
|
|
|
33431
|
-
/**
|
|
33432
|
-
* Drop trailing `/` characters in one linear pass (a `/\/+$/` pattern
|
|
33433
|
-
* backtracks quadratically on a long run of slashes).
|
|
33434
|
-
*
|
|
33435
|
-
* @param {string} value The string to trim.
|
|
33436
|
-
* @return {string} The string without trailing slashes.
|
|
33437
|
-
*/
|
|
33438
|
-
function stripTrailingSlashes(value) {
|
|
33439
|
-
let end = value.length;
|
|
33440
|
-
while (end > 0 && value.charCodeAt(end - 1) === 47) {
|
|
33441
|
-
end--;
|
|
33442
|
-
}
|
|
33443
|
-
return value.slice(0, end)
|
|
33444
|
-
}
|
|
33445
|
-
|
|
33446
33483
|
/**
|
|
33447
33484
|
* The bearer credential, resolved.
|
|
33448
33485
|
*
|
|
@@ -43749,6 +43786,34 @@ function firstFilled(templates, object, translate = (key) => key, now = new Date
|
|
|
43749
43786
|
return ''
|
|
43750
43787
|
}
|
|
43751
43788
|
|
|
43789
|
+
/**
|
|
43790
|
+
* Split a template into literal, field, literal, … as
|
|
43791
|
+
* `template.split(/\{([^}]+)\}/)` does, in one linear pass.
|
|
43792
|
+
*
|
|
43793
|
+
* @param {string} template The template, with `{field}` placeholders.
|
|
43794
|
+
* @return {string[]} The literals at even indexes, the field names at odd ones.
|
|
43795
|
+
*/
|
|
43796
|
+
function splitFields(template) {
|
|
43797
|
+
const parts = [];
|
|
43798
|
+
let literalStart = 0;
|
|
43799
|
+
let open = template.indexOf('{');
|
|
43800
|
+
while (open !== -1) {
|
|
43801
|
+
const close = template.indexOf('}', open + 1);
|
|
43802
|
+
if (close === -1) {
|
|
43803
|
+
break
|
|
43804
|
+
}
|
|
43805
|
+
if (close === open + 1) {
|
|
43806
|
+
open = template.indexOf('{', close + 1);
|
|
43807
|
+
continue
|
|
43808
|
+
}
|
|
43809
|
+
parts.push(template.slice(literalStart, open), template.slice(open + 1, close));
|
|
43810
|
+
literalStart = close + 1;
|
|
43811
|
+
open = template.indexOf('{', literalStart);
|
|
43812
|
+
}
|
|
43813
|
+
parts.push(template.slice(literalStart));
|
|
43814
|
+
return parts
|
|
43815
|
+
}
|
|
43816
|
+
|
|
43752
43817
|
/**
|
|
43753
43818
|
* Fill a template such as `"{identifier} · {requester}"` field by field
|
|
43754
43819
|
* (a table column's `secondary` line, a detail page's meta line).
|
|
@@ -43766,8 +43831,7 @@ function firstFilled(templates, object, translate = (key) => key, now = new Date
|
|
|
43766
43831
|
* @return {string} The filled template.
|
|
43767
43832
|
*/
|
|
43768
43833
|
function joinTemplateParts(template, valueOf) {
|
|
43769
|
-
|
|
43770
|
-
const parts = template.split(/\{([^}]+)\}/);
|
|
43834
|
+
const parts = splitFields(template);
|
|
43771
43835
|
const lead = parts[0];
|
|
43772
43836
|
const tail = parts[parts.length - 1];
|
|
43773
43837
|
let body = '';
|
|
@@ -45559,6 +45623,25 @@ function isRowAggregate(agg) {
|
|
|
45559
45623
|
return Boolean(agg && agg.register && agg.schema && (agg.op === 'count' || (agg.op === 'max' && agg.field)))
|
|
45560
45624
|
}
|
|
45561
45625
|
|
|
45626
|
+
/**
|
|
45627
|
+
* One row's figures in a map of rows, created on first use. Rows live in a
|
|
45628
|
+
* Map and figures in a prototype-less object, so a row id or figure key such
|
|
45629
|
+
* as `__proto__` stays an ordinary key.
|
|
45630
|
+
*
|
|
45631
|
+
* @param {Map<string, object>} rows The figures by row id.
|
|
45632
|
+
* @param {string|number} rowId The row id (read as a string).
|
|
45633
|
+
* @return {object} The row's figures, by key.
|
|
45634
|
+
*/
|
|
45635
|
+
function cellsOf(rows, rowId) {
|
|
45636
|
+
const key = String(rowId);
|
|
45637
|
+
let cells = rows.get(key);
|
|
45638
|
+
if (!cells) {
|
|
45639
|
+
cells = Object.create(null);
|
|
45640
|
+
rows.set(key, cells);
|
|
45641
|
+
}
|
|
45642
|
+
return cells
|
|
45643
|
+
}
|
|
45644
|
+
|
|
45562
45645
|
/**
|
|
45563
45646
|
* Fill an aggregate's `where` for one row: a string `"@self.<path>"` reads
|
|
45564
45647
|
* that path of the row, everything else is passed through.
|
|
@@ -50980,11 +51063,11 @@ var script$8b = {
|
|
|
50980
51063
|
}
|
|
50981
51064
|
const id = ++this.aggregateRequestId;
|
|
50982
51065
|
this.aggregateLoading = true;
|
|
50983
|
-
const next =
|
|
51066
|
+
const next = new Map();
|
|
50984
51067
|
const jobs = [];
|
|
50985
51068
|
for (const row of this.rows) {
|
|
50986
51069
|
const rowKey = String(row[this.rowKey]);
|
|
50987
|
-
|
|
51070
|
+
const cells = cellsOf(next, rowKey);
|
|
50988
51071
|
for (const col of aggCols) {
|
|
50989
51072
|
const agg = col.aggregate;
|
|
50990
51073
|
if (isEndpointAggregate(col)) {
|
|
@@ -50997,12 +51080,12 @@ var script$8b = {
|
|
|
50997
51080
|
// first of them sorted on it descending ("Laatste contact").
|
|
50998
51081
|
jobs.push(fetchRowAggregate(agg, row, (r, path) => this.getCellValue(r, path))
|
|
50999
51082
|
.then((value) => {
|
|
51000
|
-
|
|
51083
|
+
cells[col.key] = value;
|
|
51001
51084
|
})
|
|
51002
51085
|
.catch((e) => {
|
|
51003
51086
|
// eslint-disable-next-line no-console
|
|
51004
51087
|
console.warn(`[CnDataTable] aggregate "${col.key}" count failed for row ${rowKey}`, e);
|
|
51005
|
-
|
|
51088
|
+
cells[col.key] = undefined;
|
|
51006
51089
|
}));
|
|
51007
51090
|
}
|
|
51008
51091
|
}
|
|
@@ -51013,7 +51096,7 @@ var script$8b = {
|
|
|
51013
51096
|
if (id !== this.aggregateRequestId) {
|
|
51014
51097
|
return
|
|
51015
51098
|
}
|
|
51016
|
-
this.aggregateValues = next;
|
|
51099
|
+
this.aggregateValues = Object.fromEntries(next);
|
|
51017
51100
|
this.aggregateLoading = false;
|
|
51018
51101
|
},
|
|
51019
51102
|
|
|
@@ -51044,7 +51127,7 @@ var script$8b = {
|
|
|
51044
51127
|
* hides the column.
|
|
51045
51128
|
*
|
|
51046
51129
|
* @param {object} col The column.
|
|
51047
|
-
* @param {object} next The values being built, by row then column.
|
|
51130
|
+
* @param {Map<string, object>} next The values being built, by row then column.
|
|
51048
51131
|
* @param {number} id The batch id, to drop a stale answer.
|
|
51049
51132
|
* @return {Promise<void>}
|
|
51050
51133
|
* @spec openspec/changes/aggregate-from-endpoint/specs/cn-data-table/spec.md
|
|
@@ -51076,7 +51159,7 @@ var script$8b = {
|
|
|
51076
51159
|
}
|
|
51077
51160
|
for (const row of this.rows) {
|
|
51078
51161
|
const k = keyOf(row);
|
|
51079
|
-
next
|
|
51162
|
+
cellsOf(next, String(row[this.rowKey]))[col.key] = k !== '' && values[k] !== undefined ? values[k] : 0;
|
|
51080
51163
|
}
|
|
51081
51164
|
},
|
|
51082
51165
|
|
|
@@ -100793,6 +100876,30 @@ function keepAuditEntries(entries, { excludeActions = [], excludeActors = [] } =
|
|
|
100793
100876
|
&& !isEmptyUpdate(entry))
|
|
100794
100877
|
}
|
|
100795
100878
|
|
|
100879
|
+
/**
|
|
100880
|
+
* The trail query parameters that leave the excluded actions and actors out
|
|
100881
|
+
* on the server (`action[notIn]`, `user[notIn]`), so a page read from the
|
|
100882
|
+
* trail holds what a history shows. `keepAuditEntries` still filters what
|
|
100883
|
+
* comes back. Empty when nothing is left out.
|
|
100884
|
+
*
|
|
100885
|
+
* @param {{excludeActions?: Array<string>, excludeActors?: Array<string>}} [options] What to leave out.
|
|
100886
|
+
* @return {Object<string, string>} The parameters.
|
|
100887
|
+
* @spec openspec/changes/audit-card-exclusions-in-the-query/specs/audit-trail/spec.md#requirement-a-timeline-and-a-tab-count-ask-the-trail-to-leave-out-what-they-hide
|
|
100888
|
+
*/
|
|
100889
|
+
function auditExclusionParams({ excludeActions = [], excludeActors = [] } = {}) {
|
|
100890
|
+
const list = (values) => (Array.isArray(values) ? values : []).map(String).filter(Boolean);
|
|
100891
|
+
const params = {};
|
|
100892
|
+
const actions = list(excludeActions);
|
|
100893
|
+
const actors = list(excludeActors);
|
|
100894
|
+
if (actions.length > 0) {
|
|
100895
|
+
params['action[notIn]'] = actions.join(',');
|
|
100896
|
+
}
|
|
100897
|
+
if (actors.length > 0) {
|
|
100898
|
+
params['user[notIn]'] = actors.join(',');
|
|
100899
|
+
}
|
|
100900
|
+
return params
|
|
100901
|
+
}
|
|
100902
|
+
|
|
100796
100903
|
/**
|
|
100797
100904
|
* SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
100798
100905
|
* SPDX-License-Identifier: EUPL-1.2
|
|
@@ -101208,6 +101315,7 @@ var script$7M = {
|
|
|
101208
101315
|
if (!this.register || !this.schema || !this.objectId) {
|
|
101209
101316
|
return ''
|
|
101210
101317
|
}
|
|
101318
|
+
this.addExclusions(params);
|
|
101211
101319
|
return `${this.apiBase}/objects/${this.register}/${this.schema}/${this.objectId}/audit-trails?${params.toString()}`
|
|
101212
101320
|
},
|
|
101213
101321
|
},
|
|
@@ -101224,6 +101332,21 @@ var script$7M = {
|
|
|
101224
101332
|
},
|
|
101225
101333
|
|
|
101226
101334
|
methods: {
|
|
101335
|
+
/**
|
|
101336
|
+
* Ask an object trail to leave out the excluded actions and actors in
|
|
101337
|
+
* the query (`action[notIn]`, `user[notIn]`), so its pages hold what the
|
|
101338
|
+
* card shows. `keepAuditEntries` still filters what comes back.
|
|
101339
|
+
*
|
|
101340
|
+
* @param {URLSearchParams} params The trail query, changed in place.
|
|
101341
|
+
* @return {void}
|
|
101342
|
+
* @spec openspec/changes/audit-card-exclusions-in-the-query/specs/audit-trail/spec.md#requirement-a-history-card-asks-the-trail-to-leave-out-what-it-hides
|
|
101343
|
+
*/
|
|
101344
|
+
addExclusions(params) {
|
|
101345
|
+
for (const [key, value] of Object.entries(auditExclusionParams({ excludeActions: this.excludeActions, excludeActors: this.excludeActors }))) {
|
|
101346
|
+
params.set(key, value);
|
|
101347
|
+
}
|
|
101348
|
+
},
|
|
101349
|
+
|
|
101227
101350
|
/**
|
|
101228
101351
|
* Read the entries from `fetchUrl`. The readable feed answers
|
|
101229
101352
|
* `{ rows, nextCursor }`, the object trail `{ results }`.
|
|
@@ -101331,7 +101454,9 @@ var script$7M = {
|
|
|
101331
101454
|
}
|
|
101332
101455
|
const objects = await read(`${this.apiBase}/objects/${source.register}/${source.schema}?${params.toString()}`);
|
|
101333
101456
|
const ids = objects.map((object) => object?.id || object?.['@self']?.id || object?.uuid).filter(Boolean);
|
|
101334
|
-
const
|
|
101457
|
+
const trailParams = new URLSearchParams({ limit: String(limit) });
|
|
101458
|
+
this.addExclusions(trailParams);
|
|
101459
|
+
const trails = await Promise.all(ids.map((id) => read(`${this.apiBase}/objects/${source.register}/${source.schema}/${id}/audit-trails?${trailParams.toString()}`).catch(() => [])));
|
|
101335
101460
|
return trails.flat().map((entry) => ({ ...entry, relatedAs: source.as || source.schema }))
|
|
101336
101461
|
} catch {
|
|
101337
101462
|
return []
|
|
@@ -101601,7 +101726,7 @@ function render$7L(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
101601
101726
|
}
|
|
101602
101727
|
|
|
101603
101728
|
script$7M.render = render$7L;
|
|
101604
|
-
script$7M.__scopeId = "data-v-
|
|
101729
|
+
script$7M.__scopeId = "data-v-3b6d70f7";
|
|
101605
101730
|
const __sfc_main$7G = script$7M;
|
|
101606
101731
|
|
|
101607
101732
|
// SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
@@ -113900,6 +114025,7 @@ var script$7i = {
|
|
|
113900
114025
|
* buble-compiled Vue 2 template stays free of `?.` / `??`.
|
|
113901
114026
|
*
|
|
113902
114027
|
* @return {object[]} One descriptor per message.
|
|
114028
|
+
* @spec openspec/changes/linked-mail-row-details/specs/linked-mail-row-details/spec.md#requirement-a-linked-mail-with-details-reads-as-the-boards-draw-it
|
|
113903
114029
|
*/
|
|
113904
114030
|
rows() {
|
|
113905
114031
|
return this.messages.map((message) => {
|
|
@@ -113907,6 +114033,8 @@ var script$7i = {
|
|
|
113907
114033
|
const d = dateRaw === '' ? null : new Date(dateRaw);
|
|
113908
114034
|
const dateValid = d !== null && Number.isNaN(d.getTime()) === false;
|
|
113909
114035
|
const sender = this.formatSender(message);
|
|
114036
|
+
const details = this.linkDetails(message);
|
|
114037
|
+
const archivedAs = details === null ? '' : this.text(details.archivedAs);
|
|
113910
114038
|
return {
|
|
113911
114039
|
id: message.id,
|
|
113912
114040
|
message,
|
|
@@ -113920,6 +114048,10 @@ var script$7i = {
|
|
|
113920
114048
|
avatarName: sender,
|
|
113921
114049
|
avatarUser: this.senderEmail(message),
|
|
113922
114050
|
href: this.threadUrl(message),
|
|
114051
|
+
meta: details === null ? '' : this.metaLine(message, details, dateValid ? d : null),
|
|
114052
|
+
outbound: details !== null && details.direction === 'outbound',
|
|
114053
|
+
pill: details === null ? '' : this.archiveLabel(archivedAs),
|
|
114054
|
+
archived: archivedAs !== '',
|
|
113923
114055
|
}
|
|
113924
114056
|
})
|
|
113925
114057
|
},
|
|
@@ -114097,6 +114229,126 @@ var script$7i = {
|
|
|
114097
114229
|
return false
|
|
114098
114230
|
},
|
|
114099
114231
|
|
|
114232
|
+
/**
|
|
114233
|
+
* The link's details (OpenRegister's EmailLink `details`), or null for
|
|
114234
|
+
* a link without them, which keeps the plain sender line.
|
|
114235
|
+
*
|
|
114236
|
+
* @param {object} message The message record.
|
|
114237
|
+
* @return {object|null} The details.
|
|
114238
|
+
* @spec openspec/changes/linked-mail-row-details/specs/linked-mail-row-details/spec.md#requirement-a-linked-mail-with-details-reads-as-the-boards-draw-it
|
|
114239
|
+
*/
|
|
114240
|
+
linkDetails(message) {
|
|
114241
|
+
const details = message.details;
|
|
114242
|
+
if (details === null || typeof details !== 'object') {
|
|
114243
|
+
return null
|
|
114244
|
+
}
|
|
114245
|
+
const filled = Object.keys(details).some((key) => details[key] !== null && details[key] !== undefined && details[key] !== '');
|
|
114246
|
+
return filled ? details : null
|
|
114247
|
+
},
|
|
114248
|
+
|
|
114249
|
+
/**
|
|
114250
|
+
* A trimmed string, or '' for anything that is not a filled string.
|
|
114251
|
+
*
|
|
114252
|
+
* @param {unknown} value The value.
|
|
114253
|
+
* @return {string} The text.
|
|
114254
|
+
* @spec openspec/changes/linked-mail-row-details/specs/linked-mail-row-details/spec.md#requirement-a-linked-mail-with-details-reads-as-the-boards-draw-it
|
|
114255
|
+
*/
|
|
114256
|
+
text(value) {
|
|
114257
|
+
return typeof value === 'string' ? value.trim() : ''
|
|
114258
|
+
},
|
|
114259
|
+
|
|
114260
|
+
/**
|
|
114261
|
+
* The line under the subject: who it is from or to, when, how many
|
|
114262
|
+
* attachments, and how it was linked, joined by middle dots.
|
|
114263
|
+
*
|
|
114264
|
+
* @param {object} message The message record.
|
|
114265
|
+
* @param {object} details The link details.
|
|
114266
|
+
* @param {Date|null} date The mail's moment, or null when unknown.
|
|
114267
|
+
* @return {string} The meta line.
|
|
114268
|
+
* @spec openspec/changes/linked-mail-row-details/specs/linked-mail-row-details/spec.md#requirement-a-linked-mail-with-details-reads-as-the-boards-draw-it
|
|
114269
|
+
*/
|
|
114270
|
+
metaLine(message, details, date) {
|
|
114271
|
+
const parts = [];
|
|
114272
|
+
const recipient = this.text(details.recipientName);
|
|
114273
|
+
if (details.direction === 'outbound' && recipient !== '') {
|
|
114274
|
+
parts.push(l10n.translate('nextcloud-vue', 'To {name}', { name: recipient }));
|
|
114275
|
+
} else {
|
|
114276
|
+
parts.push(l10n.translate('nextcloud-vue', 'From {name}', { name: this.formatSender(message) }));
|
|
114277
|
+
}
|
|
114278
|
+
if (date !== null) {
|
|
114279
|
+
parts.push(this.whenText(date));
|
|
114280
|
+
}
|
|
114281
|
+
const count = Number(details.attachmentCount);
|
|
114282
|
+
if (Number.isInteger(count) && count > 0) {
|
|
114283
|
+
parts.push(l10n.translatePlural('nextcloud-vue', '%n attachment', '%n attachments', count));
|
|
114284
|
+
}
|
|
114285
|
+
const linked = this.linkedText(message, details);
|
|
114286
|
+
if (linked !== '') {
|
|
114287
|
+
parts.push(linked);
|
|
114288
|
+
}
|
|
114289
|
+
return parts.join(' · ')
|
|
114290
|
+
},
|
|
114291
|
+
|
|
114292
|
+
/**
|
|
114293
|
+
* The mail's date as the boards write it: "5 okt 09.15" in the last
|
|
114294
|
+
* week, "12 mrt" before that.
|
|
114295
|
+
*
|
|
114296
|
+
* @param {Date} date The mail's moment.
|
|
114297
|
+
* @return {string} The date.
|
|
114298
|
+
* @spec openspec/changes/linked-mail-row-details/specs/linked-mail-row-details/spec.md#requirement-a-linked-mail-with-details-reads-as-the-boards-draw-it
|
|
114299
|
+
*/
|
|
114300
|
+
whenText(date) {
|
|
114301
|
+
const day = formatBoardDate(date);
|
|
114302
|
+
const age = ageInDays(date);
|
|
114303
|
+
if (age !== null && age >= 0 && age <= 7) {
|
|
114304
|
+
return day + ' ' + formatTimeOfDay(date)
|
|
114305
|
+
}
|
|
114306
|
+
return day
|
|
114307
|
+
},
|
|
114308
|
+
|
|
114309
|
+
/**
|
|
114310
|
+
* How the mail was linked: automatically through a shared mailbox, from
|
|
114311
|
+
* a saved mail file, or by a person.
|
|
114312
|
+
*
|
|
114313
|
+
* @param {object} message The message record.
|
|
114314
|
+
* @param {object} details The link details.
|
|
114315
|
+
* @return {string} The phrase, or '' when unknown.
|
|
114316
|
+
* @spec openspec/changes/linked-mail-row-details/specs/linked-mail-row-details/spec.md#requirement-a-linked-mail-with-details-reads-as-the-boards-draw-it
|
|
114317
|
+
*/
|
|
114318
|
+
linkedText(message, details) {
|
|
114319
|
+
if (details.linkedVia === 'mailbox') {
|
|
114320
|
+
const mailbox = this.text(details.mailboxName);
|
|
114321
|
+
return mailbox === ''
|
|
114322
|
+
? l10n.translate('nextcloud-vue', 'linked automatically')
|
|
114323
|
+
: l10n.translate('nextcloud-vue', 'linked automatically via {mailbox}', { mailbox })
|
|
114324
|
+
}
|
|
114325
|
+
if (details.linkedVia === 'file') {
|
|
114326
|
+
return l10n.translate('nextcloud-vue', 'from a saved mail file')
|
|
114327
|
+
}
|
|
114328
|
+
if (details.linkedVia === 'manual') {
|
|
114329
|
+
const name = userDisplayName(message.linkedBy);
|
|
114330
|
+
return name === '' ? '' : l10n.translate('nextcloud-vue', 'linked by {name}', { name })
|
|
114331
|
+
}
|
|
114332
|
+
return ''
|
|
114333
|
+
},
|
|
114334
|
+
|
|
114335
|
+
/**
|
|
114336
|
+
* The pill beside a mail with details: its archive copy, or "Linked".
|
|
114337
|
+
*
|
|
114338
|
+
* @param {string} archivedAs The archive format, such as pdf, or ''.
|
|
114339
|
+
* @return {string} The pill text.
|
|
114340
|
+
* @spec openspec/changes/linked-mail-row-details/specs/linked-mail-row-details/spec.md#requirement-a-linked-mail-with-details-reads-as-the-boards-draw-it
|
|
114341
|
+
*/
|
|
114342
|
+
archiveLabel(archivedAs) {
|
|
114343
|
+
if (archivedAs === '') {
|
|
114344
|
+
return l10n.translate('nextcloud-vue', 'Linked')
|
|
114345
|
+
}
|
|
114346
|
+
if (archivedAs.toLowerCase() === 'pdf') {
|
|
114347
|
+
return l10n.translate('nextcloud-vue', 'Archived as PDF')
|
|
114348
|
+
}
|
|
114349
|
+
return l10n.translate('nextcloud-vue', 'Archived as {format}', { format: archivedAs })
|
|
114350
|
+
},
|
|
114351
|
+
|
|
114100
114352
|
rawWhen(message) {
|
|
114101
114353
|
const raw = message.mailDate || message.date || message.linkedAt;
|
|
114102
114354
|
if (raw === undefined || raw === null || raw === '') {
|
|
@@ -114205,7 +114457,10 @@ const _hoisted_6$4v = {
|
|
|
114205
114457
|
const _hoisted_7$41 = { class: "cn-email-tab__body" };
|
|
114206
114458
|
const _hoisted_8$3E = { class: "cn-email-tab__line" };
|
|
114207
114459
|
const _hoisted_9$3j = ["title"];
|
|
114208
|
-
const _hoisted_10$2X = {
|
|
114460
|
+
const _hoisted_10$2X = {
|
|
114461
|
+
key: 0,
|
|
114462
|
+
class: "cn-email-tab__date"
|
|
114463
|
+
};
|
|
114209
114464
|
const _hoisted_11$2D = ["title"];
|
|
114210
114465
|
const _hoisted_12$2n = ["title"];
|
|
114211
114466
|
|
|
@@ -114275,34 +114530,36 @@ function render$7h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
114275
114530
|
class: vue$1.normalizeClass(["cn-email-tab__unread-dot", { 'is-shown': row.unread }])
|
|
114276
114531
|
}, null, 2 /* CLASS */),
|
|
114277
114532
|
vue$1.createVNode(_component_NcAvatar, {
|
|
114278
|
-
class: "cn-email-tab__avatar",
|
|
114533
|
+
class: vue$1.normalizeClass(["cn-email-tab__avatar", { 'cn-email-tab__avatar--outbound': row.outbound }]),
|
|
114279
114534
|
size: 36,
|
|
114280
114535
|
displayName: row.avatarName,
|
|
114281
114536
|
user: row.avatarUser,
|
|
114282
114537
|
isNoUser: true
|
|
114283
|
-
}, null, 8 /* PROPS */, ["displayName", "user"]),
|
|
114538
|
+
}, null, 8 /* PROPS */, ["class", "displayName", "user"]),
|
|
114284
114539
|
vue$1.createElementVNode("div", _hoisted_7$41, [
|
|
114285
114540
|
vue$1.createElementVNode("div", _hoisted_8$3E, [
|
|
114286
114541
|
vue$1.createElementVNode("span", {
|
|
114287
114542
|
class: "cn-email-tab__subject",
|
|
114288
114543
|
title: row.subject
|
|
114289
114544
|
}, vue$1.toDisplayString(row.subject), 9 /* TEXT, PROPS */, _hoisted_9$3j),
|
|
114290
|
-
|
|
114291
|
-
(
|
|
114292
|
-
|
|
114293
|
-
|
|
114294
|
-
|
|
114295
|
-
|
|
114296
|
-
|
|
114297
|
-
|
|
114298
|
-
vue$1.
|
|
114299
|
-
|
|
114300
|
-
|
|
114545
|
+
(!row.meta)
|
|
114546
|
+
? (vue$1.openBlock(), vue$1.createElementBlock("span", _hoisted_10$2X, [
|
|
114547
|
+
(row.dateValid)
|
|
114548
|
+
? (vue$1.openBlock(), vue$1.createBlock(_component_NcDateTime, {
|
|
114549
|
+
key: 0,
|
|
114550
|
+
timestamp: row.dateMs,
|
|
114551
|
+
relativeTime: "short"
|
|
114552
|
+
}, null, 8 /* PROPS */, ["timestamp"]))
|
|
114553
|
+
: (vue$1.openBlock(), vue$1.createElementBlock(vue$1.Fragment, { key: 1 }, [
|
|
114554
|
+
vue$1.createTextVNode(vue$1.toDisplayString(row.dateRaw), 1 /* TEXT */)
|
|
114555
|
+
], 64 /* STABLE_FRAGMENT */))
|
|
114556
|
+
]))
|
|
114557
|
+
: vue$1.createCommentVNode("v-if", true)
|
|
114301
114558
|
]),
|
|
114302
114559
|
vue$1.createElementVNode("div", {
|
|
114303
114560
|
class: "cn-email-tab__sender",
|
|
114304
|
-
title: row.sender
|
|
114305
|
-
}, vue$1.toDisplayString(row.sender), 9 /* TEXT, PROPS */, _hoisted_11$2D),
|
|
114561
|
+
title: row.meta || row.sender
|
|
114562
|
+
}, vue$1.toDisplayString(row.meta || row.sender), 9 /* TEXT, PROPS */, _hoisted_11$2D),
|
|
114306
114563
|
(row.snippet)
|
|
114307
114564
|
? (vue$1.openBlock(), vue$1.createElementBlock("div", {
|
|
114308
114565
|
key: 0,
|
|
@@ -114314,6 +114571,12 @@ function render$7h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
114314
114571
|
]),
|
|
114315
114572
|
_: 2 /* DYNAMIC */
|
|
114316
114573
|
}, 1040 /* FULL_PROPS, DYNAMIC_SLOTS */, ["class"])),
|
|
114574
|
+
(row.pill)
|
|
114575
|
+
? (vue$1.openBlock(), vue$1.createElementBlock("span", {
|
|
114576
|
+
key: 0,
|
|
114577
|
+
class: vue$1.normalizeClass(["cn-email-tab__pill", { 'cn-email-tab__pill--archived': row.archived }])
|
|
114578
|
+
}, vue$1.toDisplayString(row.pill), 3 /* TEXT, CLASS */))
|
|
114579
|
+
: vue$1.createCommentVNode("v-if", true),
|
|
114317
114580
|
vue$1.createVNode(_component_NcActions, {
|
|
114318
114581
|
class: "cn-email-tab__menu",
|
|
114319
114582
|
ariaLabel: $props.moreActionsLabel,
|
|
@@ -114391,7 +114654,7 @@ function render$7h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
114391
114654
|
}
|
|
114392
114655
|
|
|
114393
114656
|
script$7i.render = render$7h;
|
|
114394
|
-
script$7i.__scopeId = "data-v-
|
|
114657
|
+
script$7i.__scopeId = "data-v-83dac03a";
|
|
114395
114658
|
const __sfc_main$7c = script$7i;
|
|
114396
114659
|
|
|
114397
114660
|
/**
|
|
@@ -118898,7 +119161,7 @@ function userRelativePathFromHref(href, uid) {
|
|
|
118898
119161
|
const marker = `/dav/files/${uid}`;
|
|
118899
119162
|
const at = decoded.indexOf(marker);
|
|
118900
119163
|
const rest = at === -1 ? decoded : decoded.slice(at + marker.length);
|
|
118901
|
-
const trimmed = rest
|
|
119164
|
+
const trimmed = stripTrailingSlashes(rest);
|
|
118902
119165
|
return trimmed === '' ? '/' : trimmed
|
|
118903
119166
|
}
|
|
118904
119167
|
|
|
@@ -118910,7 +119173,7 @@ function userRelativePathFromHref(href, uid) {
|
|
|
118910
119173
|
* @return {string} The child's path.
|
|
118911
119174
|
*/
|
|
118912
119175
|
function joinPath(dir, name) {
|
|
118913
|
-
return `${String(dir || '')
|
|
119176
|
+
return `${stripTrailingSlashes(String(dir || ''))}/${String(name || '').replace(/^\/+/, '')}`
|
|
118914
119177
|
}
|
|
118915
119178
|
|
|
118916
119179
|
/**
|
|
@@ -118930,8 +119193,8 @@ function joinPath(dir, name) {
|
|
|
118930
119193
|
* @return {Array<{name: string, path: string, aboveRoot: boolean}>} The crumbs, outermost first.
|
|
118931
119194
|
*/
|
|
118932
119195
|
function crumbsFor(rootPath, currentPath, rootLabel = null) {
|
|
118933
|
-
const root = String(rootPath || '/')
|
|
118934
|
-
const current = String(currentPath || root)
|
|
119196
|
+
const root = stripTrailingSlashes(String(rootPath || '/')) || '/';
|
|
119197
|
+
const current = stripTrailingSlashes(String(currentPath || root)) || '/';
|
|
118935
119198
|
const crumbs = [];
|
|
118936
119199
|
let path = '';
|
|
118937
119200
|
for (const segment of root.split('/').filter(Boolean)) {
|
|
@@ -119042,7 +119305,7 @@ async function resolveObjectFolderInfo({ apiBase, register, schema, objectId, ui
|
|
|
119042
119305
|
try {
|
|
119043
119306
|
const response = await axios$1.request({
|
|
119044
119307
|
method: 'SEARCH',
|
|
119045
|
-
url: `${remoteUrl
|
|
119308
|
+
url: `${stripTrailingSlashes(remoteUrl)}/`,
|
|
119046
119309
|
headers: { 'Content-Type': 'application/xml' },
|
|
119047
119310
|
data: fileIdSearchBody(folderId, uid),
|
|
119048
119311
|
responseType: 'text',
|
|
@@ -120324,7 +120587,7 @@ var script$7a = {
|
|
|
120324
120587
|
* @spec openspec/changes/board-files-root-crumb/specs/board-files-root-crumb/spec.md#requirement-the-board-files-bar-draws-no-trail-at-the-root
|
|
120325
120588
|
*/
|
|
120326
120589
|
atRoot() {
|
|
120327
|
-
const root = String(this.rootPath || '/')
|
|
120590
|
+
const root = stripTrailingSlashes(String(this.rootPath || '/')) || '/';
|
|
120328
120591
|
const last = this.crumbs[this.crumbs.length - 1];
|
|
120329
120592
|
return Boolean(last) && last.path === root
|
|
120330
120593
|
},
|
|
@@ -120817,7 +121080,7 @@ var script$7a = {
|
|
|
120817
121080
|
this.nodes = nodes;
|
|
120818
121081
|
await this.resolveRowData(this.nodes);
|
|
120819
121082
|
} catch (err) {
|
|
120820
|
-
const atRoot = (this.currentPath
|
|
121083
|
+
const atRoot = (stripTrailingSlashes(this.currentPath) || '/') === (stripTrailingSlashes(this.rootPath) || '/');
|
|
120821
121084
|
this.error = err?.status === 404
|
|
120822
121085
|
? (atRoot ? l10n.translate('nextcloud-vue', 'You cannot see these files') : l10n.translate('nextcloud-vue', 'This folder no longer exists'))
|
|
120823
121086
|
: (err?.status === 403 ? l10n.translate('nextcloud-vue', 'You cannot see this folder') : l10n.translate('nextcloud-vue', 'The folder could not be read'));
|
|
@@ -120876,7 +121139,7 @@ var script$7a = {
|
|
|
120876
121139
|
* @return {void}
|
|
120877
121140
|
*/
|
|
120878
121141
|
navigate(path) {
|
|
120879
|
-
const root = this.rootPath
|
|
121142
|
+
const root = stripTrailingSlashes(this.rootPath) || '/';
|
|
120880
121143
|
if (path !== root && !path.startsWith(root === '/' ? '/' : `${root}/`)) {
|
|
120881
121144
|
return
|
|
120882
121145
|
}
|
|
@@ -123282,7 +123545,7 @@ function render$79(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
123282
123545
|
}
|
|
123283
123546
|
|
|
123284
123547
|
script$7a.render = render$79;
|
|
123285
|
-
script$7a.__scopeId = "data-v-
|
|
123548
|
+
script$7a.__scopeId = "data-v-b37addb6";
|
|
123286
123549
|
const __sfc_main$74 = script$7a;
|
|
123287
123550
|
|
|
123288
123551
|
/**
|
|
@@ -164830,6 +165093,7 @@ function slotRenders(slot) {
|
|
|
164830
165093
|
* else in the suggestion flow needs to change.
|
|
164831
165094
|
*/
|
|
164832
165095
|
|
|
165096
|
+
|
|
164833
165097
|
/**
|
|
164834
165098
|
* Default host per forge type. `forgejo`/`gitea` are self-hosted, so they
|
|
164835
165099
|
* have no canonical public host — a `baseUrl` MUST be supplied for those.
|
|
@@ -164906,7 +165170,7 @@ function resolveForge(forge) {
|
|
|
164906
165170
|
const baseUrl = (forge && forge.baseUrl)
|
|
164907
165171
|
|| FORGE_DEFAULT_BASE_URLS[type]
|
|
164908
165172
|
|| DEFAULT_FORGE.baseUrl;
|
|
164909
|
-
return { type, baseUrl: baseUrl
|
|
165173
|
+
return { type, baseUrl: stripTrailingSlashes(baseUrl) }
|
|
164910
165174
|
}
|
|
164911
165175
|
|
|
164912
165176
|
/**
|
|
@@ -165071,10 +165335,10 @@ function resolveDocsUrl(base, anchor) {
|
|
|
165071
165335
|
try {
|
|
165072
165336
|
return new URL(a, b).toString()
|
|
165073
165337
|
} catch {
|
|
165074
|
-
return `${b
|
|
165338
|
+
return `${stripTrailingSlashes(b)}${a}`
|
|
165075
165339
|
}
|
|
165076
165340
|
}
|
|
165077
|
-
return `${b.replace(/#.*$/, '')
|
|
165341
|
+
return `${stripTrailingSlashes(b.replace(/#.*$/, ''))}#${a}`
|
|
165078
165342
|
}
|
|
165079
165343
|
|
|
165080
165344
|
/**
|
|
@@ -179858,12 +180122,17 @@ var script$5$ = {
|
|
|
179858
180122
|
* placeholder in the source string and can move it within the sentence —
|
|
179859
180123
|
* the same contract as Nextcloud's own `t()` parameters.
|
|
179860
180124
|
*
|
|
180125
|
+
* `@object.<field>`, `@objectId`, `@workspace.<key>` and `@config.<key>`
|
|
180126
|
+
* read the page's contexts as a source's tokens do, so a register-counted
|
|
180127
|
+
* tile can name its record's own figure ("of @object.capacity places").
|
|
180128
|
+
*
|
|
179861
180129
|
* A token with no matching field resolves to the empty string rather
|
|
179862
180130
|
* than being left as `{levelName}` on screen: a caption is decoration,
|
|
179863
180131
|
* and showing a reader a raw token is worse than showing them less.
|
|
179864
180132
|
*
|
|
179865
180133
|
* @return {string}
|
|
179866
180134
|
* @spec openspec/changes/stat-caption-formats/specs/stat-widget/spec.md#requirement-a-stat-caption-token-can-carry-a-format
|
|
180135
|
+
* @spec openspec/changes/stat-caption-object-token/specs/stat-caption-object-token/spec.md#requirement-a-stat-caption-can-name-a-field-of-the-pages-record
|
|
179867
180136
|
*/
|
|
179868
180137
|
resolvedCaption() {
|
|
179869
180138
|
const override = this.activeOverride;
|
|
@@ -179882,7 +180151,11 @@ var script$5$ = {
|
|
|
179882
180151
|
const zero = count !== null && this.content.captionSource.zeroText;
|
|
179883
180152
|
return typeof zero === 'string' && zero !== '' ? this.effectiveTranslate(zero) : ''
|
|
179884
180153
|
}
|
|
179885
|
-
|
|
180154
|
+
// `@object.<field>` names a field of the page's record (PqEvenement
|
|
180155
|
+
// "van @object.capacity plaatsen" on a register-counted tile).
|
|
180156
|
+
const translated = caption.indexOf('@') === -1
|
|
180157
|
+
? this.effectiveTranslate(caption)
|
|
180158
|
+
: this.interpolateTokens(this.effectiveTranslate(caption)).replace(/\s{2,}/g, ' ').trim();
|
|
179886
180159
|
if (translated.indexOf('{') === -1) {
|
|
179887
180160
|
return translated
|
|
179888
180161
|
}
|
|
@@ -181614,7 +181887,7 @@ function render$5_(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
181614
181887
|
}
|
|
181615
181888
|
|
|
181616
181889
|
script$5$.render = render$5_;
|
|
181617
|
-
script$5$.__scopeId = "data-v-
|
|
181890
|
+
script$5$.__scopeId = "data-v-4c29c40f";
|
|
181618
181891
|
const __sfc_main$5V = script$5$;
|
|
181619
181892
|
|
|
181620
181893
|
/**
|
|
@@ -197366,7 +197639,7 @@ var script$5A = {
|
|
|
197366
197639
|
});
|
|
197367
197640
|
|
|
197368
197641
|
if (this.content.auditTrail === true) {
|
|
197369
|
-
jobs.push(axios.get(generateUrl(`${base}/audit-trails`), { params: { limit: this.content.auditLimit || 50 } })
|
|
197642
|
+
jobs.push(axios.get(generateUrl(`${base}/audit-trails`), { params: { limit: this.content.auditLimit || 50, ...auditExclusionParams(this.content) } })
|
|
197370
197643
|
.then((r) => {
|
|
197371
197644
|
const data = r && r.data;
|
|
197372
197645
|
this.auditEntries = (data && (data.results || data)) || [];
|
|
@@ -197671,7 +197944,7 @@ function render$5z(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
197671
197944
|
}
|
|
197672
197945
|
|
|
197673
197946
|
script$5A.render = render$5z;
|
|
197674
|
-
script$5A.__scopeId = "data-v-
|
|
197947
|
+
script$5A.__scopeId = "data-v-b5aa88b8";
|
|
197675
197948
|
const __sfc_main$5u = script$5A;
|
|
197676
197949
|
|
|
197677
197950
|
const ACCENT_VARIANTS = ['success', 'warning', 'error', 'info', 'primary'];
|
|
@@ -205755,6 +206028,27 @@ var script$5n = {
|
|
|
205755
206028
|
return title ? { titleLabel: title } : {}
|
|
205756
206029
|
},
|
|
205757
206030
|
|
|
206031
|
+
/**
|
|
206032
|
+
* An integration widget's `labels` (prop name to text), translated in
|
|
206033
|
+
* the host's language: a leaf cannot translate the host app's words.
|
|
206034
|
+
*
|
|
206035
|
+
* @return {object} Prop name to translated text.
|
|
206036
|
+
* @spec openspec/changes/leaf-labels-in-the-host-language/specs/leaf-labels-in-the-host-language/spec.md#requirement-an-integration-widget-gives-its-leaf-labels-in-the-hosts-language
|
|
206037
|
+
*/
|
|
206038
|
+
leafLabels() {
|
|
206039
|
+
const labels = this.widget?.labels;
|
|
206040
|
+
if (!labels || typeof labels !== 'object' || Array.isArray(labels)) {
|
|
206041
|
+
return {}
|
|
206042
|
+
}
|
|
206043
|
+
const out = {};
|
|
206044
|
+
for (const [prop, text] of Object.entries(labels)) {
|
|
206045
|
+
if (typeof text === 'string') {
|
|
206046
|
+
out[prop] = this.translateLabel(text);
|
|
206047
|
+
}
|
|
206048
|
+
}
|
|
206049
|
+
return out
|
|
206050
|
+
},
|
|
206051
|
+
|
|
205758
206052
|
integrationProps() {
|
|
205759
206053
|
return {
|
|
205760
206054
|
surface: this.surface,
|
|
@@ -205769,6 +206063,7 @@ var script$5n = {
|
|
|
205769
206063
|
// the tabs card, repeating the label the open tab already shows.
|
|
205770
206064
|
...(this.usesBareWidget ? { chromeless: true } : {}),
|
|
205771
206065
|
...this.derivedIntegrationContext,
|
|
206066
|
+
...this.leafLabels,
|
|
205772
206067
|
...this.resolvedWidgetProps,
|
|
205773
206068
|
}
|
|
205774
206069
|
},
|
|
@@ -205788,6 +206083,7 @@ var script$5n = {
|
|
|
205788
206083
|
// reads `integrationContext.objectId` gets the same object as
|
|
205789
206084
|
// one that reads `objectId`.
|
|
205790
206085
|
integrationContext: this.widgetIntegrationContext,
|
|
206086
|
+
...this.leafLabels,
|
|
205791
206087
|
...this.resolvedWidgetProps,
|
|
205792
206088
|
// A carded leaf reports its title row and empty state here.
|
|
205793
206089
|
...(this.wrapsMountLeaf ? { onHeader: this.onRendererHeader } : {}),
|
|
@@ -206995,7 +207291,7 @@ function render$5m(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
206995
207291
|
}
|
|
206996
207292
|
|
|
206997
207293
|
script$5n.render = render$5m;
|
|
206998
|
-
script$5n.__scopeId = "data-v-
|
|
207294
|
+
script$5n.__scopeId = "data-v-f25f07ec";
|
|
206999
207295
|
const __sfc_main$5h = script$5n;
|
|
207000
207296
|
|
|
207001
207297
|
/**
|
|
@@ -209134,7 +209430,8 @@ var script$5k = {
|
|
|
209134
209430
|
return null
|
|
209135
209431
|
}
|
|
209136
209432
|
try {
|
|
209137
|
-
const
|
|
209433
|
+
const query = new URLSearchParams({ limit: '100', ...auditExclusionParams(source) });
|
|
209434
|
+
const response = await fetch(prefixUrl(`/apps/openregister/api/objects/${register}/${schema}/${this.objectId}/audit-trails?${query.toString()}`), { headers: buildHeaders() });
|
|
209138
209435
|
if (!response.ok) {
|
|
209139
209436
|
return null
|
|
209140
209437
|
}
|
|
@@ -209579,7 +209876,7 @@ function render$5j(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
209579
209876
|
}
|
|
209580
209877
|
|
|
209581
209878
|
script$5k.render = render$5j;
|
|
209582
|
-
script$5k.__scopeId = "data-v-
|
|
209879
|
+
script$5k.__scopeId = "data-v-67dcb812";
|
|
209583
209880
|
const __sfc_main$5e = script$5k;
|
|
209584
209881
|
|
|
209585
209882
|
/**
|
|
@@ -223474,7 +223771,7 @@ function isRouterPath(url) {
|
|
|
223474
223771
|
*/
|
|
223475
223772
|
function routerBase(router) {
|
|
223476
223773
|
const base = router?.options?.history?.base;
|
|
223477
|
-
return typeof base === 'string' ? base
|
|
223774
|
+
return typeof base === 'string' ? stripTrailingSlashes(base) : ''
|
|
223478
223775
|
}
|
|
223479
223776
|
|
|
223480
223777
|
/**
|
|
@@ -226808,7 +227105,7 @@ var script$4G = {
|
|
|
226808
227105
|
* @return {string} the joined path.
|
|
226809
227106
|
*/
|
|
226810
227107
|
joinPath(base, name) {
|
|
226811
|
-
const trimmedBase = String(base || '/')
|
|
227108
|
+
const trimmedBase = stripTrailingSlashes(String(base || '/'));
|
|
226812
227109
|
const trimmedName = String(name || '').replace(/^\/+/, '');
|
|
226813
227110
|
if (trimmedBase === '' || trimmedBase === '/') {
|
|
226814
227111
|
return '/' + trimmedName
|
|
@@ -227297,7 +227594,7 @@ function render$4F(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
227297
227594
|
}
|
|
227298
227595
|
|
|
227299
227596
|
script$4G.render = render$4F;
|
|
227300
|
-
script$4G.__scopeId = "data-v-
|
|
227597
|
+
script$4G.__scopeId = "data-v-1626aa43";
|
|
227301
227598
|
const __sfc_main$4G = script$4G;
|
|
227302
227599
|
|
|
227303
227600
|
/**
|
|
@@ -233479,46 +233776,48 @@ function render$4u(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
233479
233776
|
: (vue$1.openBlock(), vue$1.createElementBlock(vue$1.Fragment, { key: 4 }, [
|
|
233480
233777
|
($options.rows.length === 0 && $props.content.quietLineWithHistory !== false)
|
|
233481
233778
|
? (vue$1.openBlock(), vue$1.createElementBlock("p", _hoisted_5$33, vue$1.toDisplayString($options.emptyLabel), 1 /* TEXT */))
|
|
233482
|
-
: (
|
|
233483
|
-
|
|
233484
|
-
|
|
233485
|
-
|
|
233486
|
-
|
|
233487
|
-
|
|
233488
|
-
|
|
233489
|
-
|
|
233490
|
-
|
|
233491
|
-
|
|
233492
|
-
|
|
233493
|
-
|
|
233494
|
-
|
|
233495
|
-
(
|
|
233496
|
-
|
|
233497
|
-
|
|
233498
|
-
|
|
233499
|
-
|
|
233500
|
-
|
|
233501
|
-
|
|
233502
|
-
|
|
233503
|
-
vue$1.createElementVNode("span",
|
|
233504
|
-
|
|
233779
|
+
: ($options.rows.length > 0)
|
|
233780
|
+
? (vue$1.openBlock(), vue$1.createElementBlock("ul", _hoisted_6$2P, [
|
|
233781
|
+
(vue$1.openBlock(true), vue$1.createElementBlock(vue$1.Fragment, null, vue$1.renderList($options.rows, (run, index) => {
|
|
233782
|
+
return (vue$1.openBlock(), vue$1.createElementBlock("li", {
|
|
233783
|
+
key: run.uuid || `row-${index}`,
|
|
233784
|
+
class: vue$1.normalizeClass(["cn-flow-runs-widget__row", { 'cn-flow-runs-widget__row--linked': $options.isLinked }]),
|
|
233785
|
+
"data-status": run.status
|
|
233786
|
+
}, [
|
|
233787
|
+
(vue$1.openBlock(), vue$1.createBlock(vue$1.resolveDynamicComponent($options.runHref(run) ? 'a' : 'div'), {
|
|
233788
|
+
class: "cn-flow-runs-widget__row-content",
|
|
233789
|
+
href: $options.runHref(run) || undefined,
|
|
233790
|
+
onClick: $event => ($options.onRowClick($event, run))
|
|
233791
|
+
}, {
|
|
233792
|
+
default: vue$1.withCtx(() => [
|
|
233793
|
+
(!$options.pills)
|
|
233794
|
+
? (vue$1.openBlock(), vue$1.createElementBlock("span", {
|
|
233795
|
+
key: 0,
|
|
233796
|
+
class: vue$1.normalizeClass(["cn-flow-runs-widget__dot", `cn-flow-runs-widget__dot--${run.status}`]),
|
|
233797
|
+
title: $options.statusLabel(run.status)
|
|
233798
|
+
}, null, 10 /* CLASS, PROPS */, _hoisted_8$2i))
|
|
233799
|
+
: vue$1.createCommentVNode("v-if", true),
|
|
233800
|
+
vue$1.createElementVNode("span", _hoisted_9$24, [
|
|
233801
|
+
vue$1.createElementVNode("span", _hoisted_10$1T, vue$1.toDisplayString(run.flowName), 1 /* TEXT */),
|
|
233802
|
+
vue$1.createElementVNode("span", _hoisted_11$1G, vue$1.toDisplayString($options.metaLine(run)), 1 /* TEXT */)
|
|
233803
|
+
]),
|
|
233804
|
+
($options.pills)
|
|
233805
|
+
? (vue$1.openBlock(), vue$1.createBlock(_component_CnStatusBadge, {
|
|
233806
|
+
key: 1,
|
|
233807
|
+
class: "cn-flow-runs-widget__pill",
|
|
233808
|
+
label: $options.statusLabel(run.status),
|
|
233809
|
+
variant: $options.statusVariant(run.status),
|
|
233810
|
+
size: "small"
|
|
233811
|
+
}, null, 8 /* PROPS */, ["label", "variant"]))
|
|
233812
|
+
: vue$1.createCommentVNode("v-if", true),
|
|
233813
|
+
vue$1.createElementVNode("span", _hoisted_12$1u, vue$1.toDisplayString($options.ageLabel(run)), 1 /* TEXT */)
|
|
233505
233814
|
]),
|
|
233506
|
-
|
|
233507
|
-
|
|
233508
|
-
|
|
233509
|
-
|
|
233510
|
-
|
|
233511
|
-
|
|
233512
|
-
size: "small"
|
|
233513
|
-
}, null, 8 /* PROPS */, ["label", "variant"]))
|
|
233514
|
-
: vue$1.createCommentVNode("v-if", true),
|
|
233515
|
-
vue$1.createElementVNode("span", _hoisted_12$1u, vue$1.toDisplayString($options.ageLabel(run)), 1 /* TEXT */)
|
|
233516
|
-
]),
|
|
233517
|
-
_: 2 /* DYNAMIC */
|
|
233518
|
-
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["href", "onClick"]))
|
|
233519
|
-
], 10 /* CLASS, PROPS */, _hoisted_7$2w))
|
|
233520
|
-
}), 128 /* KEYED_FRAGMENT */))
|
|
233521
|
-
])),
|
|
233815
|
+
_: 2 /* DYNAMIC */
|
|
233816
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["href", "onClick"]))
|
|
233817
|
+
], 10 /* CLASS, PROPS */, _hoisted_7$2w))
|
|
233818
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
233819
|
+
]))
|
|
233820
|
+
: vue$1.createCommentVNode("v-if", true),
|
|
233522
233821
|
($options.hiddenCount > 0)
|
|
233523
233822
|
? (vue$1.openBlock(), vue$1.createElementBlock("p", _hoisted_13$1g, vue$1.toDisplayString($options.moreLabel), 1 /* TEXT */))
|
|
233524
233823
|
: vue$1.createCommentVNode("v-if", true),
|
|
@@ -233579,7 +233878,7 @@ function render$4u(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
233579
233878
|
}
|
|
233580
233879
|
|
|
233581
233880
|
script$4v.render = render$4u;
|
|
233582
|
-
script$4v.__scopeId = "data-v-
|
|
233881
|
+
script$4v.__scopeId = "data-v-2cd6fe28";
|
|
233583
233882
|
const __sfc_main$4v = script$4v;
|
|
233584
233883
|
|
|
233585
233884
|
/**
|
|
@@ -242335,6 +242634,552 @@ function conditionalLine(candidates, row, translate = (text) => text, context =
|
|
|
242335
242634
|
return ''
|
|
242336
242635
|
}
|
|
242337
242636
|
|
|
242637
|
+
/**
|
|
242638
|
+
* SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
242639
|
+
* SPDX-License-Identifier: EUPL-1.2
|
|
242640
|
+
*
|
|
242641
|
+
* Who holds which right on one OpenRegister object, and where each grant came
|
|
242642
|
+
* from. The reads behind CnObjectPermissionsTab.
|
|
242643
|
+
*
|
|
242644
|
+
* Every function here is a read. Nothing decides who may open an object: the
|
|
242645
|
+
* grant, its provenance, the deny and the inheritance live in OpenRegister, and
|
|
242646
|
+
* these helpers hand on what it answered. A deny is never subtracted from a
|
|
242647
|
+
* grant, a missing answer is never filled with a default, and nothing is
|
|
242648
|
+
* cached: a copy of an access decision is a second decision nobody updates.
|
|
242649
|
+
*
|
|
242650
|
+
* The object's own permission set (`/permissions`) is preferred; an older
|
|
242651
|
+
* OpenRegister answers 404 to it, and then five reads are the fallback:
|
|
242652
|
+
*
|
|
242653
|
+
* GET {apiBase}/permissions the verb catalogue + deny mode
|
|
242654
|
+
* GET {apiBase}/objects/{register}/{schema}/{id}/shares grants written on the object
|
|
242655
|
+
* GET {apiBase}/permissions/compare-roles?register= each role and its verbs
|
|
242656
|
+
* GET {apiBase}/scopes?register=&schema= the caller's own verdict + provenance
|
|
242657
|
+
* GET {apiBase}/permissions/deny-preview?register=&schema= the deny rules as written
|
|
242658
|
+
*
|
|
242659
|
+
* plus the history read `{...}/{id}/permissions/history?at=` for "who held a
|
|
242660
|
+
* right on a date".
|
|
242661
|
+
*
|
|
242662
|
+
* A failed read answers `null`, never `[]`: "we could not ask" and "nobody
|
|
242663
|
+
* holds this" are opposite answers that would otherwise render as the same
|
|
242664
|
+
* empty table.
|
|
242665
|
+
*/
|
|
242666
|
+
|
|
242667
|
+
/** The OpenRegister API root a target defaults to. */
|
|
242668
|
+
const DEFAULT_API_BASE = '/apps/openregister/api';
|
|
242669
|
+
|
|
242670
|
+
/**
|
|
242671
|
+
* Normalise a target to `{register, schema, apiBase}`.
|
|
242672
|
+
*
|
|
242673
|
+
* @param {object} target The object's register, schema and optional apiBase.
|
|
242674
|
+
* @return {{register: string, schema: string, apiBase: string}} The target.
|
|
242675
|
+
*/
|
|
242676
|
+
function normalise$1(target = {}) {
|
|
242677
|
+
return {
|
|
242678
|
+
register: String(target.register || ''),
|
|
242679
|
+
schema: String(target.schema || ''),
|
|
242680
|
+
apiBase: String(target.apiBase || DEFAULT_API_BASE).replace(/\/$/, ''),
|
|
242681
|
+
}
|
|
242682
|
+
}
|
|
242683
|
+
|
|
242684
|
+
/**
|
|
242685
|
+
* GET one path, keeping the status beside the body.
|
|
242686
|
+
*
|
|
242687
|
+
* The status is part of the answer: a 403 on the access set means the reader
|
|
242688
|
+
* may open the object and may not enumerate who else can, which is not a
|
|
242689
|
+
* failed read. A transport failure has no status and reports 0. A non-JSON
|
|
242690
|
+
* body (the SPA shell answering 200) is a failed read, not "no rules".
|
|
242691
|
+
*
|
|
242692
|
+
* @param {string} url App-absolute URL.
|
|
242693
|
+
* @param {object} params Query parameters.
|
|
242694
|
+
* @return {Promise<{status: number, data: object|null}>} The status and the body.
|
|
242695
|
+
*/
|
|
242696
|
+
async function readResult(url, params = {}) {
|
|
242697
|
+
try {
|
|
242698
|
+
const response = await axios$1.get(prefixUrl(url), { params });
|
|
242699
|
+
if (typeof response?.data !== 'object' || response.data === null) {
|
|
242700
|
+
return { status: response?.status || 0, data: null }
|
|
242701
|
+
}
|
|
242702
|
+
return { status: response.status || 200, data: response.data }
|
|
242703
|
+
} catch (error) {
|
|
242704
|
+
return { status: error?.response?.status || 0, data: null }
|
|
242705
|
+
}
|
|
242706
|
+
}
|
|
242707
|
+
|
|
242708
|
+
/**
|
|
242709
|
+
* GET one path, answering null when it cannot be read.
|
|
242710
|
+
*
|
|
242711
|
+
* @param {string} url App-absolute URL.
|
|
242712
|
+
* @param {object} params Query parameters.
|
|
242713
|
+
* @return {Promise<object|null>} The body, or null.
|
|
242714
|
+
*/
|
|
242715
|
+
async function read(url, params = {}) {
|
|
242716
|
+
const { data } = await readResult(url, params);
|
|
242717
|
+
return data
|
|
242718
|
+
}
|
|
242719
|
+
|
|
242720
|
+
/**
|
|
242721
|
+
* The URL of one object, under its target.
|
|
242722
|
+
*
|
|
242723
|
+
* @param {object} target The target.
|
|
242724
|
+
* @param {string} objectId The object id.
|
|
242725
|
+
* @param {string} [schema] A schema other than the target's.
|
|
242726
|
+
* @return {string} The URL.
|
|
242727
|
+
*/
|
|
242728
|
+
function objectUrl(target, objectId, schema) {
|
|
242729
|
+
const { register, apiBase } = normalise$1(target);
|
|
242730
|
+
return `${apiBase}/objects/${register}/${schema || normalise$1(target).schema}/${objectId}`
|
|
242731
|
+
}
|
|
242732
|
+
|
|
242733
|
+
/**
|
|
242734
|
+
* The grantable verbs and the deny enforcement mode.
|
|
242735
|
+
*
|
|
242736
|
+
* @param {object} target The target (only `apiBase` is read).
|
|
242737
|
+
* @return {Promise<object|null>} `{permissions, denyEnforcement}`, or null.
|
|
242738
|
+
*/
|
|
242739
|
+
function fetchPermissionCatalogue(target) {
|
|
242740
|
+
return read(`${normalise$1(target).apiBase}/permissions`)
|
|
242741
|
+
}
|
|
242742
|
+
|
|
242743
|
+
/**
|
|
242744
|
+
* The grants written on one object.
|
|
242745
|
+
*
|
|
242746
|
+
* @param {object} target The target.
|
|
242747
|
+
* @param {string} objectId The object id.
|
|
242748
|
+
* @return {Promise<Array|null>} The grants, or null.
|
|
242749
|
+
*/
|
|
242750
|
+
async function fetchObjectGrants(target, objectId) {
|
|
242751
|
+
const body = await read(`${objectUrl(target, objectId)}/shares`);
|
|
242752
|
+
if (body === null || !Array.isArray(body.results)) {
|
|
242753
|
+
return null
|
|
242754
|
+
}
|
|
242755
|
+
return body.results
|
|
242756
|
+
}
|
|
242757
|
+
|
|
242758
|
+
/**
|
|
242759
|
+
* Each role in the register and the verbs it holds.
|
|
242760
|
+
*
|
|
242761
|
+
* @param {object} target The target.
|
|
242762
|
+
* @return {Promise<object|null>} `{roles}`, or null.
|
|
242763
|
+
*/
|
|
242764
|
+
function fetchRoleGrants(target) {
|
|
242765
|
+
const { apiBase, register } = normalise$1(target);
|
|
242766
|
+
return read(`${apiBase}/permissions/compare-roles`, { register })
|
|
242767
|
+
}
|
|
242768
|
+
|
|
242769
|
+
/**
|
|
242770
|
+
* The caller's own effective verbs on the schema, with their provenance.
|
|
242771
|
+
*
|
|
242772
|
+
* The endpoint answers a matrix even when narrowed, so the row is picked by
|
|
242773
|
+
* schema name rather than by position.
|
|
242774
|
+
*
|
|
242775
|
+
* @param {object} target The target.
|
|
242776
|
+
* @return {Promise<object|null>} The scope entry, or null.
|
|
242777
|
+
*/
|
|
242778
|
+
async function fetchCallerScope(target) {
|
|
242779
|
+
const { apiBase, register, schema } = normalise$1(target);
|
|
242780
|
+
const body = await read(`${apiBase}/scopes`, { register, schema });
|
|
242781
|
+
if (body === null || !Array.isArray(body.scopes)) {
|
|
242782
|
+
return null
|
|
242783
|
+
}
|
|
242784
|
+
const scope = body.scopes.find((entry) => entry?.schema === schema);
|
|
242785
|
+
if (!scope) {
|
|
242786
|
+
return null
|
|
242787
|
+
}
|
|
242788
|
+
return { user: body.user, isAdmin: body.isAdmin, groups: body.groups, ...scope }
|
|
242789
|
+
}
|
|
242790
|
+
|
|
242791
|
+
/**
|
|
242792
|
+
* The deny rules as written for the register and schema.
|
|
242793
|
+
*
|
|
242794
|
+
* @param {object} target The target.
|
|
242795
|
+
* @return {Promise<object|null>} `{denyEnforcement, enforcing, rules}`, or null.
|
|
242796
|
+
*/
|
|
242797
|
+
function fetchDenyRules(target) {
|
|
242798
|
+
const { apiBase, register, schema } = normalise$1(target);
|
|
242799
|
+
return read(`${apiBase}/permissions/deny-preview`, { register, schema })
|
|
242800
|
+
}
|
|
242801
|
+
|
|
242802
|
+
/**
|
|
242803
|
+
* The permission set OpenRegister publishes for this object, with its status.
|
|
242804
|
+
*
|
|
242805
|
+
* @param {object} target The target.
|
|
242806
|
+
* @param {string} objectId The object id.
|
|
242807
|
+
* @return {Promise<{status: number, set: object|null}>} The status and the set.
|
|
242808
|
+
*/
|
|
242809
|
+
async function fetchObjectPermissions(target, objectId) {
|
|
242810
|
+
const { status, data } = await readResult(`${objectUrl(target, objectId)}/permissions`);
|
|
242811
|
+
if (data === null || Array.isArray(data.holders) === false) {
|
|
242812
|
+
return { status, set: null }
|
|
242813
|
+
}
|
|
242814
|
+
return { status, set: data }
|
|
242815
|
+
}
|
|
242816
|
+
|
|
242817
|
+
/**
|
|
242818
|
+
* The set as it stood at a moment, from the object's audit trail.
|
|
242819
|
+
*
|
|
242820
|
+
* @param {object} target The target.
|
|
242821
|
+
* @param {string} objectId The object id.
|
|
242822
|
+
* @param {string} at An ISO-8601 moment.
|
|
242823
|
+
* @return {Promise<{status: number, history: object|null}>} The status and the history.
|
|
242824
|
+
*/
|
|
242825
|
+
async function fetchAccessHistory(target, objectId, at) {
|
|
242826
|
+
const { status, data } = await readResult(`${objectUrl(target, objectId)}/permissions/history`, { at });
|
|
242827
|
+
if (data === null || Array.isArray(data.changes) === false) {
|
|
242828
|
+
return { status, history: null }
|
|
242829
|
+
}
|
|
242830
|
+
return { status, history: data }
|
|
242831
|
+
}
|
|
242832
|
+
|
|
242833
|
+
/**
|
|
242834
|
+
* The end and the area written on one rule, as OpenRegister reported them.
|
|
242835
|
+
*
|
|
242836
|
+
* Neither is compared to anything: whether an expired grant still answers is
|
|
242837
|
+
* resolved in OpenRegister. A role grant carries the whole holder list, so the
|
|
242838
|
+
* entry naming this principal is picked out of it.
|
|
242839
|
+
*
|
|
242840
|
+
* @param {object|Array|string|null} rule The rule as written.
|
|
242841
|
+
* @param {string} principal The holder of the row.
|
|
242842
|
+
* @return {{until: string, scopedTo: object|null}} The end and the area.
|
|
242843
|
+
*/
|
|
242844
|
+
function constraintsOf(rule, principal) {
|
|
242845
|
+
const none = { until: '', scopedTo: null };
|
|
242846
|
+
if (rule === null || typeof rule !== 'object') {
|
|
242847
|
+
return none
|
|
242848
|
+
}
|
|
242849
|
+
|
|
242850
|
+
let entry = rule;
|
|
242851
|
+
if (Array.isArray(rule)) {
|
|
242852
|
+
entry = rule.find((candidate) => candidate === principal
|
|
242853
|
+
|| (candidate !== null
|
|
242854
|
+
&& typeof candidate === 'object'
|
|
242855
|
+
&& [candidate.principal, candidate.group, candidate.role, candidate.user].includes(principal)));
|
|
242856
|
+
}
|
|
242857
|
+
|
|
242858
|
+
if (entry === null || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
242859
|
+
return none
|
|
242860
|
+
}
|
|
242861
|
+
|
|
242862
|
+
return {
|
|
242863
|
+
until: typeof entry.until === 'string' ? entry.until : '',
|
|
242864
|
+
scopedTo: entry.scopedTo || null,
|
|
242865
|
+
}
|
|
242866
|
+
}
|
|
242867
|
+
|
|
242868
|
+
/**
|
|
242869
|
+
* One reported rule as a row.
|
|
242870
|
+
*
|
|
242871
|
+
* @param {object} rule The rule.
|
|
242872
|
+
* @param {boolean} refusing Whether the rule takes a right away.
|
|
242873
|
+
* @param {boolean} enforcing Whether refusals are in force.
|
|
242874
|
+
* @return {object} The row.
|
|
242875
|
+
*/
|
|
242876
|
+
function ruleRow(rule, refusing, enforcing) {
|
|
242877
|
+
const principal = rule?.principal || '';
|
|
242878
|
+
const { until, scopedTo } = constraintsOf(rule?.rule ?? null, principal);
|
|
242879
|
+
|
|
242880
|
+
let source = rule?.level || 'object';
|
|
242881
|
+
if (refusing === true) {
|
|
242882
|
+
source = enforcing === true ? 'deny' : 'staged-deny';
|
|
242883
|
+
}
|
|
242884
|
+
|
|
242885
|
+
return {
|
|
242886
|
+
holder: principal,
|
|
242887
|
+
right: rule?.action || '',
|
|
242888
|
+
source,
|
|
242889
|
+
detail: rule?.role || '',
|
|
242890
|
+
inheritedFrom: rule?.inheritedFrom || '',
|
|
242891
|
+
level: rule?.level || '',
|
|
242892
|
+
role: rule?.role || '',
|
|
242893
|
+
declared: rule?.declared !== false,
|
|
242894
|
+
conditional: rule?.conditional === true,
|
|
242895
|
+
until,
|
|
242896
|
+
scopedTo,
|
|
242897
|
+
}
|
|
242898
|
+
}
|
|
242899
|
+
|
|
242900
|
+
/**
|
|
242901
|
+
* The object's own permission set as rows. A deny is its own row.
|
|
242902
|
+
*
|
|
242903
|
+
* @param {object|null} set The set from `fetchObjectPermissions`.
|
|
242904
|
+
* @return {Array<object>} The rows.
|
|
242905
|
+
*/
|
|
242906
|
+
function objectPermissionRows(set) {
|
|
242907
|
+
if (set === null || typeof set !== 'object') {
|
|
242908
|
+
return []
|
|
242909
|
+
}
|
|
242910
|
+
|
|
242911
|
+
const enforcing = set.denyEnforcement === 'enforcing';
|
|
242912
|
+
const rows = [];
|
|
242913
|
+
for (const holder of set.holders || []) {
|
|
242914
|
+
for (const rule of holder?.rules || []) {
|
|
242915
|
+
rows.push(ruleRow(rule, false, enforcing));
|
|
242916
|
+
}
|
|
242917
|
+
}
|
|
242918
|
+
for (const rule of set.denied || []) {
|
|
242919
|
+
rows.push(ruleRow(rule, true, enforcing));
|
|
242920
|
+
}
|
|
242921
|
+
return rows
|
|
242922
|
+
}
|
|
242923
|
+
|
|
242924
|
+
/**
|
|
242925
|
+
* The set as it stood at the moment asked about.
|
|
242926
|
+
*
|
|
242927
|
+
* `asOf: null` (the trail does not reach back that far) is "unanswered", never
|
|
242928
|
+
* an empty table: an empty table would claim nobody held a right that day.
|
|
242929
|
+
*
|
|
242930
|
+
* @param {object|null} history The history from `fetchAccessHistory`.
|
|
242931
|
+
* @return {{answered: boolean, at: string, rows: Array<object>, setBy: string, changedAfterwardsBy: object|null}} The answer.
|
|
242932
|
+
*/
|
|
242933
|
+
function asOfRows(history) {
|
|
242934
|
+
const unanswered = { answered: false, at: history?.at || '', rows: [], setBy: '', changedAfterwardsBy: null };
|
|
242935
|
+
|
|
242936
|
+
const asOf = history?.asOf || null;
|
|
242937
|
+
if (asOf === null || typeof asOf !== 'object') {
|
|
242938
|
+
return unanswered
|
|
242939
|
+
}
|
|
242940
|
+
|
|
242941
|
+
const rows = [];
|
|
242942
|
+
for (const holder of asOf.holders || []) {
|
|
242943
|
+
for (const rule of holder?.rules || []) {
|
|
242944
|
+
rows.push(ruleRow(rule, false, false));
|
|
242945
|
+
}
|
|
242946
|
+
}
|
|
242947
|
+
|
|
242948
|
+
return {
|
|
242949
|
+
answered: true,
|
|
242950
|
+
at: asOf.at || history?.at || '',
|
|
242951
|
+
rows,
|
|
242952
|
+
setBy: asOf.setBy || '',
|
|
242953
|
+
changedAfterwardsBy: asOf.changedAfterwardsBy || null,
|
|
242954
|
+
}
|
|
242955
|
+
}
|
|
242956
|
+
|
|
242957
|
+
/**
|
|
242958
|
+
* All answers as one list of rows. A renderer, not an evaluator: each row
|
|
242959
|
+
* restates ONE reported rule, and no row is the product of two.
|
|
242960
|
+
*
|
|
242961
|
+
* When the object answered for itself the share, role and deny reads are not
|
|
242962
|
+
* replayed on top (the same grant would be counted twice). The caller's own
|
|
242963
|
+
* verdict always rides along last, because it is the one answer about this
|
|
242964
|
+
* reader rather than a rule about everybody.
|
|
242965
|
+
*
|
|
242966
|
+
* @param {object} answers The reads.
|
|
242967
|
+
* @param {object|null} answers.objectPermissions The object's own set.
|
|
242968
|
+
* @param {Array|null} answers.objectGrants Grants on the object.
|
|
242969
|
+
* @param {object|null} answers.roleGrants Roles and their verbs.
|
|
242970
|
+
* @param {object|null} answers.callerScope The caller's own verdict.
|
|
242971
|
+
* @param {object|null} answers.denyRules The deny rules.
|
|
242972
|
+
* @return {Array<object>} The rows.
|
|
242973
|
+
*/
|
|
242974
|
+
function grantRows({ objectPermissions = null, objectGrants, roleGrants, callerScope, denyRules }) {
|
|
242975
|
+
const rows = [];
|
|
242976
|
+
|
|
242977
|
+
if (objectPermissions !== null) {
|
|
242978
|
+
rows.push(...objectPermissionRows(objectPermissions));
|
|
242979
|
+
}
|
|
242980
|
+
|
|
242981
|
+
for (const grant of (objectPermissions === null ? objectGrants : null) || []) {
|
|
242982
|
+
for (const right of grant?.actions || []) {
|
|
242983
|
+
rows.push({
|
|
242984
|
+
holder: grant.principal || grant.userId || grant.groupId || '',
|
|
242985
|
+
right,
|
|
242986
|
+
// `inheritedFrom` is the id of the ancestor, not a source key.
|
|
242987
|
+
source: grant.source || (grant.inheritedFrom ? 'inherited' : 'share'),
|
|
242988
|
+
inheritedFrom: grant.inheritedFrom || '',
|
|
242989
|
+
detail: grant.expires ? String(grant.expires) : '',
|
|
242990
|
+
});
|
|
242991
|
+
}
|
|
242992
|
+
}
|
|
242993
|
+
|
|
242994
|
+
for (const role of (objectPermissions === null ? roleGrants?.roles : null) || []) {
|
|
242995
|
+
for (const right of role?.actions || []) {
|
|
242996
|
+
rows.push({ holder: role.role || '', right, source: 'role', detail: '' });
|
|
242997
|
+
}
|
|
242998
|
+
}
|
|
242999
|
+
|
|
243000
|
+
for (const rule of (objectPermissions === null ? denyRules?.rules : null) || []) {
|
|
243001
|
+
rows.push({
|
|
243002
|
+
holder: rule.principal || '',
|
|
243003
|
+
right: rule.action || '',
|
|
243004
|
+
source: denyRules.enforcing ? 'deny' : 'staged-deny',
|
|
243005
|
+
detail: rule.level ? `${rule.level}: ${rule.subject || ''}` : '',
|
|
243006
|
+
});
|
|
243007
|
+
}
|
|
243008
|
+
|
|
243009
|
+
for (const [right, record] of Object.entries(callerScope?.provenance || {})) {
|
|
243010
|
+
rows.push({
|
|
243011
|
+
holder: callerScope.user || '',
|
|
243012
|
+
right,
|
|
243013
|
+
source: record?.source || 'unknown',
|
|
243014
|
+
granted: record?.granted,
|
|
243015
|
+
detail: record?.role || record?.principal || '',
|
|
243016
|
+
stagedDeny: record?.stagedDeny || null,
|
|
243017
|
+
});
|
|
243018
|
+
}
|
|
243019
|
+
|
|
243020
|
+
return rows
|
|
243021
|
+
}
|
|
243022
|
+
|
|
243023
|
+
/**
|
|
243024
|
+
* The id a reference carries, as a uuid string or as an expanded object.
|
|
243025
|
+
*
|
|
243026
|
+
* @param {unknown} value The reference.
|
|
243027
|
+
* @return {string} The id, or ''.
|
|
243028
|
+
*/
|
|
243029
|
+
function referenceId$1(value) {
|
|
243030
|
+
if (value && typeof value === 'object') {
|
|
243031
|
+
return String(value['@self']?.id ?? value.id ?? value.uuid ?? '')
|
|
243032
|
+
}
|
|
243033
|
+
return String(value ?? '')
|
|
243034
|
+
}
|
|
243035
|
+
|
|
243036
|
+
/**
|
|
243037
|
+
* The object's decided field rules, and the per-role field rules its TYPE
|
|
243038
|
+
* object declares.
|
|
243039
|
+
*
|
|
243040
|
+
* Two reads, because they answer different questions: `@self.fieldRules` is
|
|
243041
|
+
* what OpenRegister decided for THIS reader, the declaration on the type
|
|
243042
|
+
* object is the rule behind it. Neither is evaluated here.
|
|
243043
|
+
*
|
|
243044
|
+
* @param {object} target The target.
|
|
243045
|
+
* @param {string} objectId The object id.
|
|
243046
|
+
* @param {object} config Where the declaration lives.
|
|
243047
|
+
* @param {string} config.typeField Field on the object referencing its type object.
|
|
243048
|
+
* @param {string} config.typeSchema Schema of the type object (same register).
|
|
243049
|
+
* @param {string} [config.declarationField] Field on the type object holding the rules.
|
|
243050
|
+
* @return {Promise<{decided: object|null, declared: Array<object>|null}>} The answer.
|
|
243051
|
+
*/
|
|
243052
|
+
async function fetchFieldRoleRules(target, objectId, config) {
|
|
243053
|
+
if (!objectId || !config?.typeField || !config?.typeSchema) {
|
|
243054
|
+
return { decided: null, declared: null }
|
|
243055
|
+
}
|
|
243056
|
+
|
|
243057
|
+
const object = await read(objectUrl(target, objectId));
|
|
243058
|
+
if (object === null) {
|
|
243059
|
+
return { decided: null, declared: null }
|
|
243060
|
+
}
|
|
243061
|
+
|
|
243062
|
+
const decided = object['@self']?.fieldRules ?? null;
|
|
243063
|
+
const typeId = referenceId$1(object[config.typeField]);
|
|
243064
|
+
if (!typeId) {
|
|
243065
|
+
return { decided, declared: null }
|
|
243066
|
+
}
|
|
243067
|
+
|
|
243068
|
+
const type = await read(objectUrl(target, typeId, config.typeSchema));
|
|
243069
|
+
if (type === null) {
|
|
243070
|
+
return { decided, declared: null }
|
|
243071
|
+
}
|
|
243072
|
+
|
|
243073
|
+
const declared = type[config.declarationField || 'fieldRoleRules'];
|
|
243074
|
+
return { decided, declared: Array.isArray(declared) ? declared : [] }
|
|
243075
|
+
}
|
|
243076
|
+
|
|
243077
|
+
/**
|
|
243078
|
+
* The two things a role rule can do to a field. The spelling is OpenRegister's
|
|
243079
|
+
* contract (`hidden`, `readOnly`); any other rule is dropped.
|
|
243080
|
+
*/
|
|
243081
|
+
const ROLE_RULES = ['hidden', 'readOnly'];
|
|
243082
|
+
|
|
243083
|
+
/**
|
|
243084
|
+
* The reader's word for each field rule.
|
|
243085
|
+
*
|
|
243086
|
+
* @return {object} The labels, by rule id.
|
|
243087
|
+
*/
|
|
243088
|
+
function roleRuleLabels() {
|
|
243089
|
+
return {
|
|
243090
|
+
hidden: l10n.translate('nextcloud-vue', 'Not shown'),
|
|
243091
|
+
readOnly: l10n.translate('nextcloud-vue', 'Cannot be changed'),
|
|
243092
|
+
}
|
|
243093
|
+
}
|
|
243094
|
+
|
|
243095
|
+
/**
|
|
243096
|
+
* A declared list of names, blanks and repeats removed.
|
|
243097
|
+
*
|
|
243098
|
+
* @param {unknown} value The list.
|
|
243099
|
+
* @return {Array<string>} The names.
|
|
243100
|
+
*/
|
|
243101
|
+
function names(value) {
|
|
243102
|
+
if (Array.isArray(value) === false) {
|
|
243103
|
+
return []
|
|
243104
|
+
}
|
|
243105
|
+
const found = [];
|
|
243106
|
+
value.forEach((entry) => {
|
|
243107
|
+
const name = String(entry ?? '').trim();
|
|
243108
|
+
if (name !== '' && found.includes(name) === false) {
|
|
243109
|
+
found.push(name);
|
|
243110
|
+
}
|
|
243111
|
+
});
|
|
243112
|
+
return found
|
|
243113
|
+
}
|
|
243114
|
+
|
|
243115
|
+
/**
|
|
243116
|
+
* Whether OpenRegister applied this rule to the reader. False when the object
|
|
243117
|
+
* carries no decision at all (an older OpenRegister), never invented.
|
|
243118
|
+
*
|
|
243119
|
+
* @param {string} field The field.
|
|
243120
|
+
* @param {string} rule The rule.
|
|
243121
|
+
* @param {object|null} decided The object's `@self.fieldRules`.
|
|
243122
|
+
* @return {boolean} True when the reader met this rule.
|
|
243123
|
+
*/
|
|
243124
|
+
function appliesToMe(field, rule, decided) {
|
|
243125
|
+
const applied = decided?.[rule];
|
|
243126
|
+
if (Array.isArray(applied) === false) {
|
|
243127
|
+
return false
|
|
243128
|
+
}
|
|
243129
|
+
return applied.map((name) => String(name)).includes(field)
|
|
243130
|
+
}
|
|
243131
|
+
|
|
243132
|
+
/**
|
|
243133
|
+
* The declared field rules as rows. A row naming no field, or an unknown rule,
|
|
243134
|
+
* is dropped rather than rendered blank.
|
|
243135
|
+
*
|
|
243136
|
+
* @param {Array<object>|null} declared The declaration.
|
|
243137
|
+
* @param {object|null} decided The object's `@self.fieldRules`.
|
|
243138
|
+
* @return {Array<object>} The rows.
|
|
243139
|
+
*/
|
|
243140
|
+
function fieldRoleRows(declared, decided) {
|
|
243141
|
+
if (Array.isArray(declared) === false) {
|
|
243142
|
+
return []
|
|
243143
|
+
}
|
|
243144
|
+
|
|
243145
|
+
return declared
|
|
243146
|
+
.filter((rule) => rule && ROLE_RULES.includes(rule.rule) && typeof rule.field === 'string' && rule.field.trim() !== '')
|
|
243147
|
+
.map((rule) => {
|
|
243148
|
+
const field = rule.field.trim();
|
|
243149
|
+
return {
|
|
243150
|
+
field,
|
|
243151
|
+
rule: rule.rule,
|
|
243152
|
+
groups: names(rule.groups),
|
|
243153
|
+
heldBy: names(rule.heldBy),
|
|
243154
|
+
reason: String(rule.reason ?? '').trim(),
|
|
243155
|
+
appliesToMe: appliesToMe(field, rule.rule, decided),
|
|
243156
|
+
}
|
|
243157
|
+
})
|
|
243158
|
+
}
|
|
243159
|
+
|
|
243160
|
+
/**
|
|
243161
|
+
* One field-rule row as a whole sentence (whole sentences, so a translator can
|
|
243162
|
+
* reorder the groups).
|
|
243163
|
+
*
|
|
243164
|
+
* @param {object} row One row from `fieldRoleRows`.
|
|
243165
|
+
* @return {string} The sentence.
|
|
243166
|
+
*/
|
|
243167
|
+
function roleRuleSentence(row) {
|
|
243168
|
+
const groups = row?.groups?.join(', ') ?? '';
|
|
243169
|
+
const heldBy = row?.heldBy?.join(', ') ?? '';
|
|
243170
|
+
|
|
243171
|
+
if (row?.rule === 'hidden' && heldBy !== '') {
|
|
243172
|
+
return l10n.translate('nextcloud-vue', '{groups} do not see this field. {heldBy} do.', { groups, heldBy })
|
|
243173
|
+
}
|
|
243174
|
+
if (row?.rule === 'hidden') {
|
|
243175
|
+
return l10n.translate('nextcloud-vue', '{groups} do not see this field.', { groups })
|
|
243176
|
+
}
|
|
243177
|
+
if (heldBy !== '') {
|
|
243178
|
+
return l10n.translate('nextcloud-vue', '{groups} cannot change this field. {heldBy} can.', { groups, heldBy })
|
|
243179
|
+
}
|
|
243180
|
+
return l10n.translate('nextcloud-vue', '{groups} cannot change this field.', { groups })
|
|
243181
|
+
}
|
|
243182
|
+
|
|
242338
243183
|
/** Event-bus channel of the page-level Refresh, which an api-call or a saved form also sends. */
|
|
242339
243184
|
const PAGE_REFRESH_CHANNEL$4 = 'cn:page:refresh';
|
|
242340
243185
|
|
|
@@ -242528,7 +243373,7 @@ var script$4h = {
|
|
|
242528
243373
|
* The widget configuration.
|
|
242529
243374
|
*
|
|
242530
243375
|
* - `fields` — the entries, in order. Each is `{ path, label?, as?, from?, format?, map?, itemPath?, parts?, separator?, route?, variant?, variantMap?, colorMap?, icon?, copy?, reveal?, inline?, joinPrevious?, joinSeparator?, text?, title?, subtitle?, initialsPath?, tone? }`.
|
|
242531
|
-
* `as` is `row` (default when `label` or `icon` is set), `title`, `line`, `text` (a line in the normal ink), `lead` (an icon tile or initials beside `title` and `subtitle`), `pill` or `meter`.
|
|
243376
|
+
* `as` is `row` (default when `label` or `icon` is set), `title`, `line`, `text` (a line in the normal ink), `lead` (an icon tile or initials beside `title` and `subtitle`), `pill` or `meter`. A `title` takes `size` in px (a Termijn card's 26px figure).
|
|
242532
243377
|
* `countFrom` (`{ register, schema, filter? }`, `@objectId` / `@object.<field>` in the filter) shows how many records that list holds ("Lopende zaken 43"); the row is left out while the count cannot be read.
|
|
242533
243378
|
* A `meter` shows the amount at `path` against the limit at `limitPath` (or a constant `limit`) as "12 of 50" with a bar; past the limit the bar turns red and the text says "over the limit"; without a positive limit it shows the amount and no bar.
|
|
242534
243379
|
* A `line` or `text` with `joinPrevious: true` is written on after the line or text just before it, as one paragraph (`joinSeparator`, default a space); with none before it, it stands alone. A text joined with a line break (`joinSeparator: "\n"`) keeps it: two address lines as one block.
|
|
@@ -242545,7 +243390,7 @@ var script$4h = {
|
|
|
242545
243390
|
* `labelPath` ("@context.caseType.handlerLabel") names a value on the record or the page's `@context` records that labels the row when it holds text; `label` is the fallback.
|
|
242546
243391
|
* `emptyValue` ("No") is shown, translated, when the entry has no value, so the entry stays drawn whatever `hideEmpty` says (an override that was never set reads "No").
|
|
242547
243392
|
* - `action` — an action drawn as a button under the facts; `headerAction` — one drawn in the card header (reported through the `header` event).
|
|
242548
|
-
* - `actions` — action buttons under the facts in the `headerActions` shape (`api-call`, `open-form`, `navigate`, `open-modal`, ...; `confirm`, `variant`). `@source.<field>` names a field of the record shown, and an action whose token names an empty field is not drawn. `visibleWhen` reads the record shown; `adminOnly: true` draws the action for an instance admin only (visibility, never authorisation). An api-call or a saved form refreshes the page, and the facts read their source again.
|
|
243393
|
+
* - `actions` — action buttons under the facts in the `headerActions` shape (`api-call`, `open-form`, `navigate`, `open-modal`, ...; `confirm`, `variant`). `@source.<field>` names a field of the record shown, and an action whose token names an empty field is not drawn. `visibleWhen` reads the record shown; `adminOnly: true` draws the action for an instance admin only (visibility, never authorisation). `requires: "update"` draws it only when OpenRegister lets the reader update the page's record (also on `emptyActions`; while the right is unknown it draws, and the server decides). An api-call or a saved form refreshes the page, and the facts read their source again.
|
|
242549
243394
|
* - `fieldsFrom` — `@context.<name>.<path>`, a list of entries on a record the page reads beside this one (a case type's `requestFields`); when it holds entries they are drawn instead of `fields`.
|
|
242550
243395
|
* - `rowsPath` — a path to a list of `{ label, value }` the record holds, drawn as rows after `fields` (a preview the server builds).
|
|
242551
243396
|
* - `headerPill` — a status pill in the card header (reported through the `header` event): `{ path?, text?, map?, variant?, variantMap?, colorMap? }`, read from the record like a `pill` entry (DqBezwaar "Advies ontvangen"); nothing shows while the value is empty.
|
|
@@ -242612,6 +243457,8 @@ var script$4h = {
|
|
|
242612
243457
|
counts: {},
|
|
242613
243458
|
/** The outcome of each `actions[]` condition that needs a request, by action id. */
|
|
242614
243459
|
remoteVisibility: {},
|
|
243460
|
+
/** Whether OpenRegister lets the reader update the page's record; null while unknown (the server decides). */
|
|
243461
|
+
mayUpdate: null,
|
|
242615
243462
|
/** Sequence of the source reads, so an older answer never replaces a newer one. */
|
|
242616
243463
|
loadSeq: 0,
|
|
242617
243464
|
}
|
|
@@ -242826,6 +243673,7 @@ var script$4h = {
|
|
|
242826
243673
|
emptyActions() {
|
|
242827
243674
|
const list = Array.isArray(this.content?.emptyActions) ? this.content.emptyActions : [];
|
|
242828
243675
|
return list
|
|
243676
|
+
.filter((action) => this.rightAllows(action))
|
|
242829
243677
|
.map((action) => ({ view: this.actionView(action), action }))
|
|
242830
243678
|
.filter((entry) => entry.view)
|
|
242831
243679
|
.map((entry) => ({ ...entry.view, action: entry.action }))
|
|
@@ -242858,7 +243706,7 @@ var script$4h = {
|
|
|
242858
243706
|
const admin = this.viewerIsAdmin();
|
|
242859
243707
|
const out = [];
|
|
242860
243708
|
actions.forEach((action, index) => {
|
|
242861
|
-
if (!action || typeof action !== 'object' || (action.adminOnly === true && !admin)) {
|
|
243709
|
+
if (!action || typeof action !== 'object' || (action.adminOnly === true && !admin) || !this.rightAllows(action)) {
|
|
242862
243710
|
return
|
|
242863
243711
|
}
|
|
242864
243712
|
const id = this.actionId(action, index);
|
|
@@ -242873,7 +243721,7 @@ var script$4h = {
|
|
|
242873
243721
|
if (unresolved) {
|
|
242874
243722
|
return
|
|
242875
243723
|
}
|
|
242876
|
-
const { visibleWhen, adminOnly, ...drawn } = value;
|
|
243724
|
+
const { visibleWhen, adminOnly, requires, ...drawn } = value;
|
|
242877
243725
|
out.push({ ...drawn, id });
|
|
242878
243726
|
});
|
|
242879
243727
|
return out
|
|
@@ -242957,6 +243805,9 @@ var script$4h = {
|
|
|
242957
243805
|
if (kind === 'title' && field.route) {
|
|
242958
243806
|
block.to = this.resolveRoute(field.route, record);
|
|
242959
243807
|
}
|
|
243808
|
+
if (kind === 'title' && Number.isFinite(field.size) && field.size > 0) {
|
|
243809
|
+
block.size = field.size;
|
|
243810
|
+
}
|
|
242960
243811
|
if (kind === 'pill') {
|
|
242961
243812
|
const raw = readPath$9(record, field.path);
|
|
242962
243813
|
const colours = field.variantMap || field.colorMap;
|
|
@@ -243182,6 +244033,7 @@ var script$4h = {
|
|
|
243182
244033
|
|
|
243183
244034
|
mounted() {
|
|
243184
244035
|
eventBus.subscribe(PAGE_REFRESH_CHANNEL$4, this.onPageRefresh);
|
|
244036
|
+
this.loadMayUpdate();
|
|
243185
244037
|
},
|
|
243186
244038
|
|
|
243187
244039
|
beforeUnmount() {
|
|
@@ -243189,6 +244041,40 @@ var script$4h = {
|
|
|
243189
244041
|
},
|
|
243190
244042
|
|
|
243191
244043
|
methods: {
|
|
244044
|
+
/**
|
|
244045
|
+
* Whether an action's `requires: "update"` holds: the reader may update
|
|
244046
|
+
* the page's record. Unknown counts as yes; the server decides.
|
|
244047
|
+
*
|
|
244048
|
+
* @param {object} action The declaration.
|
|
244049
|
+
* @return {boolean}
|
|
244050
|
+
* @spec openspec/changes/facts-title-size-and-update-right/specs/facts-widget/spec.md#requirement-a-facts-action-can-ask-for-the-update-right
|
|
244051
|
+
*/
|
|
244052
|
+
rightAllows(action) {
|
|
244053
|
+
return !(action && action.requires === 'update' && this.mayUpdate === false)
|
|
244054
|
+
},
|
|
244055
|
+
|
|
244056
|
+
/**
|
|
244057
|
+
* Read the reader's rights on the page's register and schema, when an
|
|
244058
|
+
* action asks for the update right.
|
|
244059
|
+
*
|
|
244060
|
+
* @return {Promise<void>}
|
|
244061
|
+
* @spec openspec/changes/facts-title-size-and-update-right/specs/facts-widget/spec.md#requirement-a-facts-action-can-ask-for-the-update-right
|
|
244062
|
+
*/
|
|
244063
|
+
async loadMayUpdate() {
|
|
244064
|
+
const all = [...(Array.isArray(this.content?.actions) ? this.content.actions : []), ...(Array.isArray(this.content?.emptyActions) ? this.content.emptyActions : [])];
|
|
244065
|
+
const { register, schema } = this.tokenCtx;
|
|
244066
|
+
if (!all.some((action) => action && action.requires === 'update') || !register || !schema) {
|
|
244067
|
+
return
|
|
244068
|
+
}
|
|
244069
|
+
const slug = (value) => (value && typeof value === 'object' ? String(value.slug || value.id || '') : String(value));
|
|
244070
|
+
try {
|
|
244071
|
+
const scope = await fetchCallerScope({ register: slug(register), schema: slug(schema) });
|
|
244072
|
+
this.mayUpdate = !scope || !Array.isArray(scope.actions) || scope.actions.includes('update');
|
|
244073
|
+
} catch {
|
|
244074
|
+
this.mayUpdate = null;
|
|
244075
|
+
}
|
|
244076
|
+
},
|
|
244077
|
+
|
|
243192
244078
|
/**
|
|
243193
244079
|
* A link's label and the muted note under it, their `{path}` and
|
|
243194
244080
|
* `{path:format}` placeholders filled from the record ("{page:last-segment}").
|
|
@@ -243315,7 +244201,7 @@ var script$4h = {
|
|
|
243315
244201
|
return LINK_SCHEMES.includes(parsed.protocol) ? parsed.href : ''
|
|
243316
244202
|
}
|
|
243317
244203
|
if (typeof link.hrefBase === 'string' && link.hrefBase !== '') {
|
|
243318
|
-
const path = link.hrefBase
|
|
244204
|
+
const path = stripTrailingSlashes(link.hrefBase) + '/' + value.replace(/^\/+/, '');
|
|
243319
244205
|
return router.generateUrl(path)
|
|
243320
244206
|
}
|
|
243321
244207
|
return value.startsWith('/') && !value.startsWith('//') ? value : ''
|
|
@@ -244639,13 +245525,14 @@ function render$4g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
244639
245525
|
key: 1,
|
|
244640
245526
|
to: block.to || undefined,
|
|
244641
245527
|
class: "cn-facts-widget__title",
|
|
245528
|
+
style: vue$1.normalizeStyle(block.size ? { fontSize: `${block.size}px` } : undefined),
|
|
244642
245529
|
"data-testid": `cn-fact-${block.key}`
|
|
244643
245530
|
}, {
|
|
244644
245531
|
default: vue$1.withCtx(() => [
|
|
244645
245532
|
vue$1.createTextVNode(vue$1.toDisplayString(block.value), 1 /* TEXT */)
|
|
244646
245533
|
]),
|
|
244647
245534
|
_: 2 /* DYNAMIC */
|
|
244648
|
-
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["to", "data-testid"]))
|
|
245535
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["to", "style", "data-testid"]))
|
|
244649
245536
|
: (block.kind === 'line')
|
|
244650
245537
|
? (vue$1.openBlock(), vue$1.createElementBlock("span", {
|
|
244651
245538
|
key: 2,
|
|
@@ -244883,7 +245770,7 @@ function render$4g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
244883
245770
|
}
|
|
244884
245771
|
|
|
244885
245772
|
script$4h.render = render$4g;
|
|
244886
|
-
script$4h.__scopeId = "data-v-
|
|
245773
|
+
script$4h.__scopeId = "data-v-4235ed18";
|
|
244887
245774
|
const __sfc_main$4h = script$4h;
|
|
244888
245775
|
|
|
244889
245776
|
/**
|
|
@@ -259555,7 +260442,7 @@ var script$3Y = {
|
|
|
259555
260442
|
this.aggregateValues = {};
|
|
259556
260443
|
return
|
|
259557
260444
|
}
|
|
259558
|
-
const next =
|
|
260445
|
+
const next = new Map();
|
|
259559
260446
|
const jobs = [];
|
|
259560
260447
|
for (const raw of this.rows.slice(0, this.limit)) {
|
|
259561
260448
|
const row = scalarRow(raw);
|
|
@@ -259563,18 +260450,18 @@ var script$3Y = {
|
|
|
259563
260450
|
if (!rowId) {
|
|
259564
260451
|
continue
|
|
259565
260452
|
}
|
|
259566
|
-
|
|
260453
|
+
const figures = cellsOf(next, rowId);
|
|
259567
260454
|
for (const [key, agg] of entries) {
|
|
259568
260455
|
jobs.push(fetchRowAggregate(agg, row)
|
|
259569
260456
|
.then((value) => {
|
|
259570
|
-
|
|
260457
|
+
figures[key] = this.aggregateText(agg, value);
|
|
259571
260458
|
})
|
|
259572
260459
|
.catch(() => {}));
|
|
259573
260460
|
}
|
|
259574
260461
|
}
|
|
259575
260462
|
await Promise.all(jobs);
|
|
259576
260463
|
if (id === this.aggregateRequestId) {
|
|
259577
|
-
this.aggregateValues = next;
|
|
260464
|
+
this.aggregateValues = Object.fromEntries(next);
|
|
259578
260465
|
}
|
|
259579
260466
|
},
|
|
259580
260467
|
|
|
@@ -261480,7 +262367,7 @@ function render$3X(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
261480
262367
|
}
|
|
261481
262368
|
|
|
261482
262369
|
script$3Y.render = render$3X;
|
|
261483
|
-
script$3Y.__scopeId = "data-v-
|
|
262370
|
+
script$3Y.__scopeId = "data-v-b35728f0";
|
|
261484
262371
|
const __sfc_main$3Y = script$3Y;
|
|
261485
262372
|
|
|
261486
262373
|
/**
|
|
@@ -280071,7 +280958,7 @@ var script$3I = {
|
|
|
280071
280958
|
* @return {void}
|
|
280072
280959
|
*/
|
|
280073
280960
|
addChild(node) {
|
|
280074
|
-
const base = String(node.ref.route || '')
|
|
280961
|
+
const base = stripTrailingSlashes(String(node.ref.route || ''));
|
|
280075
280962
|
const ref = { id: this.nextId(), parent: node.ref.id, type: 'detail', route: `${base}/:id`, title: '', config: {} };
|
|
280076
280963
|
node.children.push({ ref, children: [] });
|
|
280077
280964
|
this.flatten();
|
|
@@ -280162,7 +281049,7 @@ function render$3H(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
280162
281049
|
}
|
|
280163
281050
|
|
|
280164
281051
|
script$3I.render = render$3H;
|
|
280165
|
-
script$3I.__scopeId = "data-v-
|
|
281052
|
+
script$3I.__scopeId = "data-v-559b1c1a";
|
|
280166
281053
|
const __sfc_main$3I = script$3I;
|
|
280167
281054
|
|
|
280168
281055
|
var script$3H = {
|
|
@@ -325160,7 +326047,7 @@ function text(parent, local) {
|
|
|
325160
326047
|
* @return {string} The normalised path.
|
|
325161
326048
|
*/
|
|
325162
326049
|
function normalizePath(path) {
|
|
325163
|
-
const trimmed = (path || '/')
|
|
326050
|
+
const trimmed = stripTrailingSlashes(path || '/');
|
|
325164
326051
|
return trimmed.startsWith('/') ? trimmed : '/' + trimmed
|
|
325165
326052
|
}
|
|
325166
326053
|
|
|
@@ -337935,7 +338822,10 @@ var script$2M = {
|
|
|
337935
338822
|
* filter? }`), or a field read from an app endpoint (`{ endpoint,
|
|
337936
338823
|
* path, followFilters? }`; `followFilters: true` sends the active
|
|
337937
338824
|
* filters along as `filter[<field>]=<value>`). A value not read (yet) leaves its token empty (board PqLeads
|
|
337938
|
-
* "€ 509.928 in de pijplijn").
|
|
338825
|
+
* "€ 509.928 in de pijplijn"). `unfiltered: true` reads an aggregation
|
|
338826
|
+
* under the page's own `filter` only, so the footer note can name the
|
|
338827
|
+
* whole list ("73 aanmeldingen in totaal"); the footer note fills the
|
|
338828
|
+
* same tokens.
|
|
337939
338829
|
*
|
|
337940
338830
|
* @spec openspec/changes/index-count-values/specs/index-page/spec.md#requirement-the-count-line-can-name-sums-and-values
|
|
337941
338831
|
* @type {Record<string, object>|null}
|
|
@@ -344039,6 +344929,7 @@ var script$2M = {
|
|
|
344039
344929
|
const footerNote = scoped !== undefined ? scoped : footerNoteForView(this.footerNoteByView, this.currentViewMode, this.footerNote);
|
|
344040
344930
|
if (footerNote) {
|
|
344041
344931
|
return this.fillConfigTokens(this.cnTranslate(footerNote))
|
|
344932
|
+
.replace(/\{(\w+)\|[^}]*\}|\{(\w+)\}/g, (token, a, b) => this.countValueToken(token, a || b))
|
|
344042
344933
|
}
|
|
344043
344934
|
const source = this.isNamedSource ? this.namedSource : null;
|
|
344044
344935
|
return (source && source.footerNote) || footerNote
|
|
@@ -345877,9 +346768,12 @@ var script$2M = {
|
|
|
345877
346768
|
}
|
|
345878
346769
|
const params = (this.$route && this.$route.params) || {};
|
|
345879
346770
|
const ctx = typeof this.selfFetchTokenCtx === 'function' ? this.selfFetchTokenCtx() : {};
|
|
345880
|
-
const
|
|
346771
|
+
const pageFilter = resolveFilterMap(this.filter, params, ctx);
|
|
346772
|
+
const filtered = { ...pageFilter, ...(this.effectiveActiveFilters || {}) };
|
|
345881
346773
|
const results = {};
|
|
345882
346774
|
await Promise.all(entries.map(async ([name, cfg]) => {
|
|
346775
|
+
// `unfiltered`: the whole list under the page's own filter, not the user's.
|
|
346776
|
+
const base = cfg && cfg.unfiltered === true ? pageFilter : filtered;
|
|
345883
346777
|
try {
|
|
345884
346778
|
let value;
|
|
345885
346779
|
if (cfg && typeof cfg.endpoint === 'string' && cfg.endpoint !== '') {
|
|
@@ -349055,7 +349949,7 @@ var script$2M = {
|
|
|
349055
349949
|
return !!this.$route && tab.to.name !== undefined && this.$route.name === tab.to.name
|
|
349056
349950
|
}
|
|
349057
349951
|
const path = this.$route && this.$route.path;
|
|
349058
|
-
return !!path && String(path)
|
|
349952
|
+
return !!path && stripTrailingSlashes(String(path)) === stripTrailingSlashes(String(tab.to))
|
|
349059
349953
|
},
|
|
349060
349954
|
|
|
349061
349955
|
/**
|
|
@@ -358962,552 +359856,6 @@ function savedUuid(saved) {
|
|
|
358962
359856
|
return String(saved?.['@self']?.id || saved?.uuid || saved?.id || '')
|
|
358963
359857
|
}
|
|
358964
359858
|
|
|
358965
|
-
/**
|
|
358966
|
-
* SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
358967
|
-
* SPDX-License-Identifier: EUPL-1.2
|
|
358968
|
-
*
|
|
358969
|
-
* Who holds which right on one OpenRegister object, and where each grant came
|
|
358970
|
-
* from. The reads behind CnObjectPermissionsTab.
|
|
358971
|
-
*
|
|
358972
|
-
* Every function here is a read. Nothing decides who may open an object: the
|
|
358973
|
-
* grant, its provenance, the deny and the inheritance live in OpenRegister, and
|
|
358974
|
-
* these helpers hand on what it answered. A deny is never subtracted from a
|
|
358975
|
-
* grant, a missing answer is never filled with a default, and nothing is
|
|
358976
|
-
* cached: a copy of an access decision is a second decision nobody updates.
|
|
358977
|
-
*
|
|
358978
|
-
* The object's own permission set (`/permissions`) is preferred; an older
|
|
358979
|
-
* OpenRegister answers 404 to it, and then five reads are the fallback:
|
|
358980
|
-
*
|
|
358981
|
-
* GET {apiBase}/permissions the verb catalogue + deny mode
|
|
358982
|
-
* GET {apiBase}/objects/{register}/{schema}/{id}/shares grants written on the object
|
|
358983
|
-
* GET {apiBase}/permissions/compare-roles?register= each role and its verbs
|
|
358984
|
-
* GET {apiBase}/scopes?register=&schema= the caller's own verdict + provenance
|
|
358985
|
-
* GET {apiBase}/permissions/deny-preview?register=&schema= the deny rules as written
|
|
358986
|
-
*
|
|
358987
|
-
* plus the history read `{...}/{id}/permissions/history?at=` for "who held a
|
|
358988
|
-
* right on a date".
|
|
358989
|
-
*
|
|
358990
|
-
* A failed read answers `null`, never `[]`: "we could not ask" and "nobody
|
|
358991
|
-
* holds this" are opposite answers that would otherwise render as the same
|
|
358992
|
-
* empty table.
|
|
358993
|
-
*/
|
|
358994
|
-
|
|
358995
|
-
/** The OpenRegister API root a target defaults to. */
|
|
358996
|
-
const DEFAULT_API_BASE = '/apps/openregister/api';
|
|
358997
|
-
|
|
358998
|
-
/**
|
|
358999
|
-
* Normalise a target to `{register, schema, apiBase}`.
|
|
359000
|
-
*
|
|
359001
|
-
* @param {object} target The object's register, schema and optional apiBase.
|
|
359002
|
-
* @return {{register: string, schema: string, apiBase: string}} The target.
|
|
359003
|
-
*/
|
|
359004
|
-
function normalise$1(target = {}) {
|
|
359005
|
-
return {
|
|
359006
|
-
register: String(target.register || ''),
|
|
359007
|
-
schema: String(target.schema || ''),
|
|
359008
|
-
apiBase: String(target.apiBase || DEFAULT_API_BASE).replace(/\/$/, ''),
|
|
359009
|
-
}
|
|
359010
|
-
}
|
|
359011
|
-
|
|
359012
|
-
/**
|
|
359013
|
-
* GET one path, keeping the status beside the body.
|
|
359014
|
-
*
|
|
359015
|
-
* The status is part of the answer: a 403 on the access set means the reader
|
|
359016
|
-
* may open the object and may not enumerate who else can, which is not a
|
|
359017
|
-
* failed read. A transport failure has no status and reports 0. A non-JSON
|
|
359018
|
-
* body (the SPA shell answering 200) is a failed read, not "no rules".
|
|
359019
|
-
*
|
|
359020
|
-
* @param {string} url App-absolute URL.
|
|
359021
|
-
* @param {object} params Query parameters.
|
|
359022
|
-
* @return {Promise<{status: number, data: object|null}>} The status and the body.
|
|
359023
|
-
*/
|
|
359024
|
-
async function readResult(url, params = {}) {
|
|
359025
|
-
try {
|
|
359026
|
-
const response = await axios$1.get(prefixUrl(url), { params });
|
|
359027
|
-
if (typeof response?.data !== 'object' || response.data === null) {
|
|
359028
|
-
return { status: response?.status || 0, data: null }
|
|
359029
|
-
}
|
|
359030
|
-
return { status: response.status || 200, data: response.data }
|
|
359031
|
-
} catch (error) {
|
|
359032
|
-
return { status: error?.response?.status || 0, data: null }
|
|
359033
|
-
}
|
|
359034
|
-
}
|
|
359035
|
-
|
|
359036
|
-
/**
|
|
359037
|
-
* GET one path, answering null when it cannot be read.
|
|
359038
|
-
*
|
|
359039
|
-
* @param {string} url App-absolute URL.
|
|
359040
|
-
* @param {object} params Query parameters.
|
|
359041
|
-
* @return {Promise<object|null>} The body, or null.
|
|
359042
|
-
*/
|
|
359043
|
-
async function read(url, params = {}) {
|
|
359044
|
-
const { data } = await readResult(url, params);
|
|
359045
|
-
return data
|
|
359046
|
-
}
|
|
359047
|
-
|
|
359048
|
-
/**
|
|
359049
|
-
* The URL of one object, under its target.
|
|
359050
|
-
*
|
|
359051
|
-
* @param {object} target The target.
|
|
359052
|
-
* @param {string} objectId The object id.
|
|
359053
|
-
* @param {string} [schema] A schema other than the target's.
|
|
359054
|
-
* @return {string} The URL.
|
|
359055
|
-
*/
|
|
359056
|
-
function objectUrl(target, objectId, schema) {
|
|
359057
|
-
const { register, apiBase } = normalise$1(target);
|
|
359058
|
-
return `${apiBase}/objects/${register}/${schema || normalise$1(target).schema}/${objectId}`
|
|
359059
|
-
}
|
|
359060
|
-
|
|
359061
|
-
/**
|
|
359062
|
-
* The grantable verbs and the deny enforcement mode.
|
|
359063
|
-
*
|
|
359064
|
-
* @param {object} target The target (only `apiBase` is read).
|
|
359065
|
-
* @return {Promise<object|null>} `{permissions, denyEnforcement}`, or null.
|
|
359066
|
-
*/
|
|
359067
|
-
function fetchPermissionCatalogue(target) {
|
|
359068
|
-
return read(`${normalise$1(target).apiBase}/permissions`)
|
|
359069
|
-
}
|
|
359070
|
-
|
|
359071
|
-
/**
|
|
359072
|
-
* The grants written on one object.
|
|
359073
|
-
*
|
|
359074
|
-
* @param {object} target The target.
|
|
359075
|
-
* @param {string} objectId The object id.
|
|
359076
|
-
* @return {Promise<Array|null>} The grants, or null.
|
|
359077
|
-
*/
|
|
359078
|
-
async function fetchObjectGrants(target, objectId) {
|
|
359079
|
-
const body = await read(`${objectUrl(target, objectId)}/shares`);
|
|
359080
|
-
if (body === null || !Array.isArray(body.results)) {
|
|
359081
|
-
return null
|
|
359082
|
-
}
|
|
359083
|
-
return body.results
|
|
359084
|
-
}
|
|
359085
|
-
|
|
359086
|
-
/**
|
|
359087
|
-
* Each role in the register and the verbs it holds.
|
|
359088
|
-
*
|
|
359089
|
-
* @param {object} target The target.
|
|
359090
|
-
* @return {Promise<object|null>} `{roles}`, or null.
|
|
359091
|
-
*/
|
|
359092
|
-
function fetchRoleGrants(target) {
|
|
359093
|
-
const { apiBase, register } = normalise$1(target);
|
|
359094
|
-
return read(`${apiBase}/permissions/compare-roles`, { register })
|
|
359095
|
-
}
|
|
359096
|
-
|
|
359097
|
-
/**
|
|
359098
|
-
* The caller's own effective verbs on the schema, with their provenance.
|
|
359099
|
-
*
|
|
359100
|
-
* The endpoint answers a matrix even when narrowed, so the row is picked by
|
|
359101
|
-
* schema name rather than by position.
|
|
359102
|
-
*
|
|
359103
|
-
* @param {object} target The target.
|
|
359104
|
-
* @return {Promise<object|null>} The scope entry, or null.
|
|
359105
|
-
*/
|
|
359106
|
-
async function fetchCallerScope(target) {
|
|
359107
|
-
const { apiBase, register, schema } = normalise$1(target);
|
|
359108
|
-
const body = await read(`${apiBase}/scopes`, { register, schema });
|
|
359109
|
-
if (body === null || !Array.isArray(body.scopes)) {
|
|
359110
|
-
return null
|
|
359111
|
-
}
|
|
359112
|
-
const scope = body.scopes.find((entry) => entry?.schema === schema);
|
|
359113
|
-
if (!scope) {
|
|
359114
|
-
return null
|
|
359115
|
-
}
|
|
359116
|
-
return { user: body.user, isAdmin: body.isAdmin, groups: body.groups, ...scope }
|
|
359117
|
-
}
|
|
359118
|
-
|
|
359119
|
-
/**
|
|
359120
|
-
* The deny rules as written for the register and schema.
|
|
359121
|
-
*
|
|
359122
|
-
* @param {object} target The target.
|
|
359123
|
-
* @return {Promise<object|null>} `{denyEnforcement, enforcing, rules}`, or null.
|
|
359124
|
-
*/
|
|
359125
|
-
function fetchDenyRules(target) {
|
|
359126
|
-
const { apiBase, register, schema } = normalise$1(target);
|
|
359127
|
-
return read(`${apiBase}/permissions/deny-preview`, { register, schema })
|
|
359128
|
-
}
|
|
359129
|
-
|
|
359130
|
-
/**
|
|
359131
|
-
* The permission set OpenRegister publishes for this object, with its status.
|
|
359132
|
-
*
|
|
359133
|
-
* @param {object} target The target.
|
|
359134
|
-
* @param {string} objectId The object id.
|
|
359135
|
-
* @return {Promise<{status: number, set: object|null}>} The status and the set.
|
|
359136
|
-
*/
|
|
359137
|
-
async function fetchObjectPermissions(target, objectId) {
|
|
359138
|
-
const { status, data } = await readResult(`${objectUrl(target, objectId)}/permissions`);
|
|
359139
|
-
if (data === null || Array.isArray(data.holders) === false) {
|
|
359140
|
-
return { status, set: null }
|
|
359141
|
-
}
|
|
359142
|
-
return { status, set: data }
|
|
359143
|
-
}
|
|
359144
|
-
|
|
359145
|
-
/**
|
|
359146
|
-
* The set as it stood at a moment, from the object's audit trail.
|
|
359147
|
-
*
|
|
359148
|
-
* @param {object} target The target.
|
|
359149
|
-
* @param {string} objectId The object id.
|
|
359150
|
-
* @param {string} at An ISO-8601 moment.
|
|
359151
|
-
* @return {Promise<{status: number, history: object|null}>} The status and the history.
|
|
359152
|
-
*/
|
|
359153
|
-
async function fetchAccessHistory(target, objectId, at) {
|
|
359154
|
-
const { status, data } = await readResult(`${objectUrl(target, objectId)}/permissions/history`, { at });
|
|
359155
|
-
if (data === null || Array.isArray(data.changes) === false) {
|
|
359156
|
-
return { status, history: null }
|
|
359157
|
-
}
|
|
359158
|
-
return { status, history: data }
|
|
359159
|
-
}
|
|
359160
|
-
|
|
359161
|
-
/**
|
|
359162
|
-
* The end and the area written on one rule, as OpenRegister reported them.
|
|
359163
|
-
*
|
|
359164
|
-
* Neither is compared to anything: whether an expired grant still answers is
|
|
359165
|
-
* resolved in OpenRegister. A role grant carries the whole holder list, so the
|
|
359166
|
-
* entry naming this principal is picked out of it.
|
|
359167
|
-
*
|
|
359168
|
-
* @param {object|Array|string|null} rule The rule as written.
|
|
359169
|
-
* @param {string} principal The holder of the row.
|
|
359170
|
-
* @return {{until: string, scopedTo: object|null}} The end and the area.
|
|
359171
|
-
*/
|
|
359172
|
-
function constraintsOf(rule, principal) {
|
|
359173
|
-
const none = { until: '', scopedTo: null };
|
|
359174
|
-
if (rule === null || typeof rule !== 'object') {
|
|
359175
|
-
return none
|
|
359176
|
-
}
|
|
359177
|
-
|
|
359178
|
-
let entry = rule;
|
|
359179
|
-
if (Array.isArray(rule)) {
|
|
359180
|
-
entry = rule.find((candidate) => candidate === principal
|
|
359181
|
-
|| (candidate !== null
|
|
359182
|
-
&& typeof candidate === 'object'
|
|
359183
|
-
&& [candidate.principal, candidate.group, candidate.role, candidate.user].includes(principal)));
|
|
359184
|
-
}
|
|
359185
|
-
|
|
359186
|
-
if (entry === null || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
359187
|
-
return none
|
|
359188
|
-
}
|
|
359189
|
-
|
|
359190
|
-
return {
|
|
359191
|
-
until: typeof entry.until === 'string' ? entry.until : '',
|
|
359192
|
-
scopedTo: entry.scopedTo || null,
|
|
359193
|
-
}
|
|
359194
|
-
}
|
|
359195
|
-
|
|
359196
|
-
/**
|
|
359197
|
-
* One reported rule as a row.
|
|
359198
|
-
*
|
|
359199
|
-
* @param {object} rule The rule.
|
|
359200
|
-
* @param {boolean} refusing Whether the rule takes a right away.
|
|
359201
|
-
* @param {boolean} enforcing Whether refusals are in force.
|
|
359202
|
-
* @return {object} The row.
|
|
359203
|
-
*/
|
|
359204
|
-
function ruleRow(rule, refusing, enforcing) {
|
|
359205
|
-
const principal = rule?.principal || '';
|
|
359206
|
-
const { until, scopedTo } = constraintsOf(rule?.rule ?? null, principal);
|
|
359207
|
-
|
|
359208
|
-
let source = rule?.level || 'object';
|
|
359209
|
-
if (refusing === true) {
|
|
359210
|
-
source = enforcing === true ? 'deny' : 'staged-deny';
|
|
359211
|
-
}
|
|
359212
|
-
|
|
359213
|
-
return {
|
|
359214
|
-
holder: principal,
|
|
359215
|
-
right: rule?.action || '',
|
|
359216
|
-
source,
|
|
359217
|
-
detail: rule?.role || '',
|
|
359218
|
-
inheritedFrom: rule?.inheritedFrom || '',
|
|
359219
|
-
level: rule?.level || '',
|
|
359220
|
-
role: rule?.role || '',
|
|
359221
|
-
declared: rule?.declared !== false,
|
|
359222
|
-
conditional: rule?.conditional === true,
|
|
359223
|
-
until,
|
|
359224
|
-
scopedTo,
|
|
359225
|
-
}
|
|
359226
|
-
}
|
|
359227
|
-
|
|
359228
|
-
/**
|
|
359229
|
-
* The object's own permission set as rows. A deny is its own row.
|
|
359230
|
-
*
|
|
359231
|
-
* @param {object|null} set The set from `fetchObjectPermissions`.
|
|
359232
|
-
* @return {Array<object>} The rows.
|
|
359233
|
-
*/
|
|
359234
|
-
function objectPermissionRows(set) {
|
|
359235
|
-
if (set === null || typeof set !== 'object') {
|
|
359236
|
-
return []
|
|
359237
|
-
}
|
|
359238
|
-
|
|
359239
|
-
const enforcing = set.denyEnforcement === 'enforcing';
|
|
359240
|
-
const rows = [];
|
|
359241
|
-
for (const holder of set.holders || []) {
|
|
359242
|
-
for (const rule of holder?.rules || []) {
|
|
359243
|
-
rows.push(ruleRow(rule, false, enforcing));
|
|
359244
|
-
}
|
|
359245
|
-
}
|
|
359246
|
-
for (const rule of set.denied || []) {
|
|
359247
|
-
rows.push(ruleRow(rule, true, enforcing));
|
|
359248
|
-
}
|
|
359249
|
-
return rows
|
|
359250
|
-
}
|
|
359251
|
-
|
|
359252
|
-
/**
|
|
359253
|
-
* The set as it stood at the moment asked about.
|
|
359254
|
-
*
|
|
359255
|
-
* `asOf: null` (the trail does not reach back that far) is "unanswered", never
|
|
359256
|
-
* an empty table: an empty table would claim nobody held a right that day.
|
|
359257
|
-
*
|
|
359258
|
-
* @param {object|null} history The history from `fetchAccessHistory`.
|
|
359259
|
-
* @return {{answered: boolean, at: string, rows: Array<object>, setBy: string, changedAfterwardsBy: object|null}} The answer.
|
|
359260
|
-
*/
|
|
359261
|
-
function asOfRows(history) {
|
|
359262
|
-
const unanswered = { answered: false, at: history?.at || '', rows: [], setBy: '', changedAfterwardsBy: null };
|
|
359263
|
-
|
|
359264
|
-
const asOf = history?.asOf || null;
|
|
359265
|
-
if (asOf === null || typeof asOf !== 'object') {
|
|
359266
|
-
return unanswered
|
|
359267
|
-
}
|
|
359268
|
-
|
|
359269
|
-
const rows = [];
|
|
359270
|
-
for (const holder of asOf.holders || []) {
|
|
359271
|
-
for (const rule of holder?.rules || []) {
|
|
359272
|
-
rows.push(ruleRow(rule, false, false));
|
|
359273
|
-
}
|
|
359274
|
-
}
|
|
359275
|
-
|
|
359276
|
-
return {
|
|
359277
|
-
answered: true,
|
|
359278
|
-
at: asOf.at || history?.at || '',
|
|
359279
|
-
rows,
|
|
359280
|
-
setBy: asOf.setBy || '',
|
|
359281
|
-
changedAfterwardsBy: asOf.changedAfterwardsBy || null,
|
|
359282
|
-
}
|
|
359283
|
-
}
|
|
359284
|
-
|
|
359285
|
-
/**
|
|
359286
|
-
* All answers as one list of rows. A renderer, not an evaluator: each row
|
|
359287
|
-
* restates ONE reported rule, and no row is the product of two.
|
|
359288
|
-
*
|
|
359289
|
-
* When the object answered for itself the share, role and deny reads are not
|
|
359290
|
-
* replayed on top (the same grant would be counted twice). The caller's own
|
|
359291
|
-
* verdict always rides along last, because it is the one answer about this
|
|
359292
|
-
* reader rather than a rule about everybody.
|
|
359293
|
-
*
|
|
359294
|
-
* @param {object} answers The reads.
|
|
359295
|
-
* @param {object|null} answers.objectPermissions The object's own set.
|
|
359296
|
-
* @param {Array|null} answers.objectGrants Grants on the object.
|
|
359297
|
-
* @param {object|null} answers.roleGrants Roles and their verbs.
|
|
359298
|
-
* @param {object|null} answers.callerScope The caller's own verdict.
|
|
359299
|
-
* @param {object|null} answers.denyRules The deny rules.
|
|
359300
|
-
* @return {Array<object>} The rows.
|
|
359301
|
-
*/
|
|
359302
|
-
function grantRows({ objectPermissions = null, objectGrants, roleGrants, callerScope, denyRules }) {
|
|
359303
|
-
const rows = [];
|
|
359304
|
-
|
|
359305
|
-
if (objectPermissions !== null) {
|
|
359306
|
-
rows.push(...objectPermissionRows(objectPermissions));
|
|
359307
|
-
}
|
|
359308
|
-
|
|
359309
|
-
for (const grant of (objectPermissions === null ? objectGrants : null) || []) {
|
|
359310
|
-
for (const right of grant?.actions || []) {
|
|
359311
|
-
rows.push({
|
|
359312
|
-
holder: grant.principal || grant.userId || grant.groupId || '',
|
|
359313
|
-
right,
|
|
359314
|
-
// `inheritedFrom` is the id of the ancestor, not a source key.
|
|
359315
|
-
source: grant.source || (grant.inheritedFrom ? 'inherited' : 'share'),
|
|
359316
|
-
inheritedFrom: grant.inheritedFrom || '',
|
|
359317
|
-
detail: grant.expires ? String(grant.expires) : '',
|
|
359318
|
-
});
|
|
359319
|
-
}
|
|
359320
|
-
}
|
|
359321
|
-
|
|
359322
|
-
for (const role of (objectPermissions === null ? roleGrants?.roles : null) || []) {
|
|
359323
|
-
for (const right of role?.actions || []) {
|
|
359324
|
-
rows.push({ holder: role.role || '', right, source: 'role', detail: '' });
|
|
359325
|
-
}
|
|
359326
|
-
}
|
|
359327
|
-
|
|
359328
|
-
for (const rule of (objectPermissions === null ? denyRules?.rules : null) || []) {
|
|
359329
|
-
rows.push({
|
|
359330
|
-
holder: rule.principal || '',
|
|
359331
|
-
right: rule.action || '',
|
|
359332
|
-
source: denyRules.enforcing ? 'deny' : 'staged-deny',
|
|
359333
|
-
detail: rule.level ? `${rule.level}: ${rule.subject || ''}` : '',
|
|
359334
|
-
});
|
|
359335
|
-
}
|
|
359336
|
-
|
|
359337
|
-
for (const [right, record] of Object.entries(callerScope?.provenance || {})) {
|
|
359338
|
-
rows.push({
|
|
359339
|
-
holder: callerScope.user || '',
|
|
359340
|
-
right,
|
|
359341
|
-
source: record?.source || 'unknown',
|
|
359342
|
-
granted: record?.granted,
|
|
359343
|
-
detail: record?.role || record?.principal || '',
|
|
359344
|
-
stagedDeny: record?.stagedDeny || null,
|
|
359345
|
-
});
|
|
359346
|
-
}
|
|
359347
|
-
|
|
359348
|
-
return rows
|
|
359349
|
-
}
|
|
359350
|
-
|
|
359351
|
-
/**
|
|
359352
|
-
* The id a reference carries, as a uuid string or as an expanded object.
|
|
359353
|
-
*
|
|
359354
|
-
* @param {unknown} value The reference.
|
|
359355
|
-
* @return {string} The id, or ''.
|
|
359356
|
-
*/
|
|
359357
|
-
function referenceId$1(value) {
|
|
359358
|
-
if (value && typeof value === 'object') {
|
|
359359
|
-
return String(value['@self']?.id ?? value.id ?? value.uuid ?? '')
|
|
359360
|
-
}
|
|
359361
|
-
return String(value ?? '')
|
|
359362
|
-
}
|
|
359363
|
-
|
|
359364
|
-
/**
|
|
359365
|
-
* The object's decided field rules, and the per-role field rules its TYPE
|
|
359366
|
-
* object declares.
|
|
359367
|
-
*
|
|
359368
|
-
* Two reads, because they answer different questions: `@self.fieldRules` is
|
|
359369
|
-
* what OpenRegister decided for THIS reader, the declaration on the type
|
|
359370
|
-
* object is the rule behind it. Neither is evaluated here.
|
|
359371
|
-
*
|
|
359372
|
-
* @param {object} target The target.
|
|
359373
|
-
* @param {string} objectId The object id.
|
|
359374
|
-
* @param {object} config Where the declaration lives.
|
|
359375
|
-
* @param {string} config.typeField Field on the object referencing its type object.
|
|
359376
|
-
* @param {string} config.typeSchema Schema of the type object (same register).
|
|
359377
|
-
* @param {string} [config.declarationField] Field on the type object holding the rules.
|
|
359378
|
-
* @return {Promise<{decided: object|null, declared: Array<object>|null}>} The answer.
|
|
359379
|
-
*/
|
|
359380
|
-
async function fetchFieldRoleRules(target, objectId, config) {
|
|
359381
|
-
if (!objectId || !config?.typeField || !config?.typeSchema) {
|
|
359382
|
-
return { decided: null, declared: null }
|
|
359383
|
-
}
|
|
359384
|
-
|
|
359385
|
-
const object = await read(objectUrl(target, objectId));
|
|
359386
|
-
if (object === null) {
|
|
359387
|
-
return { decided: null, declared: null }
|
|
359388
|
-
}
|
|
359389
|
-
|
|
359390
|
-
const decided = object['@self']?.fieldRules ?? null;
|
|
359391
|
-
const typeId = referenceId$1(object[config.typeField]);
|
|
359392
|
-
if (!typeId) {
|
|
359393
|
-
return { decided, declared: null }
|
|
359394
|
-
}
|
|
359395
|
-
|
|
359396
|
-
const type = await read(objectUrl(target, typeId, config.typeSchema));
|
|
359397
|
-
if (type === null) {
|
|
359398
|
-
return { decided, declared: null }
|
|
359399
|
-
}
|
|
359400
|
-
|
|
359401
|
-
const declared = type[config.declarationField || 'fieldRoleRules'];
|
|
359402
|
-
return { decided, declared: Array.isArray(declared) ? declared : [] }
|
|
359403
|
-
}
|
|
359404
|
-
|
|
359405
|
-
/**
|
|
359406
|
-
* The two things a role rule can do to a field. The spelling is OpenRegister's
|
|
359407
|
-
* contract (`hidden`, `readOnly`); any other rule is dropped.
|
|
359408
|
-
*/
|
|
359409
|
-
const ROLE_RULES = ['hidden', 'readOnly'];
|
|
359410
|
-
|
|
359411
|
-
/**
|
|
359412
|
-
* The reader's word for each field rule.
|
|
359413
|
-
*
|
|
359414
|
-
* @return {object} The labels, by rule id.
|
|
359415
|
-
*/
|
|
359416
|
-
function roleRuleLabels() {
|
|
359417
|
-
return {
|
|
359418
|
-
hidden: l10n.translate('nextcloud-vue', 'Not shown'),
|
|
359419
|
-
readOnly: l10n.translate('nextcloud-vue', 'Cannot be changed'),
|
|
359420
|
-
}
|
|
359421
|
-
}
|
|
359422
|
-
|
|
359423
|
-
/**
|
|
359424
|
-
* A declared list of names, blanks and repeats removed.
|
|
359425
|
-
*
|
|
359426
|
-
* @param {unknown} value The list.
|
|
359427
|
-
* @return {Array<string>} The names.
|
|
359428
|
-
*/
|
|
359429
|
-
function names(value) {
|
|
359430
|
-
if (Array.isArray(value) === false) {
|
|
359431
|
-
return []
|
|
359432
|
-
}
|
|
359433
|
-
const found = [];
|
|
359434
|
-
value.forEach((entry) => {
|
|
359435
|
-
const name = String(entry ?? '').trim();
|
|
359436
|
-
if (name !== '' && found.includes(name) === false) {
|
|
359437
|
-
found.push(name);
|
|
359438
|
-
}
|
|
359439
|
-
});
|
|
359440
|
-
return found
|
|
359441
|
-
}
|
|
359442
|
-
|
|
359443
|
-
/**
|
|
359444
|
-
* Whether OpenRegister applied this rule to the reader. False when the object
|
|
359445
|
-
* carries no decision at all (an older OpenRegister), never invented.
|
|
359446
|
-
*
|
|
359447
|
-
* @param {string} field The field.
|
|
359448
|
-
* @param {string} rule The rule.
|
|
359449
|
-
* @param {object|null} decided The object's `@self.fieldRules`.
|
|
359450
|
-
* @return {boolean} True when the reader met this rule.
|
|
359451
|
-
*/
|
|
359452
|
-
function appliesToMe(field, rule, decided) {
|
|
359453
|
-
const applied = decided?.[rule];
|
|
359454
|
-
if (Array.isArray(applied) === false) {
|
|
359455
|
-
return false
|
|
359456
|
-
}
|
|
359457
|
-
return applied.map((name) => String(name)).includes(field)
|
|
359458
|
-
}
|
|
359459
|
-
|
|
359460
|
-
/**
|
|
359461
|
-
* The declared field rules as rows. A row naming no field, or an unknown rule,
|
|
359462
|
-
* is dropped rather than rendered blank.
|
|
359463
|
-
*
|
|
359464
|
-
* @param {Array<object>|null} declared The declaration.
|
|
359465
|
-
* @param {object|null} decided The object's `@self.fieldRules`.
|
|
359466
|
-
* @return {Array<object>} The rows.
|
|
359467
|
-
*/
|
|
359468
|
-
function fieldRoleRows(declared, decided) {
|
|
359469
|
-
if (Array.isArray(declared) === false) {
|
|
359470
|
-
return []
|
|
359471
|
-
}
|
|
359472
|
-
|
|
359473
|
-
return declared
|
|
359474
|
-
.filter((rule) => rule && ROLE_RULES.includes(rule.rule) && typeof rule.field === 'string' && rule.field.trim() !== '')
|
|
359475
|
-
.map((rule) => {
|
|
359476
|
-
const field = rule.field.trim();
|
|
359477
|
-
return {
|
|
359478
|
-
field,
|
|
359479
|
-
rule: rule.rule,
|
|
359480
|
-
groups: names(rule.groups),
|
|
359481
|
-
heldBy: names(rule.heldBy),
|
|
359482
|
-
reason: String(rule.reason ?? '').trim(),
|
|
359483
|
-
appliesToMe: appliesToMe(field, rule.rule, decided),
|
|
359484
|
-
}
|
|
359485
|
-
})
|
|
359486
|
-
}
|
|
359487
|
-
|
|
359488
|
-
/**
|
|
359489
|
-
* One field-rule row as a whole sentence (whole sentences, so a translator can
|
|
359490
|
-
* reorder the groups).
|
|
359491
|
-
*
|
|
359492
|
-
* @param {object} row One row from `fieldRoleRows`.
|
|
359493
|
-
* @return {string} The sentence.
|
|
359494
|
-
*/
|
|
359495
|
-
function roleRuleSentence(row) {
|
|
359496
|
-
const groups = row?.groups?.join(', ') ?? '';
|
|
359497
|
-
const heldBy = row?.heldBy?.join(', ') ?? '';
|
|
359498
|
-
|
|
359499
|
-
if (row?.rule === 'hidden' && heldBy !== '') {
|
|
359500
|
-
return l10n.translate('nextcloud-vue', '{groups} do not see this field. {heldBy} do.', { groups, heldBy })
|
|
359501
|
-
}
|
|
359502
|
-
if (row?.rule === 'hidden') {
|
|
359503
|
-
return l10n.translate('nextcloud-vue', '{groups} do not see this field.', { groups })
|
|
359504
|
-
}
|
|
359505
|
-
if (heldBy !== '') {
|
|
359506
|
-
return l10n.translate('nextcloud-vue', '{groups} cannot change this field. {heldBy} can.', { groups, heldBy })
|
|
359507
|
-
}
|
|
359508
|
-
return l10n.translate('nextcloud-vue', '{groups} cannot change this field.', { groups })
|
|
359509
|
-
}
|
|
359510
|
-
|
|
359511
359859
|
let uid = 0;
|
|
359512
359860
|
|
|
359513
359861
|
/**
|
|
@@ -359551,13 +359899,15 @@ function defaultLabels$1() {
|
|
|
359551
359899
|
*
|
|
359552
359900
|
* `manage` lets a reader change the parties through OpenRegister's party
|
|
359553
359901
|
* API, which asks the record's update right on every write: `add` (`{ label?,
|
|
359554
|
-
* dialogTitle?, kind?, sources, create?, primary?, confirmLabel? }`) opens a
|
|
359902
|
+
* dialogTitle?, kind?, sources, create?, primary?, confirmLabel?, placement? }`) opens a
|
|
359555
359903
|
* dialog to pick somebody known or describe somebody new (`create: {
|
|
359556
359904
|
* register, schema, label?, fields, compose? }`, see `newPartyRecord`), choose
|
|
359557
359905
|
* a role and optionally make them the primary party; `remove` (`{ title?,
|
|
359558
359906
|
* message?, confirmLabel? }`, `{name}` and `{role}` in the message) takes a
|
|
359559
359907
|
* party off in one role. Both are hidden when OpenRegister says the reader
|
|
359560
|
-
* may not update the schema; a refusal is shown, never swallowed.
|
|
359908
|
+
* may not update the schema; a refusal is shown, never swallowed. With
|
|
359909
|
+
* `add.placement: "title"` the add button is reported to the card's title
|
|
359910
|
+
* row (the `header` event) instead of drawn above the parties.
|
|
359561
359911
|
*
|
|
359562
359912
|
* `presentation: "primary"` draws only the primary party, as a side card
|
|
359563
359913
|
* does: initials, name and role label, its correspondence e-mail, and
|
|
@@ -359619,6 +359969,8 @@ var script$2t = {
|
|
|
359619
359969
|
},
|
|
359620
359970
|
},
|
|
359621
359971
|
|
|
359972
|
+
emits: ['header'],
|
|
359973
|
+
|
|
359622
359974
|
data() {
|
|
359623
359975
|
uid += 1;
|
|
359624
359976
|
return {
|
|
@@ -359660,6 +360012,27 @@ var script$2t = {
|
|
|
359660
360012
|
return Boolean(this.manage.add) && this.mayUpdate && !this.isPrimaryPresentation && !this.loading && !this.failed
|
|
359661
360013
|
},
|
|
359662
360014
|
|
|
360015
|
+
/** @return {boolean} Whether the add button goes to the card's title row. */
|
|
360016
|
+
addInTitle() {
|
|
360017
|
+
return this.manage.add?.placement === 'title'
|
|
360018
|
+
},
|
|
360019
|
+
|
|
360020
|
+
/**
|
|
360021
|
+
* The title-row actions: the add button when it is placed there.
|
|
360022
|
+
*
|
|
360023
|
+
* @spec openspec/changes/parties-add-in-title-row/specs/record-widgets/spec.md#requirement-a-parties-card-can-put-its-add-button-in-the-title-row
|
|
360024
|
+
* @return {Array<object>} The actions.
|
|
360025
|
+
*/
|
|
360026
|
+
titleActions() {
|
|
360027
|
+
if (!(this.addInTitle && this.canAdd)) {
|
|
360028
|
+
return []
|
|
360029
|
+
}
|
|
360030
|
+
const run = () => {
|
|
360031
|
+
this.adding = true;
|
|
360032
|
+
};
|
|
360033
|
+
return [{ key: 'add', label: this.manageWord('add', 'label', l10n.translate('nextcloud-vue', 'Add a party')), icon: 'Plus', variant: 'secondary', run }]
|
|
360034
|
+
},
|
|
360035
|
+
|
|
359663
360036
|
/** @return {boolean} Whether each party offers its remove button. */
|
|
359664
360037
|
canRemove() {
|
|
359665
360038
|
return Boolean(this.manage.remove) && this.mayUpdate && !this.isPrimaryPresentation
|
|
@@ -359798,6 +360171,18 @@ var script$2t = {
|
|
|
359798
360171
|
},
|
|
359799
360172
|
|
|
359800
360173
|
watch: {
|
|
360174
|
+
titleActions: {
|
|
360175
|
+
immediate: true,
|
|
360176
|
+
handler(actions) {
|
|
360177
|
+
if (this.addInTitle) {
|
|
360178
|
+
/**
|
|
360179
|
+
* @event header The card's title-row actions, `{ actions }`, for the host to draw.
|
|
360180
|
+
*/
|
|
360181
|
+
this.$emit('header', { actions });
|
|
360182
|
+
}
|
|
360183
|
+
},
|
|
360184
|
+
},
|
|
360185
|
+
|
|
359801
360186
|
recordKey: {
|
|
359802
360187
|
immediate: true,
|
|
359803
360188
|
handler() {
|
|
@@ -360370,7 +360755,7 @@ function render$2s(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
360370
360755
|
class: vue$1.normalizeClass(["cn-object-parties", { 'cn-object-parties--board': $options.isBoard }]),
|
|
360371
360756
|
"data-testid": "cn-object-parties"
|
|
360372
360757
|
}, [
|
|
360373
|
-
($options.canAdd)
|
|
360758
|
+
($options.canAdd && !$options.addInTitle)
|
|
360374
360759
|
? (vue$1.openBlock(), vue$1.createElementBlock("div", _hoisted_1$2u, [
|
|
360375
360760
|
vue$1.createVNode(_component_NcButton, {
|
|
360376
360761
|
"data-testid": "cn-object-parties-add",
|
|
@@ -360657,7 +361042,7 @@ function render$2s(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
360657
361042
|
}
|
|
360658
361043
|
|
|
360659
361044
|
script$2t.render = render$2s;
|
|
360660
|
-
script$2t.__scopeId = "data-v-
|
|
361045
|
+
script$2t.__scopeId = "data-v-57dcd9b1";
|
|
360661
361046
|
const __sfc_main$2t = script$2t;
|
|
360662
361047
|
|
|
360663
361048
|
/**
|
|
@@ -407407,7 +407792,8 @@ var script$1w = {
|
|
|
407407
407792
|
if (reported && Number.isFinite(reported.count)) {
|
|
407408
407793
|
return title.replace(/\{count\}/g, String(reported.count))
|
|
407409
407794
|
}
|
|
407410
|
-
|
|
407795
|
+
const parts = title.split('{count}');
|
|
407796
|
+
return parts.map((part, i) => (i < parts.length - 1 ? part.trimEnd() : part)).join('').trim()
|
|
407411
407797
|
},
|
|
407412
407798
|
|
|
407413
407799
|
/**
|
|
@@ -409359,7 +409745,7 @@ function render$1v(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
409359
409745
|
}
|
|
409360
409746
|
|
|
409361
409747
|
script$1w.render = render$1v;
|
|
409362
|
-
script$1w.__scopeId = "data-v-
|
|
409748
|
+
script$1w.__scopeId = "data-v-6e71986b";
|
|
409363
409749
|
const __sfc_main$1w = script$1w;
|
|
409364
409750
|
|
|
409365
409751
|
var CnDashboardPage = /*#__PURE__*/Object.freeze({
|
|
@@ -414979,7 +415365,7 @@ var script$1k = {
|
|
|
414979
415365
|
*/
|
|
414980
415366
|
baseUrl() {
|
|
414981
415367
|
if (this.endpoint) {
|
|
414982
|
-
return this.endpoint
|
|
415368
|
+
return stripTrailingSlashes(this.endpoint)
|
|
414983
415369
|
}
|
|
414984
415370
|
const roots = (typeof window !== 'undefined' && window.OC && window.OC.appswebroots) || {};
|
|
414985
415371
|
const app = this.appCandidates.find((id) => Object.hasOwn(roots, id)) || this.appCandidates[0] || 'integriq';
|
|
@@ -415149,7 +415535,7 @@ function render$1j(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
415149
415535
|
}
|
|
415150
415536
|
|
|
415151
415537
|
script$1k.render = render$1j;
|
|
415152
|
-
script$1k.__scopeId = "data-v-
|
|
415538
|
+
script$1k.__scopeId = "data-v-9015bbf0";
|
|
415153
415539
|
const __sfc_main$1k = script$1k;
|
|
415154
415540
|
|
|
415155
415541
|
/**
|
|
@@ -438472,7 +438858,7 @@ function pageHasSplitView(page) {
|
|
|
438472
438858
|
* @spec openspec/changes/case-page-and-list-as-a-place/specs/index-page/spec.md
|
|
438473
438859
|
*/
|
|
438474
438860
|
function splitRoutePath(route) {
|
|
438475
|
-
const base = typeof route === 'string' ? route
|
|
438861
|
+
const base = typeof route === 'string' ? stripTrailingSlashes(route) : '';
|
|
438476
438862
|
const param = routeParamNames(base).includes('id') ? 'splitId' : 'id';
|
|
438477
438863
|
return `${base}/split/:${param}`
|
|
438478
438864
|
}
|