juizi.dashboard 1.0.0b1__tar.gz
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.
- juizi_dashboard-1.0.0b1/.github/workflows/ci.yml +31 -0
- juizi_dashboard-1.0.0b1/.github/workflows/release.yml +79 -0
- juizi_dashboard-1.0.0b1/.gitignore +6 -0
- juizi_dashboard-1.0.0b1/DECISIONS.md +493 -0
- juizi_dashboard-1.0.0b1/PKG-INFO +151 -0
- juizi_dashboard-1.0.0b1/PROGRESS.md +62 -0
- juizi_dashboard-1.0.0b1/README.md +128 -0
- juizi_dashboard-1.0.0b1/frontend/README.md +52 -0
- juizi_dashboard-1.0.0b1/frontend/package.json +17 -0
- juizi_dashboard-1.0.0b1/frontend/src/api.js +55 -0
- juizi_dashboard-1.0.0b1/frontend/src/components/ActivityDashboard.jsx +557 -0
- juizi_dashboard-1.0.0b1/frontend/src/components/DashboardChrome.jsx +60 -0
- juizi_dashboard-1.0.0b1/frontend/src/components/activity.scss +285 -0
- juizi_dashboard-1.0.0b1/frontend/src/components/juizi-dashboard.scss +581 -0
- juizi_dashboard-1.0.0b1/frontend/src/index.js +31 -0
- juizi_dashboard-1.0.0b1/frontend/src/offerAddon.js +56 -0
- juizi_dashboard-1.0.0b1/pyproject.toml +42 -0
- juizi_dashboard-1.0.0b1/ruff.toml +4 -0
- juizi_dashboard-1.0.0b1/scope.md +69 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/__init__.py +6 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/configure.zcml +94 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/controlpanel.py +18 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/interfaces.py +41 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/present.py +240 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/profiles/default/controlpanel.xml +9 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/profiles/default/metadata.xml +7 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/profiles/default/registry.xml +5 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/profiles/default/rolemap.xml +13 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/profiles/uninstall/controlpanel.xml +4 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/profiles/uninstall/metadata.xml +4 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/profiles/uninstall/registry.xml +5 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/profiles/uninstall/rolemap.xml +12 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/record.py +211 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/recorder.py +536 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/scripts.py +259 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/services.py +125 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/setuphandlers.py +52 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/testing.py +32 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/tests/__init__.py +0 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/tests/test_record.py +98 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/tests/test_recording.py +251 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/tests/test_services.py +302 -0
- juizi_dashboard-1.0.0b1/src/juizi/dashboard/tests/test_setup.py +174 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
lint:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: astral-sh/setup-uv@v5
|
|
14
|
+
# Rules live in ruff.toml: real errors only, no style or formatting.
|
|
15
|
+
- run: uvx ruff@0.11.13 check src
|
|
16
|
+
|
|
17
|
+
test:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
env:
|
|
20
|
+
PLONE_VERSION: "6.1.5"
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- uses: astral-sh/setup-uv@v5
|
|
24
|
+
- name: Install Plone and this package
|
|
25
|
+
run: |
|
|
26
|
+
uv venv --python 3.12 .venv
|
|
27
|
+
uv pip install --python .venv/bin/python \
|
|
28
|
+
-c https://dist.plone.org/release/${PLONE_VERSION}/constraints.txt \
|
|
29
|
+
Products.CMFPlone plone.restapi plone.app.contenttypes zope.testrunner \
|
|
30
|
+
horse-with-no-namespace -e ".[test]"
|
|
31
|
+
- run: .venv/bin/zope-testrunner --test-path src
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Publishing a GitHub Release (tag vX.Y.Z, e.g. v1.0.0b1) builds both
|
|
4
|
+
# packages and publishes juizi.dashboard to PyPI and volto-juizi-dashboard
|
|
5
|
+
# to npm. Both use trusted publishing (OIDC), so no tokens are stored here.
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
release:
|
|
9
|
+
types: [published]
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
check:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
outputs:
|
|
18
|
+
npm-tag: ${{ steps.versions.outputs.npm-tag }}
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
- uses: astral-sh/setup-uv@v5
|
|
22
|
+
- name: Tag matches both package versions
|
|
23
|
+
id: versions
|
|
24
|
+
env:
|
|
25
|
+
TAG: ${{ github.event.release.tag_name }}
|
|
26
|
+
run: |
|
|
27
|
+
uv run --no-project --with packaging python - <<'EOF'
|
|
28
|
+
import json, os, re
|
|
29
|
+
from packaging.version import Version
|
|
30
|
+
|
|
31
|
+
tag = Version(os.environ["TAG"].removeprefix("v"))
|
|
32
|
+
init = open("src/juizi/dashboard/__init__.py").read()
|
|
33
|
+
py = Version(re.search(r'__version__ = "([^"]+)"', init)[1])
|
|
34
|
+
npm = json.load(open("frontend/package.json"))["version"]
|
|
35
|
+
print(f"tag {tag}, Python {py}, npm {npm}")
|
|
36
|
+
# PEP 440 reads npm's 1.0.0-beta.1 as 1.0.0b1.
|
|
37
|
+
assert py == tag, "Python version doesn't match the tag"
|
|
38
|
+
assert Version(npm) == tag, "npm version doesn't match the tag"
|
|
39
|
+
assert not tag.is_devrelease, "dev versions aren't published"
|
|
40
|
+
npm_tag = "beta" if tag.is_prerelease else "latest"
|
|
41
|
+
with open(os.environ["GITHUB_OUTPUT"], "a") as out:
|
|
42
|
+
out.write(f"npm-tag={npm_tag}\n")
|
|
43
|
+
EOF
|
|
44
|
+
|
|
45
|
+
pypi:
|
|
46
|
+
needs: check
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
environment:
|
|
49
|
+
name: pypi
|
|
50
|
+
url: https://pypi.org/project/juizi.dashboard/
|
|
51
|
+
permissions:
|
|
52
|
+
id-token: write
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@v4
|
|
55
|
+
- uses: astral-sh/setup-uv@v5
|
|
56
|
+
- run: uv build
|
|
57
|
+
- run: uvx twine check dist/*
|
|
58
|
+
- run: uv publish --trusted-publishing always
|
|
59
|
+
|
|
60
|
+
npm:
|
|
61
|
+
needs: check
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
environment:
|
|
64
|
+
name: npm
|
|
65
|
+
url: https://www.npmjs.com/package/volto-juizi-dashboard
|
|
66
|
+
permissions:
|
|
67
|
+
id-token: write
|
|
68
|
+
defaults:
|
|
69
|
+
run:
|
|
70
|
+
working-directory: frontend
|
|
71
|
+
steps:
|
|
72
|
+
- uses: actions/checkout@v4
|
|
73
|
+
- uses: actions/setup-node@v4
|
|
74
|
+
with:
|
|
75
|
+
node-version: 22
|
|
76
|
+
registry-url: https://registry.npmjs.org
|
|
77
|
+
# Trusted publishing needs npm 11.5.1 or later.
|
|
78
|
+
- run: npm install -g npm@11.6.2
|
|
79
|
+
- run: npm publish --provenance --tag ${{ needs.check.outputs.npm-tag }}
|
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
# Decisions
|
|
2
|
+
|
|
3
|
+
Made while building, where scope.md doesn't settle the question. Each one
|
|
4
|
+
says what was chosen, why, and the alternative, so the user can confirm or
|
|
5
|
+
overturn it.
|
|
6
|
+
|
|
7
|
+
## D1. Settled with the user before building (2026-10-10)
|
|
8
|
+
|
|
9
|
+
- **Admins only:** Site Administrator and Manager. No "own record" view for
|
|
10
|
+
other users.
|
|
11
|
+
- **Uninstall keeps the record,** dormant. Only the server script deletes it.
|
|
12
|
+
- **No failed logins.** Core fires nothing for them, and this add-on doesn't
|
|
13
|
+
patch core.
|
|
14
|
+
- **Private repo juizi-com/juizi.dashboard,** with the Volto add-on in
|
|
15
|
+
`frontend/`, built on branches with PRs.
|
|
16
|
+
- **Plain Volto,** with no VLT or kitconcept dependencies.
|
|
17
|
+
|
|
18
|
+
## D2. No dependency on collective.auditlog, collective.fingerpointing or Products.LoginLockout
|
|
19
|
+
|
|
20
|
+
The user allowed the PLIP's add-ons as dependencies. None of them fits:
|
|
21
|
+
|
|
22
|
+
- **collective.auditlog** stores entries in SQL through SQLAlchemy <2 and is
|
|
23
|
+
driven by content rules. The agreed storage is the ZODB, with no extra
|
|
24
|
+
database to run.
|
|
25
|
+
- **collective.fingerpointing** writes log files, which can't be read or
|
|
26
|
+
filtered from inside Plone. Its last release was in 2022.
|
|
27
|
+
- **Products.LoginLockout** is only useful for failed logins, which are out
|
|
28
|
+
(D1).
|
|
29
|
+
|
|
30
|
+
What we used instead: fingerpointing's list of subscribers served as a
|
|
31
|
+
checklist of which core events to catch. LoginLockout can sit alongside
|
|
32
|
+
this add-on unchanged.
|
|
33
|
+
|
|
34
|
+
*Alternative:* auditlog as the store, with our own view on top. Rejected
|
|
35
|
+
because of the SQL server and an old SQLAlchemy pin.
|
|
36
|
+
|
|
37
|
+
**Review 2026-10-11: confirmed, no dependencies for now.**
|
|
38
|
+
|
|
39
|
+
**Option for later: failed logins through LoginLockout.** Make LoginLockout
|
|
40
|
+
an optional integration, not a dependency. When it's installed, the
|
|
41
|
+
dashboard would show its failed login attempts, for example as "Login
|
|
42
|
+
failed" entries under People. This reopens D1's "no failed logins", and
|
|
43
|
+
it's the realistic way to get them before the PLIP's core event exists,
|
|
44
|
+
without patching Plone.
|
|
45
|
+
|
|
46
|
+
## D3. Name, layout and versions
|
|
47
|
+
|
|
48
|
+
- Python package `juizi.dashboard`; Volto add-on `volto-juizi-dashboard` in
|
|
49
|
+
`frontend/`.
|
|
50
|
+
- `juizi`, not `collective`, for the same reason as juizi.aichatbot: it's
|
|
51
|
+
Juizi's short-term tool, and `collective` is left free for the PLIP's
|
|
52
|
+
eventual add-on.
|
|
53
|
+
- Plone 6.1.5 and Volto 18, as on the test bench.
|
|
54
|
+
|
|
55
|
+
**Review 2026-10-11: confirmed** (`juizi.dashboard`, not renamed to `juizi.activity`).
|
|
56
|
+
|
|
57
|
+
## D4. The record lives in the site root's annotations
|
|
58
|
+
|
|
59
|
+
The record is one persistent object under the annotation key
|
|
60
|
+
`juizi.dashboard.record`:
|
|
61
|
+
|
|
62
|
+
- an `LOBTree` of entries, keyed by time;
|
|
63
|
+
- `LLTreeSet` indexes by category, and by person (whoever did it or whom
|
|
64
|
+
it concerns);
|
|
65
|
+
- a `BTrees.Length` count.
|
|
66
|
+
|
|
67
|
+
Annotations aren't touched by uninstalling a profile. That's what keeps the
|
|
68
|
+
record dormant (D1). They're also invisible to the catalog, search and the
|
|
69
|
+
ZMI's object listings, and they're included in the normal ZODB backup.
|
|
70
|
+
|
|
71
|
+
*Alternative:* a separate ZODB mount point, as the PLIP allows for busy
|
|
72
|
+
sites. Not needed at client scale, and it can be added later without
|
|
73
|
+
changing the record's code.
|
|
74
|
+
|
|
75
|
+
**Review 2026-10-11: confirmed.** Raised in the review: show each item's
|
|
76
|
+
content type, so an admin helping an editor can see what kind of item it
|
|
77
|
+
was. Entries already stored the type's id. The dashboard and CSV now show
|
|
78
|
+
its name as editors see it ("Page", not "Document"), looked up when the
|
|
79
|
+
list is read. A type removed since shows its id.
|
|
80
|
+
|
|
81
|
+
## D5. Keys are microseconds × 1000 plus a random 0–999
|
|
82
|
+
|
|
83
|
+
An entry's key is its UTC time in microseconds, times 1000, plus a random
|
|
84
|
+
suffix. This is the PLIP's "timestamp with a random suffix", and a date
|
|
85
|
+
range is a plain key range.
|
|
86
|
+
|
|
87
|
+
*Corrected 2026-10-11:* an earlier version of this said the suffix spreads
|
|
88
|
+
concurrent writes across BTree buckets. It doesn't, because keys are
|
|
89
|
+
time-ordered and new entries land in the last bucket. What the suffix does
|
|
90
|
+
is keep two writes in the same microsecond from wanting the same key.
|
|
91
|
+
Concurrent appends to the same bucket are mostly resolved by the BTree's
|
|
92
|
+
own conflict resolution, and Zope retries the rest. That's fine at client
|
|
93
|
+
scale. Load-test it before a very busy site.
|
|
94
|
+
The largest key, around 1.8 × 10¹⁸, fits a signed 64-bit `LOBTree` key until
|
|
95
|
+
the year 2262. If a key is already taken, the next free one is used.
|
|
96
|
+
|
|
97
|
+
**Review 2026-10-11: confirmed.**
|
|
98
|
+
|
|
99
|
+
## D6. One entry per action, not one per child
|
|
100
|
+
|
|
101
|
+
Deleting or moving a folder fires Plone's event once for every item inside
|
|
102
|
+
it. The record keeps only the entry for the item that was actually moved or
|
|
103
|
+
deleted, and notes how many items were inside it. Otherwise one folder
|
|
104
|
+
delete could bury a day's activity under hundreds of entries.
|
|
105
|
+
|
|
106
|
+
The same goes for creating an item: Volto's create fires "added" and then
|
|
107
|
+
"modified" in the same request. Only "created" is kept. One request records
|
|
108
|
+
at most one entry per item for each kind of action.
|
|
109
|
+
|
|
110
|
+
**Review 2026-10-11: confirmed.** Added in the review: deleting, moving,
|
|
111
|
+
copying or renaming a folder notes how many items it took with it, as a
|
|
112
|
+
separate note under the change ("With 4 items inside"). In the CSV the
|
|
113
|
+
note is added to the Details cell. So an admin knows there were items
|
|
114
|
+
inside, even though those items have no entries of their own.
|
|
115
|
+
|
|
116
|
+
## D7. Sharing changes show what was given and taken away
|
|
117
|
+
|
|
118
|
+
Plone's Sharing event says only that local roles changed, not what
|
|
119
|
+
changed. The record therefore remembers each item's local roles at its
|
|
120
|
+
last Sharing change (Owner left out), in a small lookup table by UID
|
|
121
|
+
(`last_sharing`). The next Sharing change on that item is compared with
|
|
122
|
+
them:
|
|
123
|
+
|
|
124
|
+
> Given: Eddie Editor (Editor); Taken away: Eddie Editor (Reviewer)
|
|
125
|
+
> *Roles now: Eddie Editor (Editor)*
|
|
126
|
+
|
|
127
|
+
- **Inheritance:** blocking or restoring inherited roles is shown too.
|
|
128
|
+
- **The first change the record sees on an item** can't be compared with
|
|
129
|
+
anything. It shows "Roles now: …", with a note that the earlier roles
|
|
130
|
+
weren't recorded.
|
|
131
|
+
- **Deleting** an item drops it from the lookup table.
|
|
132
|
+
- **Erasing a person** replaces them there too (D18).
|
|
133
|
+
- **Records made before this existed** get the table the first time it's
|
|
134
|
+
used. No upgrade step is needed.
|
|
135
|
+
|
|
136
|
+
*Alternative 1, the original build:* store only the roles as they stand
|
|
137
|
+
afterwards, and leave admins to compare two entries by eye.
|
|
138
|
+
|
|
139
|
+
*Alternative 2:* snapshot the roles before each change, by hooking into
|
|
140
|
+
the Sharing view and `@sharing` before they save. That's a patch.
|
|
141
|
+
|
|
142
|
+
**Review 2026-10-11: changed to this middle way** (the user's choice: "the
|
|
143
|
+
most helpful").
|
|
144
|
+
|
|
145
|
+
## D8. Only content is recorded, and only where the add-on is installed
|
|
146
|
+
|
|
147
|
+
- Only content (`IContentish`) is recorded, not tools, registry records or
|
|
148
|
+
other objects in the ZODB.
|
|
149
|
+
- The add-on's code runs for every site in a Zope instance once it's in
|
|
150
|
+
the environment. Each handler first checks that the add-on is installed
|
|
151
|
+
on the current site, and does nothing otherwise, including when no site
|
|
152
|
+
is set at all, for example while another site is being created. The test
|
|
153
|
+
bench found this: creating a second site crashed until the check came
|
|
154
|
+
first.
|
|
155
|
+
|
|
156
|
+
**Review 2026-10-11: confirmed, content only for now.** Site activity
|
|
157
|
+
(control panel changes, other add-ons installed or uninstalled, types and
|
|
158
|
+
workflows changed) is noted in the README as a possible extension.
|
|
159
|
+
|
|
160
|
+
## D9. Settings live in plone.registry; retention lives on the server
|
|
161
|
+
|
|
162
|
+
**Registry settings (Site Setup → Activity record settings):**
|
|
163
|
+
- recording on or off (on when installed);
|
|
164
|
+
- IP addresses: full, shortened or off (default full, as in the PLIP);
|
|
165
|
+
- review comment text: on or off (default on).
|
|
166
|
+
|
|
167
|
+
**Server settings (environment variables):**
|
|
168
|
+
- `JUIZI_DASHBOARD_ACCOUNT_RETENTION_DAYS` (default 365);
|
|
169
|
+
- `JUIZI_DASHBOARD_CONTENT_RETENTION_DAYS` (default 1825);
|
|
170
|
+
- `0` means keep forever.
|
|
171
|
+
|
|
172
|
+
Retention isn't on the website for the same reason clearing isn't. The
|
|
173
|
+
dashboard shows both values, read-only.
|
|
174
|
+
|
|
175
|
+
**Review 2026-10-11: confirmed as is**, including full IP addresses by
|
|
176
|
+
default. Raised and left open: shortened might suit client sites better
|
|
177
|
+
(POPIA/GDPR), since most admins won't change the default.
|
|
178
|
+
|
|
179
|
+
## D10. Every settings change and install change is recorded
|
|
180
|
+
|
|
181
|
+
Switching recording off writes "Recording switched off" before it stops.
|
|
182
|
+
Switching it back on writes "Recording switched on". Changes to the IP and
|
|
183
|
+
comment settings are recorded with their old and new values.
|
|
184
|
+
|
|
185
|
+
The add-on writes "Add-on installed", "Add-on uninstalled" and "Add-on
|
|
186
|
+
reinstalled" entries. Between an uninstall and a reinstall the record
|
|
187
|
+
shows a visible gap.
|
|
188
|
+
|
|
189
|
+
**Review 2026-10-11: confirmed.** Known gap, documented: granting the
|
|
190
|
+
dashboard's permission to another role in the ZMI isn't recorded, because
|
|
191
|
+
Plone fires no event for permission changes. It needs Manager access.
|
|
192
|
+
|
|
193
|
+
## D11. Times are stored in UTC and shown in the site's time zone
|
|
194
|
+
|
|
195
|
+
- Entries are stored in UTC.
|
|
196
|
+
- The dashboard shows times in the site's time zone, not the browser's, so
|
|
197
|
+
the list, the date filter and the CSV agree. (As first built it used the
|
|
198
|
+
browser's, which disagreed with the filter whenever the two zones
|
|
199
|
+
differed.)
|
|
200
|
+
- The CSV has a "When (UTC)" column and a column in the site's time zone
|
|
201
|
+
(`plone.portal_timezone`), so a spreadsheet sorts correctly and still
|
|
202
|
+
reads naturally.
|
|
203
|
+
- The date range filter uses the site's time zone, so "today" means the
|
|
204
|
+
site's today.
|
|
205
|
+
|
|
206
|
+
**Review 2026-10-11: confirmed, with the list changed to the site's time
|
|
207
|
+
zone.** The README tells installers to set the site's time zone (Plone
|
|
208
|
+
defaults to UTC).
|
|
209
|
+
|
|
210
|
+
## D12. CSV cells that look like formulas are made safe
|
|
211
|
+
|
|
212
|
+
A cell that starts with `=`, `+`, `-`, `@`, a tab or a carriage return gets a
|
|
213
|
+
leading `'`, so a spreadsheet doesn't run it as a formula. Titles and
|
|
214
|
+
profile names are typed by users, and an admin opening the file is exactly
|
|
215
|
+
the person such a formula would target.
|
|
216
|
+
|
|
217
|
+
**Review 2026-10-11: confirmed.** Accepted cost: harmless titles that start
|
|
218
|
+
with -, + or @ show a leading apostrophe in the CSV (not on screen).
|
|
219
|
+
|
|
220
|
+
## D13. A CSV download stops at 100,000 rows
|
|
221
|
+
|
|
222
|
+
- A download includes at most 100,000 rows, newest first.
|
|
223
|
+
- The dashboard warns before downloading when the range holds more.
|
|
224
|
+
- The file's last line says it was cut off.
|
|
225
|
+
- The server script exports everything, with no limit.
|
|
226
|
+
|
|
227
|
+
This keeps one request's memory bounded.
|
|
228
|
+
|
|
229
|
+
**Review 2026-10-11: confirmed.**
|
|
230
|
+
|
|
231
|
+
## D14. Who did it, and their name at the time
|
|
232
|
+
|
|
233
|
+
- Each entry stores the actor's user id and their full name at the time.
|
|
234
|
+
- The dashboard shows the stored name, so a deleted account's actions still
|
|
235
|
+
read clearly. A person with no full name has their id stored as the name.
|
|
236
|
+
- After a name change, older entries keep the old name. The person filter
|
|
237
|
+
works by user id, so it shows all of their activity either way.
|
|
238
|
+
- Anonymous actions (self-registration, for example) show as "Anonymous".
|
|
239
|
+
|
|
240
|
+
**Review 2026-10-11: confirmed.**
|
|
241
|
+
|
|
242
|
+
## D15. The dashboard's address
|
|
243
|
+
|
|
244
|
+
- Site Setup → **Activity** opens `/controlpanel/activity`.
|
|
245
|
+
- Its settings are a generic Volto control panel,
|
|
246
|
+
`/controlpanel/juizi-dashboard-settings`, linked from the dashboard.
|
|
247
|
+
- The REST endpoint is `GET @activity`. `?format=csv` gives the download.
|
|
248
|
+
- The dashboard and `@activity` need `juizi.dashboard: View site activity`.
|
|
249
|
+
The settings tile needs `juizi.dashboard: Manage activity record
|
|
250
|
+
settings` (D24). Both go to Manager and Site Administrator.
|
|
251
|
+
- Both tiles are under Add-on Configuration, like membership and donations.
|
|
252
|
+
|
|
253
|
+
**Review 2026-10-11: confirmed as is** (two tiles, Add-on Configuration).
|
|
254
|
+
|
|
255
|
+
## D16. Writes go through even when a request is read-only
|
|
256
|
+
|
|
257
|
+
A login is a GET-like action as far as plone.protect is concerned. Because
|
|
258
|
+
the record is a plain BTree, a logged-in request without a form token would
|
|
259
|
+
have its write discarded, and the login wouldn't be recorded.
|
|
260
|
+
|
|
261
|
+
After writing, the record compares the connection's registered objects
|
|
262
|
+
before and after its write, and marks only the new ones (its own buckets
|
|
263
|
+
and indexes) as safe writes for that request. Nothing else in the request
|
|
264
|
+
gets a pass: if the action itself writes without a token, plone.protect
|
|
265
|
+
still aborts the whole transaction, and the entry goes with it.
|
|
266
|
+
|
|
267
|
+
plone.protect's own `safeWrite(btree)` walks every bucket of the tree, so it
|
|
268
|
+
would get slower as the record grows. It isn't used.
|
|
269
|
+
|
|
270
|
+
*Alternative:* `IDisableCSRFProtection` for the whole request. Rejected,
|
|
271
|
+
because it would also switch the check off for whatever else that request
|
|
272
|
+
writes.
|
|
273
|
+
|
|
274
|
+
**Review 2026-10-11: confirmed.**
|
|
275
|
+
|
|
276
|
+
## D17. The record's own entries are never pruned
|
|
277
|
+
|
|
278
|
+
Entries in the "record" category (add-on installed, uninstalled or
|
|
279
|
+
reinstalled, recording switched on or off, settings changed, entries
|
|
280
|
+
cleared, a person erased) are kept forever, and clearing never removes
|
|
281
|
+
them. There are few of them, and they're the trail that shows whether
|
|
282
|
+
anyone has interfered with the record.
|
|
283
|
+
|
|
284
|
+
**Review 2026-10-11: confirmed.**
|
|
285
|
+
|
|
286
|
+
## D18. What erasing a person removes
|
|
287
|
+
|
|
288
|
+
`erase --user ID`, for a privacy erasure request (POPIA/GDPR):
|
|
289
|
+
|
|
290
|
+
- **Removes** the person's own account activity: account entries about
|
|
291
|
+
them that they did themselves, or that happened anonymously. That covers
|
|
292
|
+
their logins and logouts, their own password and profile changes,
|
|
293
|
+
self-registration, and passwords set through a reset link.
|
|
294
|
+
- **Keeps, anonymised as "Erased user",** everything else:
|
|
295
|
+
- what they did to content, to other accounts or to the record;
|
|
296
|
+
- what *someone else* did to their account, for example an admin creating
|
|
297
|
+
or deleting it, changing its roles or adding it to a group. Admins'
|
|
298
|
+
actions keep their trail.
|
|
299
|
+
- **Anonymises** them inside Sharing entries and the record's memory of
|
|
300
|
+
each item's roles (D7).
|
|
301
|
+
- **Writes** a permanent note with the counts, without the person's id.
|
|
302
|
+
|
|
303
|
+
**What it can't reach:** their name in site content, such as a page titled
|
|
304
|
+
with it or a comment. That isn't the record, and the site owner deals with
|
|
305
|
+
it separately.
|
|
306
|
+
|
|
307
|
+
*Alternative 1:* the PLIP's wording ("removes a person's account events").
|
|
308
|
+
Read literally, it would also delete what an administrator did to other
|
|
309
|
+
people's accounts.
|
|
310
|
+
|
|
311
|
+
*Alternative 2, the first build:* remove every account entry about the
|
|
312
|
+
person, including admins' actions on their account.
|
|
313
|
+
|
|
314
|
+
**Review 2026-10-11: changed to this refinement** (admins' actions on the
|
|
315
|
+
person's account are kept, anonymised).
|
|
316
|
+
|
|
317
|
+
## D19. Gaps, stated in the READMEs
|
|
318
|
+
|
|
319
|
+
Core fires nothing for these, so they aren't recorded:
|
|
320
|
+
- failed logins (a possible extension through LoginLockout: D2);
|
|
321
|
+
- global role changes made in classic Users and Groups or the ZMI (those
|
|
322
|
+
made in Volto's Users screen are recorded: see D25);
|
|
323
|
+
- password reset requests;
|
|
324
|
+
- permission changes made in the ZMI (D10).
|
|
325
|
+
|
|
326
|
+
A password set through a reset link *is* recorded, as "Password changed:
|
|
327
|
+
set through a password reset link", because Plone fires its credentials
|
|
328
|
+
event then.
|
|
329
|
+
|
|
330
|
+
These gaps are listed in the README and `frontend/README.md`, not on the
|
|
331
|
+
dashboard. The note under the list is retention and the settings link only.
|
|
332
|
+
|
|
333
|
+
**Review 2026-10-11: confirmed.** The user moved the note from the
|
|
334
|
+
dashboard to the READMEs earlier in the review, and decided against a
|
|
335
|
+
"What isn't recorded" link on the dashboard for now, to keep it
|
|
336
|
+
lightweight.
|
|
337
|
+
|
|
338
|
+
## D20. Presets send a number of days, not dates
|
|
339
|
+
|
|
340
|
+
The dashboard sends `days=7|28|90`. The server works out the range from
|
|
341
|
+
today in the site's time zone, so a browser in another time zone, or one
|
|
342
|
+
just past midnight, still gets the site's "last 7 days". A custom range
|
|
343
|
+
sends dates.
|
|
344
|
+
|
|
345
|
+
**Review 2026-10-11: confirmed.**
|
|
346
|
+
|
|
347
|
+
## D21. Filtering by person: a click on a name, or the Person box
|
|
348
|
+
|
|
349
|
+
- **Click a name:** clicking a person's name, in "Who" or as the account
|
|
350
|
+
concerned, narrows the list to entries they did or that concern them. A
|
|
351
|
+
chip with × clears it.
|
|
352
|
+
- **Type a name:** the **Person** box suggests people as you type (two
|
|
353
|
+
letters or more), matching name or user id. Choosing one sets the same
|
|
354
|
+
filter. The suggestions come from `GET @activity-people?q=…`, which
|
|
355
|
+
lists only people with activity in the record, never the site's whole
|
|
356
|
+
list of accounts, and needs the same permission as the dashboard.
|
|
357
|
+
- **Names index:** the record keeps a small index of each person's latest
|
|
358
|
+
name. It's updated as entries are written, a person whose last entry is
|
|
359
|
+
pruned drops out of it, erasing replaces them, and records made before
|
|
360
|
+
it existed build it on first use.
|
|
361
|
+
- **Accessibility:** the box is a labelled native input with the browser's
|
|
362
|
+
own suggestion list (`<datalist>`), so it works with a keyboard and a
|
|
363
|
+
screen reader without custom ARIA.
|
|
364
|
+
|
|
365
|
+
*Alternative, the first build:* clicking a name only. On a busy site an
|
|
366
|
+
admin had to page through the list until the person showed up.
|
|
367
|
+
|
|
368
|
+
**Review 2026-10-11: changed: the Person box was added** (the user's
|
|
369
|
+
example: an admin helping an editor whose page disappeared).
|
|
370
|
+
|
|
371
|
+
## D22. Test bench: a `dashboard-test` site on payments-testbed
|
|
372
|
+
|
|
373
|
+
juizi.dashboard isn't part of the payments family. But the bench is where
|
|
374
|
+
Juizi's add-ons are tested on plain Volto, and one more site there costs
|
|
375
|
+
nothing. The bench's changes are on its branch `feat/juizi-dashboard`. The
|
|
376
|
+
site has juizi.dashboard only. Its frontend runs on :3004, one dev server at
|
|
377
|
+
a time, as for the other sites.
|
|
378
|
+
|
|
379
|
+
**Review 2026-10-11: confirmed, on condition that the add-on stays
|
|
380
|
+
standalone.** Checked: the backend depends only on Plone (Products.CMFPlone,
|
|
381
|
+
plone.api, plone.restapi). The frontend depends only on React, with the
|
|
382
|
+
dashboard style copied in. CI installs nothing else and passes. The bench
|
|
383
|
+
uses the add-on; the add-on knows nothing of the bench. Renaming the bench
|
|
384
|
+
(payments-testbed → juizi-testbed) can wait until a third non-payments
|
|
385
|
+
add-on needs it.
|
|
386
|
+
|
|
387
|
+
## D23. Uninstalled means unreadable from the website
|
|
388
|
+
|
|
389
|
+
Once the add-on is uninstalled, `@activity` answers 404 to everyone,
|
|
390
|
+
Manager included. The record is dormant: kept in the ZODB and readable only
|
|
391
|
+
with the server script, or after reinstalling.
|
|
392
|
+
|
|
393
|
+
The Volto add-on's Site Setup tile stays until the frontend is rebuilt
|
|
394
|
+
without it, which is how Volto add-ons work:
|
|
395
|
+
- a site administrator who opens it sees Volto's Unauthorized page, because
|
|
396
|
+
uninstalling takes their permission away;
|
|
397
|
+
- Manager sees "The activity record is not installed on this site".
|
|
398
|
+
|
|
399
|
+
*Alternative:* let Manager keep reading it. Rejected, because "uninstalled"
|
|
400
|
+
should mean the website no longer shows it.
|
|
401
|
+
|
|
402
|
+
**Review 2026-10-11: confirmed as is.** `@activity-people` (D21) behaves the
|
|
403
|
+
same way. Not done: hiding the Activity tile when the backend isn't
|
|
404
|
+
installed. Uninstalling is rare and is usually followed by removing the
|
|
405
|
+
frontend package.
|
|
406
|
+
|
|
407
|
+
## D24. Settings have their own permission, so site admins see the tile
|
|
408
|
+
|
|
409
|
+
The settings configlet first used "Manage portal", which Site
|
|
410
|
+
Administrator doesn't have in Plone 6. Site admins couldn't see the
|
|
411
|
+
settings in Site Setup, even though plone.restapi let them save the form,
|
|
412
|
+
because `@controlpanels` only asks for the Site Setup overview permission.
|
|
413
|
+
The test bench found this.
|
|
414
|
+
|
|
415
|
+
The configlet now uses its own permission, "juizi.dashboard: Manage
|
|
416
|
+
activity record settings", given to Manager and Site Administrator.
|
|
417
|
+
Uninstalling resets it to Manager only.
|
|
418
|
+
|
|
419
|
+
collective.membership's settings tile used "Manage portal" too, so site
|
|
420
|
+
admins didn't see it either.
|
|
421
|
+
|
|
422
|
+
**Review 2026-10-11: confirmed.** For collective.membership the user first
|
|
423
|
+
asked for the same fix. The test bench then showed that Site Administrators
|
|
424
|
+
can't use the Membership dashboard at all, not just its settings tile, and
|
|
425
|
+
the user decided to keep membership Manager-only (membership D25,
|
|
426
|
+
`docs/manager-only`).
|
|
427
|
+
|
|
428
|
+
## D25. Global role changes from Volto's Users screen are recorded
|
|
429
|
+
|
|
430
|
+
The test bench showed that plone.restapi's `@users` PATCH passes `roles`
|
|
431
|
+
through `setMemberProperties`, which fires Plone's "properties updated"
|
|
432
|
+
event, before it sets the roles. Without handling, that showed up as
|
|
433
|
+
"Profile changed: Fields: roles".
|
|
434
|
+
|
|
435
|
+
When that event carries `roles`:
|
|
436
|
+
1. The recorder notes the user's directly given global roles.
|
|
437
|
+
2. It compares them again in a before-commit hook.
|
|
438
|
+
3. Only if they actually changed, it records "Roles changed" with what
|
|
439
|
+
was given and what was taken away.
|
|
440
|
+
|
|
441
|
+
A change `@users` refuses (403, for example a site admin trying to give
|
|
442
|
+
Manager) changes nothing, so nothing is recorded. "roles" is never listed
|
|
443
|
+
as a profile field.
|
|
444
|
+
|
|
445
|
+
Roles that come through groups aren't part of this. Group membership
|
|
446
|
+
changes are recorded on their own.
|
|
447
|
+
|
|
448
|
+
**Review 2026-10-11: confirmed.**
|
|
449
|
+
|
|
450
|
+
## D26. Content types hidden from search aren't recorded
|
|
451
|
+
|
|
452
|
+
Types listed in Site Setup → Search → "types not searched"
|
|
453
|
+
(`plone.types_not_searched`) are left out of content actions: created,
|
|
454
|
+
copied, edited, workflow changes, moved, renamed, deleted. Add-ons list
|
|
455
|
+
their storage types there. On a site with collective.membership, every
|
|
456
|
+
sign-up would otherwise appear as "Created" entries for its Member and
|
|
457
|
+
Membership records, by Anonymous, titled with the person's name.
|
|
458
|
+
|
|
459
|
+
Sharing changes are still recorded for every type, because they're about
|
|
460
|
+
access.
|
|
461
|
+
|
|
462
|
+
An admin who wants a type recorded removes it from that list (which also
|
|
463
|
+
makes it searchable). An admin who wants a type left out adds it.
|
|
464
|
+
|
|
465
|
+
*Alternative:* a setting of our own listing types not to record. That's
|
|
466
|
+
more control, but one more setting to explain. The search list already
|
|
467
|
+
says "this is internal".
|
|
468
|
+
|
|
469
|
+
**Raised in the security review, 2026-10-11, and built at the user's
|
|
470
|
+
request.**
|
|
471
|
+
|
|
472
|
+
## D27. A recording problem never blocks the action
|
|
473
|
+
|
|
474
|
+
Every handler runs inside the user's own save, login or role change, as
|
|
475
|
+
does the commit-time roles check (D25). An error escaping from one would
|
|
476
|
+
make that action fail: an editor's save refused, a login broken.
|
|
477
|
+
|
|
478
|
+
Every handler is therefore guarded:
|
|
479
|
+
- an error is logged ("juizi.dashboard could not record …; the action
|
|
480
|
+
went through without an entry"), and the action goes through without
|
|
481
|
+
its entry;
|
|
482
|
+
- database conflicts still propagate, so Zope retries the request as
|
|
483
|
+
usual.
|
|
484
|
+
|
|
485
|
+
Tests force an error in a content save, a workflow change and a role
|
|
486
|
+
change, and check that each goes through.
|
|
487
|
+
|
|
488
|
+
*Trade-off:* the record can miss an entry when something goes wrong, but
|
|
489
|
+
the miss shows up in the server log. For a client site, the site working
|
|
490
|
+
matters more than a complete trail.
|
|
491
|
+
|
|
492
|
+
**Raised in the security review, 2026-10-11, and built at the user's
|
|
493
|
+
request.**
|