Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44e53ce2ce | ||
|
|
118fe395b0 | ||
|
|
0fd297231b | ||
|
|
539e3cbb5e | ||
|
|
79cfaa951a | ||
|
|
fb8d674637 | ||
|
|
165b012571 | ||
|
|
4aeda1c634 | ||
|
|
68855f6fad | ||
|
|
25b4c0c2f6 | ||
|
|
64bdc3dd6b | ||
|
|
67219a3d20 | ||
|
|
f81483f004 | ||
|
|
3623078235 | ||
|
|
0047ae56dc | ||
|
|
a9e43321ed | ||
|
|
9fd2ccd0a5 | ||
|
|
22555f2603 | ||
|
|
c17cbdae63 | ||
|
|
3d8272b28e | ||
|
|
3e9a14a970 | ||
|
|
480ccdb3b6 | ||
|
|
d4cbf7e4d5 | ||
|
|
1f2001daf8 | ||
|
|
9b029c8edf | ||
|
|
b9f557e95b | ||
|
|
60b01e5a16 |
@@ -0,0 +1,270 @@
|
|||||||
|
name: Module Package Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
release_tag:
|
||||||
|
description: Existing protected version tag to publish
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-packages:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
|
||||||
|
with:
|
||||||
|
python-version: "3.12"
|
||||||
|
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
- name: Select and validate protected release tag
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
REQUESTED_TAG: ${{ inputs.release_tag }}
|
||||||
|
TRIGGER_TAG: ${{ gitea.ref_name }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
tag="${REQUESTED_TAG:-$TRIGGER_TAG}"
|
||||||
|
case "$tag" in
|
||||||
|
v[0-9]*.[0-9]*.[0-9]*) ;;
|
||||||
|
*) echo "Release tag must start with a SemVer-shaped vX.Y.Z value" >&2; exit 1 ;;
|
||||||
|
esac
|
||||||
|
git fetch --force origin "refs/tags/$tag:refs/tags/$tag" refs/heads/main:refs/remotes/origin/main
|
||||||
|
tag_commit="$(git rev-list -n 1 "$tag")"
|
||||||
|
git merge-base --is-ancestor "$tag_commit" refs/remotes/origin/main || {
|
||||||
|
echo "Release tag is not contained in main" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
git checkout --detach "$tag"
|
||||||
|
printf 'RELEASE_TAG=%s\n' "$tag" >> "$GITEA_ENV"
|
||||||
|
printf 'SOURCE_DATE_EPOCH=%s\n' "$(git show -s --format=%ct HEAD)" >> "$GITEA_ENV"
|
||||||
|
- name: Validate package versions
|
||||||
|
run: |
|
||||||
|
python - <<'PY'
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import tomllib
|
||||||
|
|
||||||
|
tag = os.environ["RELEASE_TAG"]
|
||||||
|
expected = tag.removeprefix("v")
|
||||||
|
project = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["project"]
|
||||||
|
if project.get("version") != expected:
|
||||||
|
raise SystemExit(f"pyproject version {project.get('version')!r} does not match {tag}")
|
||||||
|
if re.fullmatch(r"govoplan-[a-z0-9-]+", str(project.get("name", ""))) is None:
|
||||||
|
raise SystemExit("Python distribution name must use the govoplan-* namespace")
|
||||||
|
webui = Path("webui/package.json")
|
||||||
|
if webui.is_file():
|
||||||
|
package = json.loads(webui.read_text(encoding="utf-8"))
|
||||||
|
if package.get("version") != expected:
|
||||||
|
raise SystemExit(f"WebUI version {package.get('version')!r} does not match {tag}")
|
||||||
|
if re.fullmatch(r"@govoplan/[a-z0-9-]+-webui", str(package.get("name", ""))) is None:
|
||||||
|
raise SystemExit("WebUI package name must use the @govoplan/*-webui namespace")
|
||||||
|
release = Path("webui/package.release.json")
|
||||||
|
if release.is_file():
|
||||||
|
release_package = json.loads(release.read_text(encoding="utf-8"))
|
||||||
|
if (
|
||||||
|
release_package.get("name") != package.get("name")
|
||||||
|
or release_package.get("version") != expected
|
||||||
|
):
|
||||||
|
raise SystemExit("WebUI release package identity does not match package.json and the release tag")
|
||||||
|
PY
|
||||||
|
- name: Build immutable package artifacts
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
python -m pip install --disable-pip-version-check build==1.5.0 twine==7.0.0
|
||||||
|
rm -rf dist .package-webui
|
||||||
|
python -m build --wheel --outdir dist
|
||||||
|
python -m twine check dist/*.whl
|
||||||
|
if [[ -f webui/package.json ]]; then
|
||||||
|
mkdir .package-webui
|
||||||
|
cp -a webui/. .package-webui/
|
||||||
|
rm -rf .package-webui/node_modules .package-webui/dist
|
||||||
|
if [[ -f .package-webui/package.release.json ]]; then
|
||||||
|
cp .package-webui/package.release.json .package-webui/package.json
|
||||||
|
fi
|
||||||
|
node <<'NODE'
|
||||||
|
const fs = require("node:fs");
|
||||||
|
const path = ".package-webui/package.json";
|
||||||
|
const packageJson = JSON.parse(fs.readFileSync(path, "utf8"));
|
||||||
|
const groups = ["dependencies", "optionalDependencies", "peerDependencies"];
|
||||||
|
for (const group of groups) {
|
||||||
|
for (const [name, specifier] of Object.entries(packageJson[group] || {})) {
|
||||||
|
if (!name.startsWith("@govoplan/")) continue;
|
||||||
|
if (typeof specifier !== "string") {
|
||||||
|
throw new Error(`${group}.${name} must use a string version`);
|
||||||
|
}
|
||||||
|
const packageSlug = name.slice("@govoplan/".length);
|
||||||
|
if (!packageSlug.endsWith("-webui")) {
|
||||||
|
throw new Error(`${group}.${name} is outside the WebUI package namespace`);
|
||||||
|
}
|
||||||
|
const repository = `govoplan-${packageSlug.slice(0, -"-webui".length)}`;
|
||||||
|
const escapedRepository = repository.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||||
|
const gitTag = specifier.match(
|
||||||
|
new RegExp(
|
||||||
|
`^git\\+(?:ssh://git@|https://)git\\.add-ideas\\.de/(?:GovOPlaN|add-ideas)/${escapedRepository}\\.git#v([0-9]+\\.[0-9]+\\.[0-9]+)$`,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (gitTag) {
|
||||||
|
packageJson[group][name] = gitTag[1];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (specifier.startsWith("file:") || specifier.startsWith("git+")) {
|
||||||
|
throw new Error(
|
||||||
|
`${group}.${name} must resolve to an exact registry version for publication`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete packageJson.private;
|
||||||
|
fs.writeFileSync(path, `${JSON.stringify(packageJson, null, 2)}\n`);
|
||||||
|
NODE
|
||||||
|
npm pkg delete private --prefix .package-webui
|
||||||
|
(cd .package-webui && npm pack --ignore-scripts --pack-destination ../dist)
|
||||||
|
fi
|
||||||
|
python - <<'PY'
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
artifacts = []
|
||||||
|
for path in sorted(Path("dist").iterdir()):
|
||||||
|
if path.suffix not in {".whl", ".tgz"}:
|
||||||
|
continue
|
||||||
|
digest = hashlib.sha256(path.read_bytes()).hexdigest()
|
||||||
|
artifacts.append({"filename": path.name, "sha256": digest, "size": path.stat().st_size})
|
||||||
|
payload = {
|
||||||
|
"schema_version": "1",
|
||||||
|
"repository": os.environ["GITEA_REPOSITORY"],
|
||||||
|
"tag": os.environ["RELEASE_TAG"],
|
||||||
|
"commit": subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip(),
|
||||||
|
"artifacts": artifacts,
|
||||||
|
}
|
||||||
|
Path("dist/package-artifacts.json").write_text(
|
||||||
|
json.dumps(payload, indent=2, sort_keys=True) + "\n",
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
PY
|
||||||
|
- name: Retain package hash evidence
|
||||||
|
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32
|
||||||
|
with:
|
||||||
|
name: module-packages-${{ gitea.ref_name }}
|
||||||
|
path: dist/package-artifacts.json
|
||||||
|
- name: Check immutable registry state
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
PACKAGE_TOKEN: ${{ secrets.GOVOPLAN_PACKAGE_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
test -n "$PACKAGE_TOKEN"
|
||||||
|
python - <<'PY'
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import tomllib
|
||||||
|
from urllib.error import HTTPError
|
||||||
|
from urllib.parse import quote
|
||||||
|
from urllib.request import Request, urlopen
|
||||||
|
|
||||||
|
api_root = "https://git.add-ideas.de/api/v1/packages/GovOPlaN"
|
||||||
|
token = os.environ["PACKAGE_TOKEN"]
|
||||||
|
|
||||||
|
def should_publish(kind, name, version, path):
|
||||||
|
package_url = "/".join(
|
||||||
|
(api_root, kind, quote(name, safe=""), quote(version, safe=""), "files")
|
||||||
|
)
|
||||||
|
request = Request(
|
||||||
|
package_url,
|
||||||
|
headers={"Accept": "application/json", "Authorization": f"token {token}"},
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
with urlopen(request, timeout=30) as response:
|
||||||
|
files = json.load(response)
|
||||||
|
except HTTPError as exc:
|
||||||
|
if exc.code == 404:
|
||||||
|
print(f"{kind} package {name}=={version} is not published yet")
|
||||||
|
return True
|
||||||
|
raise
|
||||||
|
if not isinstance(files, list) or len(files) != 1:
|
||||||
|
raise SystemExit(
|
||||||
|
f"immutable {kind} package {name}=={version} has an unexpected file set"
|
||||||
|
)
|
||||||
|
expected_sha256 = hashlib.sha256(path.read_bytes()).hexdigest()
|
||||||
|
if files[0].get("sha256") != expected_sha256:
|
||||||
|
raise SystemExit(
|
||||||
|
f"immutable {kind} package {name}=={version} already exists with a different SHA-256"
|
||||||
|
)
|
||||||
|
print(f"verified existing {kind} package {name}=={version} ({expected_sha256})")
|
||||||
|
return False
|
||||||
|
|
||||||
|
project = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["project"]
|
||||||
|
wheels = tuple(Path("dist").glob("*.whl"))
|
||||||
|
if len(wheels) != 1:
|
||||||
|
raise SystemExit("release build must contain exactly one wheel")
|
||||||
|
publish_pypi = should_publish(
|
||||||
|
"pypi", str(project["name"]), str(project["version"]), wheels[0]
|
||||||
|
)
|
||||||
|
|
||||||
|
tarballs = tuple(Path("dist").glob("*.tgz"))
|
||||||
|
if len(tarballs) > 1:
|
||||||
|
raise SystemExit("release build must contain at most one npm package")
|
||||||
|
publish_npm = False
|
||||||
|
if tarballs:
|
||||||
|
webui = json.loads(
|
||||||
|
Path(".package-webui/package.json").read_text(encoding="utf-8")
|
||||||
|
)
|
||||||
|
publish_npm = should_publish(
|
||||||
|
"npm", str(webui["name"]), str(webui["version"]), tarballs[0]
|
||||||
|
)
|
||||||
|
|
||||||
|
with Path(os.environ["GITEA_ENV"]).open("a", encoding="utf-8") as env_file:
|
||||||
|
env_file.write(f"PUBLISH_PYPI={int(publish_pypi)}\n")
|
||||||
|
env_file.write(f"PUBLISH_NPM={int(publish_npm)}\n")
|
||||||
|
PY
|
||||||
|
- name: Publish wheel and WebUI package
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
PACKAGE_USERNAME: ${{ secrets.GOVOPLAN_PACKAGE_USERNAME }}
|
||||||
|
PACKAGE_TOKEN: ${{ secrets.GOVOPLAN_PACKAGE_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
test -n "$PACKAGE_USERNAME"
|
||||||
|
test -n "$PACKAGE_TOKEN"
|
||||||
|
if [[ "$PUBLISH_PYPI" == 1 ]]; then
|
||||||
|
TWINE_USERNAME="$PACKAGE_USERNAME" TWINE_PASSWORD="$PACKAGE_TOKEN" \
|
||||||
|
python -m twine upload --non-interactive \
|
||||||
|
--repository-url https://git.add-ideas.de/api/packages/GovOPlaN/pypi \
|
||||||
|
dist/*.whl
|
||||||
|
else
|
||||||
|
echo "Exact wheel is already present; skipping immutable retry."
|
||||||
|
fi
|
||||||
|
shopt -s nullglob
|
||||||
|
webui_packages=(dist/*.tgz)
|
||||||
|
if (( ${#webui_packages[@]} )) && [[ "$PUBLISH_NPM" == 1 ]]; then
|
||||||
|
npmrc="$(mktemp)"
|
||||||
|
trap 'rm -f "$npmrc"' EXIT
|
||||||
|
chmod 600 "$npmrc"
|
||||||
|
printf '%s\n' \
|
||||||
|
'@govoplan:registry=https://git.add-ideas.de/api/packages/GovOPlaN/npm/' \
|
||||||
|
"//git.add-ideas.de/api/packages/GovOPlaN/npm/:_authToken=$PACKAGE_TOKEN" \
|
||||||
|
> "$npmrc"
|
||||||
|
NPM_CONFIG_USERCONFIG="$npmrc" npm publish "./${webui_packages[0]}" \
|
||||||
|
--ignore-scripts --access public \
|
||||||
|
--registry https://git.add-ideas.de/api/packages/GovOPlaN/npm/
|
||||||
|
elif (( ${#webui_packages[@]} )); then
|
||||||
|
echo "Exact WebUI package is already present; skipping immutable retry."
|
||||||
|
fi
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# GovOPlaN Scheduling Codex Guide
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This repository owns poll-backed meeting scheduling, candidate slots, participants, constraints, availability, reminders, decisions, and Calendar handoff.
|
||||||
|
|
||||||
|
## Documentation Contract
|
||||||
|
|
||||||
|
- Treat documentation as part of every behavior change. Update this module's manifest-driven `DocumentationTopic` contributions for affected user and administrator behavior.
|
||||||
|
- Keep feature content here; `govoplan-docs` projects it without importing Scheduling internals.
|
||||||
|
- Maintain a static user/admin baseline and run `/mnt/DATA/git/govoplan/tools/checks/check-manifest-shapes.py` after behavior or manifest changes.
|
||||||
|
|
||||||
|
## Boundaries
|
||||||
|
|
||||||
|
- Poll owns reusable responses; Calendar owns events and free/busy; Notifications and Mail own delivery.
|
||||||
|
- Keep optional integrations capability-driven and preserve signed-link privacy and abuse controls.
|
||||||
@@ -61,6 +61,18 @@ Participant availability is sensitive operational data. Scheduling must record:
|
|||||||
Availability responses should be removable or redacted after the poll decision
|
Availability responses should be removable or redacted after the poll decision
|
||||||
unless a configured process requires longer evidence retention.
|
unless a configured process requires longer evidence retention.
|
||||||
|
|
||||||
|
Scheduling publishes `privacy.dsar.scheduling` for Core's governed
|
||||||
|
data-subject-request workflow. It projects tenant-scoped participant, request,
|
||||||
|
candidate-slot, and notification-envelope metadata while omitting Poll and
|
||||||
|
invitation identifiers, public-link and proof material, Calendar identifiers,
|
||||||
|
free/busy detail, notification content and errors, password hashes, opaque
|
||||||
|
metadata, and unrelated participants. Poll owns the actual availability choices
|
||||||
|
and response-retirement evidence; Calendar owns event and hold state. Terminal,
|
||||||
|
responded, or notified records are retained or manually reviewed. Only a truly
|
||||||
|
unengaged participant can be anonymized automatically, after tenant, identity,
|
||||||
|
request status, invitation, response, enrollment, and notification state are
|
||||||
|
revalidated under lock.
|
||||||
|
|
||||||
## Candidate Capabilities
|
## Candidate Capabilities
|
||||||
|
|
||||||
- `scheduling.polls`
|
- `scheduling.polls`
|
||||||
@@ -132,6 +144,27 @@ poll-backed scheduling requests:
|
|||||||
- a first Scheduling WebUI package with request creation, slot matrix, Calendar
|
- a first Scheduling WebUI package with request creation, slot matrix, Calendar
|
||||||
actions, decisions, and notification-job creation
|
actions, decisions, and notification-job creation
|
||||||
|
|
||||||
|
## Interface workflow and contextual guidance
|
||||||
|
|
||||||
|
The route-by-route migration record and verification contract are documented in
|
||||||
|
[`docs/INTERFACE_PATTERN_MIGRATION.md`](docs/INTERFACE_PATTERN_MIGRATION.md).
|
||||||
|
|
||||||
|
The request detail projects the existing backend lifecycle into three stable
|
||||||
|
user stages: prepare the request, collect participation, and decide. Draft,
|
||||||
|
collecting, closed, decided, handed-off, cancelled, and archived records remain
|
||||||
|
the authoritative backend states; the stage rail is only a readable projection
|
||||||
|
and does not invent a second workflow state machine. Cancelled requests keep the
|
||||||
|
reached stage visible as stopped, while later stages remain locked.
|
||||||
|
|
||||||
|
Unavailable Calendar coordination and public guest participation use Core's
|
||||||
|
action-blocker pattern. The UI names the reason, required remediation,
|
||||||
|
responsible administrator, and destination instead of displaying a generic
|
||||||
|
disabled control. Stable help links resolve to the configured Docs module when
|
||||||
|
present and to the hosted documentation otherwise. Scheduling contributes the
|
||||||
|
`scheduling.find-and-decide-meeting-time`, `scheduling.calendar-coordination`,
|
||||||
|
and `scheduling.participation-governance` topics; it does not import Docs,
|
||||||
|
Calendar, Poll, Policy, or Access implementation code.
|
||||||
|
|
||||||
The next slices should add generic self-enrolment links after their abuse and
|
The next slices should add generic self-enrolment links after their abuse and
|
||||||
identity policy is agreed, Calendar hold cleanup after decision, and advanced
|
identity policy is agreed, Calendar hold cleanup after decision, and advanced
|
||||||
scoring constraints such as required participants and quorum rules.
|
scoring constraints such as required participants and quorum rules.
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Scheduling Interface Pattern Migration
|
||||||
|
|
||||||
|
Scheduling implements the platform interface pattern language on its owned
|
||||||
|
surfaces without importing optional module internals.
|
||||||
|
|
||||||
|
## Surface Map
|
||||||
|
|
||||||
|
| Surface | Pattern | Consequential actions | Help context |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| `/scheduling` request list and detail | Persistent list-detail workspace with a lifecycle rail | Open, close, remind, decide, create holds, create final event | `scheduling.list`, `scheduling.request` |
|
||||||
|
| `/scheduling` create/edit | Bounded editor with unsaved-change guard and typed Core controls | Save or discard a request definition | `scheduling.editor` |
|
||||||
|
| `/scheduling/public/:requestId/:token` | Privacy-bounded public participation form | Submit or replace the invited participant's response | `scheduling.public-participation` |
|
||||||
|
| `scheduling.widget.open-requests` | Compact dashboard contribution | Navigate to the selected request | `scheduling.request` |
|
||||||
|
|
||||||
|
## Interaction Contract
|
||||||
|
|
||||||
|
- Closing a poll, creating reminder jobs or Calendar objects, and deciding a
|
||||||
|
final slot require a shared confirmation dialog. Invitation-link revocation
|
||||||
|
uses the same component with danger emphasis.
|
||||||
|
- Disabled actions expose the active busy, permission, immutable-response, or
|
||||||
|
optional-capability reason through Core's action-tooltip and blocker
|
||||||
|
components.
|
||||||
|
- Calendar selection uses the optional `calendar.picker` UI capability and
|
||||||
|
bounded Calendar scopes. Scheduling never imports Calendar WebUI code.
|
||||||
|
- Participant selection uses Core's provider-backed `PeoplePicker`; public
|
||||||
|
participation receives only the privacy-bounded request projection.
|
||||||
|
- Stable documentation topics are available from the list, editor, detail,
|
||||||
|
public participation page, and dashboard widget. Core resolves them through
|
||||||
|
Docs when enabled and through hosted documentation otherwise.
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
|
||||||
|
Run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd webui
|
||||||
|
npm run test:view-model
|
||||||
|
npm run test:ui-structure
|
||||||
|
```
|
||||||
|
|
||||||
|
The structural check guards shared components, optional-module boundaries,
|
||||||
|
confirmation gates, contextual documentation, public credential controls, and
|
||||||
|
request-specific widget navigation. Backend tests validate manifest metadata,
|
||||||
|
permission boundaries, lifecycle transitions, public participation, and
|
||||||
|
Calendar capability behavior.
|
||||||
+3
-3
@@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "govoplan-scheduling"
|
name = "govoplan-scheduling"
|
||||||
version = "0.1.11"
|
version = "0.1.21"
|
||||||
description = "GovOPlaN meeting scheduling and Terminfindung module seed."
|
description = "GovOPlaN meeting scheduling and Terminfindung module seed."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
license = { file = "LICENSE" }
|
license = { file = "LICENSE" }
|
||||||
authors = [{ name = "GovOPlaN" }]
|
authors = [{ name = "GovOPlaN" }]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"govoplan-core>=0.1.11",
|
"govoplan-core>=0.1.18",
|
||||||
"govoplan-poll>=0.1.11",
|
"govoplan-poll>=0.1.18",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
__all__ = ["__version__"]
|
__all__ = ["__version__"]
|
||||||
|
|
||||||
__version__ = "0.1.11"
|
__version__ = "0.1.21"
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from govoplan_scheduling.backend.db.models import SchedulingCandidateSlot, SchedulingNotification, SchedulingParticipant, SchedulingRequest
|
from govoplan_scheduling.backend.db.models import (
|
||||||
|
SchedulingCandidateSlot,
|
||||||
|
SchedulingNotification,
|
||||||
|
SchedulingParticipant,
|
||||||
|
SchedulingPublicEnrollmentLink,
|
||||||
|
SchedulingRequest,
|
||||||
|
)
|
||||||
|
|
||||||
__all__ = ["SchedulingCandidateSlot", "SchedulingNotification", "SchedulingParticipant", "SchedulingRequest"]
|
__all__ = [
|
||||||
|
"SchedulingCandidateSlot",
|
||||||
|
"SchedulingNotification",
|
||||||
|
"SchedulingParticipant",
|
||||||
|
"SchedulingPublicEnrollmentLink",
|
||||||
|
"SchedulingRequest",
|
||||||
|
]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import uuid
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from sqlalchemy import Boolean, DateTime, ForeignKey, Index, Integer, JSON, String, Text
|
from sqlalchemy import Boolean, DateTime, ForeignKey, Index, Integer, JSON, String, Text, UniqueConstraint
|
||||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||||
|
|
||||||
from govoplan_core.db.base import Base, TimestampMixin
|
from govoplan_core.db.base import Base, TimestampMixin
|
||||||
@@ -67,6 +67,40 @@ class SchedulingRequest(Base, TimestampMixin):
|
|||||||
cascade="all, delete-orphan",
|
cascade="all, delete-orphan",
|
||||||
order_by="SchedulingParticipant.created_at",
|
order_by="SchedulingParticipant.created_at",
|
||||||
)
|
)
|
||||||
|
enrollment_links: Mapped[list["SchedulingPublicEnrollmentLink"]] = relationship(
|
||||||
|
back_populates="request",
|
||||||
|
cascade="all, delete-orphan",
|
||||||
|
order_by="SchedulingPublicEnrollmentLink.created_at",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SchedulingPublicEnrollmentLink(Base, TimestampMixin):
|
||||||
|
"""Reusable public credential that may create bounded participants."""
|
||||||
|
|
||||||
|
__tablename__ = "scheduling_public_enrollment_links"
|
||||||
|
__table_args__ = (
|
||||||
|
UniqueConstraint("token_hash", name="uq_scheduling_enrollment_link_token_hash"),
|
||||||
|
Index("ix_scheduling_enrollment_links_request", "tenant_id", "request_id"),
|
||||||
|
Index("ix_scheduling_enrollment_links_expiry", "tenant_id", "expires_at"),
|
||||||
|
)
|
||||||
|
|
||||||
|
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=new_uuid)
|
||||||
|
tenant_id: Mapped[str] = mapped_column(String(36), nullable=False, index=True)
|
||||||
|
request_id: Mapped[str] = mapped_column(
|
||||||
|
ForeignKey("scheduling_requests.id", ondelete="CASCADE"),
|
||||||
|
nullable=False,
|
||||||
|
index=True,
|
||||||
|
)
|
||||||
|
token_hash: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||||
|
max_enrollments: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||||
|
expires_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, index=True)
|
||||||
|
allow_anonymous: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||||
|
allow_authenticated: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False)
|
||||||
|
created_by: Mapped[str | None] = mapped_column(String(255), nullable=True, index=True)
|
||||||
|
revoked_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True, index=True)
|
||||||
|
metadata_: Mapped[dict[str, Any] | None] = mapped_column("metadata", JSON, nullable=True)
|
||||||
|
|
||||||
|
request: Mapped[SchedulingRequest] = relationship(back_populates="enrollment_links")
|
||||||
|
|
||||||
|
|
||||||
class SchedulingCandidateSlot(Base, TimestampMixin):
|
class SchedulingCandidateSlot(Base, TimestampMixin):
|
||||||
@@ -116,6 +150,14 @@ class SchedulingParticipant(Base, TimestampMixin):
|
|||||||
status: Mapped[str] = mapped_column(String(40), default="invited", nullable=False, index=True)
|
status: Mapped[str] = mapped_column(String(40), default="invited", nullable=False, index=True)
|
||||||
poll_invitation_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
|
poll_invitation_id: Mapped[str | None] = mapped_column(String(36), nullable=True, index=True)
|
||||||
participation_gateway: Mapped[str | None] = mapped_column(String(40), nullable=True)
|
participation_gateway: Mapped[str | None] = mapped_column(String(40), nullable=True)
|
||||||
|
self_enrollment_link_id: Mapped[str | None] = mapped_column(
|
||||||
|
ForeignKey("scheduling_public_enrollment_links.id", ondelete="SET NULL"),
|
||||||
|
nullable=True,
|
||||||
|
index=True,
|
||||||
|
)
|
||||||
|
self_enrollment_proof_hash: Mapped[str | None] = mapped_column(String(64), nullable=True)
|
||||||
|
bound_account_id: Mapped[str | None] = mapped_column(String(255), nullable=True, index=True)
|
||||||
|
account_bound_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||||
last_invited_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
last_invited_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||||
responded_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
responded_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||||
response_comment: Mapped[str | None] = mapped_column(Text, nullable=True)
|
response_comment: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||||
@@ -150,6 +192,7 @@ __all__ = [
|
|||||||
"SchedulingCandidateSlot",
|
"SchedulingCandidateSlot",
|
||||||
"SchedulingNotification",
|
"SchedulingNotification",
|
||||||
"SchedulingParticipant",
|
"SchedulingParticipant",
|
||||||
|
"SchedulingPublicEnrollmentLink",
|
||||||
"SchedulingRequest",
|
"SchedulingRequest",
|
||||||
"new_uuid",
|
"new_uuid",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,891 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from collections.abc import Mapping, Sequence
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
|
from sqlalchemy import func, or_
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
|
||||||
|
from govoplan_core.core.dsar import (
|
||||||
|
DsarErasureActionRef,
|
||||||
|
DsarExecutionResultRef,
|
||||||
|
DsarRecordRef,
|
||||||
|
DsarSubjectRef,
|
||||||
|
dsar_capability_name,
|
||||||
|
)
|
||||||
|
from govoplan_scheduling.backend.db.models import (
|
||||||
|
SchedulingCandidateSlot,
|
||||||
|
SchedulingNotification,
|
||||||
|
SchedulingParticipant,
|
||||||
|
SchedulingRequest,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
SCHEDULING_DSAR_CAPABILITY = dsar_capability_name("scheduling")
|
||||||
|
_MAX_RECORDS = 5_000
|
||||||
|
_TERMINAL_REQUEST_STATUSES = frozenset(
|
||||||
|
{"decided", "handed_off", "cancelled", "archived"}
|
||||||
|
)
|
||||||
|
_TERMINAL_NOTIFICATION_STATUSES = frozenset({"sent", "failed", "skipped", "cancelled"})
|
||||||
|
|
||||||
|
|
||||||
|
class SchedulingDsarProvider:
|
||||||
|
provider_id = "scheduling"
|
||||||
|
module_id = "scheduling"
|
||||||
|
|
||||||
|
def search_subject(
|
||||||
|
self,
|
||||||
|
session: object,
|
||||||
|
*,
|
||||||
|
tenant_id: str,
|
||||||
|
subject: DsarSubjectRef,
|
||||||
|
) -> Sequence[DsarRecordRef]:
|
||||||
|
db = _session(session)
|
||||||
|
references = _scheduling_references(subject)
|
||||||
|
membership_ids = _membership_ids(subject)
|
||||||
|
respondent_ids = _respondent_ids(subject)
|
||||||
|
account_ids = _account_ids(subject)
|
||||||
|
email = _subject_email(subject)
|
||||||
|
if not any(
|
||||||
|
(
|
||||||
|
references,
|
||||||
|
membership_ids,
|
||||||
|
respondent_ids,
|
||||||
|
account_ids,
|
||||||
|
email,
|
||||||
|
)
|
||||||
|
):
|
||||||
|
return ()
|
||||||
|
|
||||||
|
participants = _matching_participants(
|
||||||
|
db,
|
||||||
|
tenant_id=tenant_id,
|
||||||
|
participant_id=references.get("participant"),
|
||||||
|
respondent_ids=respondent_ids,
|
||||||
|
account_ids=account_ids,
|
||||||
|
email=email,
|
||||||
|
)
|
||||||
|
participant_ids = {row.id for row in participants}
|
||||||
|
request_ids = {row.request_id for row in participants}
|
||||||
|
if references.get("request"):
|
||||||
|
request_ids.add(references["request"])
|
||||||
|
requests = _matching_requests(
|
||||||
|
db,
|
||||||
|
tenant_id=tenant_id,
|
||||||
|
request_ids=request_ids,
|
||||||
|
organizer_ids=membership_ids,
|
||||||
|
)
|
||||||
|
requests_by_id = {row.id: row for row in requests}
|
||||||
|
request_ids = set(requests_by_id)
|
||||||
|
notifications = _matching_notifications(
|
||||||
|
db,
|
||||||
|
tenant_id=tenant_id,
|
||||||
|
request_ids=request_ids,
|
||||||
|
participant_ids=participant_ids,
|
||||||
|
respondent_ids=respondent_ids,
|
||||||
|
email=email,
|
||||||
|
)
|
||||||
|
notifications_by_participant: dict[str, list[SchedulingNotification]] = {}
|
||||||
|
for notification in notifications:
|
||||||
|
if notification.participant_id:
|
||||||
|
notifications_by_participant.setdefault(
|
||||||
|
notification.participant_id, []
|
||||||
|
).append(notification)
|
||||||
|
|
||||||
|
records: list[DsarRecordRef] = []
|
||||||
|
|
||||||
|
def append(record: DsarRecordRef) -> None:
|
||||||
|
if len(records) >= _MAX_RECORDS:
|
||||||
|
raise ValueError(
|
||||||
|
"Scheduling DSAR match limit exceeded; narrow the subject selectors."
|
||||||
|
)
|
||||||
|
records.append(record)
|
||||||
|
|
||||||
|
for request in requests:
|
||||||
|
participant_context = request.id in {row.request_id for row in participants}
|
||||||
|
organizer_context = bool(
|
||||||
|
request.organizer_user_id
|
||||||
|
and request.organizer_user_id in membership_ids
|
||||||
|
)
|
||||||
|
immutable = _request_is_evidence(request)
|
||||||
|
append(
|
||||||
|
_record(
|
||||||
|
"scheduling_request",
|
||||||
|
request.id,
|
||||||
|
"scheduling_request",
|
||||||
|
request.title,
|
||||||
|
{
|
||||||
|
"match_fields": (
|
||||||
|
["organizer_user_id"] if organizer_context else []
|
||||||
|
),
|
||||||
|
"participant_context": participant_context,
|
||||||
|
"title": request.title,
|
||||||
|
"description": request.description,
|
||||||
|
"location": request.location,
|
||||||
|
"timezone": request.timezone,
|
||||||
|
"status": request.status,
|
||||||
|
"deadline_at": _iso(request.deadline_at),
|
||||||
|
"allow_external_participants": request.allow_external_participants,
|
||||||
|
"allow_participant_updates": request.allow_participant_updates,
|
||||||
|
"result_visibility": request.result_visibility,
|
||||||
|
"participant_visibility": request.participant_visibility,
|
||||||
|
"notify_on_answers": request.notify_on_answers,
|
||||||
|
"single_choice": request.single_choice,
|
||||||
|
"max_participants_per_option": request.max_participants_per_option,
|
||||||
|
"allow_maybe": request.allow_maybe,
|
||||||
|
"allow_comments": request.allow_comments,
|
||||||
|
"participant_email_required": request.participant_email_required,
|
||||||
|
"calendar_integration_enabled": request.calendar_integration_enabled,
|
||||||
|
"calendar_freebusy_enabled": request.calendar_freebusy_enabled,
|
||||||
|
"calendar_hold_enabled": request.calendar_hold_enabled,
|
||||||
|
"create_calendar_event_on_decision": request.create_calendar_event_on_decision,
|
||||||
|
"handed_off_at": _iso(request.handed_off_at),
|
||||||
|
"cancelled_at": _iso(request.cancelled_at),
|
||||||
|
"deleted_at": _iso(request.deleted_at),
|
||||||
|
},
|
||||||
|
observed_at=request.updated_at,
|
||||||
|
immutable=immutable,
|
||||||
|
retention_reason=(
|
||||||
|
"Decided, handed-off, cancelled, archived, or deleted scheduling state is institutional decision and coordination evidence."
|
||||||
|
if immutable
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
source_path=f"/scheduling?request={request.id}",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
for slot in _candidate_slots(
|
||||||
|
db,
|
||||||
|
tenant_id=tenant_id,
|
||||||
|
request_ids=request_ids,
|
||||||
|
):
|
||||||
|
request = requests_by_id[slot.request_id]
|
||||||
|
immutable = _request_is_evidence(request) or slot.deleted_at is not None
|
||||||
|
append(
|
||||||
|
_record(
|
||||||
|
"scheduling_candidate_slot",
|
||||||
|
slot.id,
|
||||||
|
"scheduling_candidate_context",
|
||||||
|
slot.label,
|
||||||
|
{
|
||||||
|
"request_id": slot.request_id,
|
||||||
|
"label": slot.label,
|
||||||
|
"description": slot.description,
|
||||||
|
"start_at": _iso(slot.start_at),
|
||||||
|
"end_at": _iso(slot.end_at),
|
||||||
|
"timezone": slot.timezone,
|
||||||
|
"location": slot.location,
|
||||||
|
"position": slot.position,
|
||||||
|
"freebusy_checked_at": _iso(slot.freebusy_checked_at),
|
||||||
|
"freebusy_status": slot.freebusy_status,
|
||||||
|
"deleted_at": _iso(slot.deleted_at),
|
||||||
|
},
|
||||||
|
observed_at=slot.updated_at,
|
||||||
|
immutable=immutable,
|
||||||
|
retention_reason=(
|
||||||
|
"Candidate timing retained with terminal Scheduling decision evidence."
|
||||||
|
if immutable
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
source_path=f"/scheduling?request={slot.request_id}",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
for participant in participants:
|
||||||
|
request = requests_by_id.get(participant.request_id)
|
||||||
|
if request is None:
|
||||||
|
continue
|
||||||
|
matching_fields = _participant_matching_fields(
|
||||||
|
participant,
|
||||||
|
participant_id=references.get("participant"),
|
||||||
|
respondent_ids=respondent_ids,
|
||||||
|
account_ids=account_ids,
|
||||||
|
email=email,
|
||||||
|
)
|
||||||
|
immutable = _request_is_evidence(request) or _participant_is_evidence(
|
||||||
|
participant,
|
||||||
|
notifications_by_participant.get(participant.id, ()),
|
||||||
|
)
|
||||||
|
erasable_without_coordination = not immutable and _participant_is_unengaged(
|
||||||
|
participant,
|
||||||
|
notifications_by_participant.get(participant.id, ()),
|
||||||
|
)
|
||||||
|
append(
|
||||||
|
_record(
|
||||||
|
"scheduling_participant",
|
||||||
|
participant.id,
|
||||||
|
"scheduling_participation",
|
||||||
|
participant.display_name or "Scheduling participant",
|
||||||
|
{
|
||||||
|
"match_fields": matching_fields,
|
||||||
|
"request_id": participant.request_id,
|
||||||
|
"display_name": participant.display_name,
|
||||||
|
"email": _normalized_email(participant.email),
|
||||||
|
"participant_type": participant.participant_type,
|
||||||
|
"required": participant.required,
|
||||||
|
"status": participant.status,
|
||||||
|
"account_bound_at": _iso(participant.account_bound_at),
|
||||||
|
"last_invited_at": _iso(participant.last_invited_at),
|
||||||
|
"responded_at": _iso(participant.responded_at),
|
||||||
|
"response_comment": _bounded_text(participant.response_comment),
|
||||||
|
"deleted_at": _iso(participant.deleted_at),
|
||||||
|
"erasable_without_coordination": erasable_without_coordination,
|
||||||
|
},
|
||||||
|
observed_at=participant.updated_at,
|
||||||
|
immutable=immutable,
|
||||||
|
retention_reason=(
|
||||||
|
"Responded, notified, removed, or terminal participant state is retained with Poll and Scheduling decision evidence."
|
||||||
|
if immutable
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
source_path=f"/scheduling?request={participant.request_id}",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
for notification in notifications:
|
||||||
|
immutable = bool(
|
||||||
|
notification.sent_at
|
||||||
|
or notification.status in _TERMINAL_NOTIFICATION_STATUSES
|
||||||
|
)
|
||||||
|
append(
|
||||||
|
_record(
|
||||||
|
"scheduling_notification",
|
||||||
|
notification.id,
|
||||||
|
"scheduling_notification_evidence",
|
||||||
|
f"Scheduling {notification.event_kind} notification",
|
||||||
|
{
|
||||||
|
"match_fields": _notification_matching_fields(
|
||||||
|
notification,
|
||||||
|
participant_ids=participant_ids,
|
||||||
|
respondent_ids=respondent_ids,
|
||||||
|
email=email,
|
||||||
|
),
|
||||||
|
"request_id": notification.request_id,
|
||||||
|
"participant_id": (
|
||||||
|
notification.participant_id
|
||||||
|
if notification.participant_id in participant_ids
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
"event_kind": notification.event_kind,
|
||||||
|
"channel": notification.channel,
|
||||||
|
"recipient": _matching_recipient(
|
||||||
|
notification.recipient,
|
||||||
|
respondent_ids=respondent_ids,
|
||||||
|
email=email,
|
||||||
|
),
|
||||||
|
"status": notification.status,
|
||||||
|
"sent_at": _iso(notification.sent_at),
|
||||||
|
},
|
||||||
|
observed_at=notification.updated_at,
|
||||||
|
immutable=immutable,
|
||||||
|
retention_reason=(
|
||||||
|
"Terminal Scheduling notification state is delivery and participant-access evidence."
|
||||||
|
if immutable
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return tuple(records)
|
||||||
|
|
||||||
|
def plan_erasure(
|
||||||
|
self,
|
||||||
|
session: object,
|
||||||
|
*,
|
||||||
|
tenant_id: str,
|
||||||
|
subject: DsarSubjectRef,
|
||||||
|
records: Sequence[DsarRecordRef],
|
||||||
|
) -> Sequence[DsarErasureActionRef]:
|
||||||
|
del session
|
||||||
|
actions: list[DsarErasureActionRef] = []
|
||||||
|
for record in records:
|
||||||
|
if (
|
||||||
|
record.provider_id != self.provider_id
|
||||||
|
or record.module_id != self.module_id
|
||||||
|
):
|
||||||
|
raise ValueError("Scheduling DSAR received a foreign provider record.")
|
||||||
|
actions.append(
|
||||||
|
_action(
|
||||||
|
f"scheduling:{'retain' if record.immutable_evidence else 'review'}:{record.resource_type}:{record.resource_id}",
|
||||||
|
"retain" if record.immutable_evidence else "manual_review",
|
||||||
|
record,
|
||||||
|
f"{'Retain' if record.immutable_evidence else 'Review'} {record.title}",
|
||||||
|
record.retention_reason
|
||||||
|
or "Scheduling data can overlap Poll responses, Calendar effects, shared participants, and institutional decisions; review it through the owning lifecycle controls.",
|
||||||
|
executable=False,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
record.resource_type == "scheduling_participant"
|
||||||
|
and record.data.get("erasable_without_coordination") is True
|
||||||
|
and record.data.get("match_fields")
|
||||||
|
):
|
||||||
|
actions.append(
|
||||||
|
_action(
|
||||||
|
f"scheduling:anonymize:scheduling_participant:{record.resource_id}",
|
||||||
|
"anonymize",
|
||||||
|
record,
|
||||||
|
"Anonymize unengaged Scheduling participant",
|
||||||
|
"A participant without invitation, response, self-enrollment, notification, or terminal decision evidence can be removed without changing Poll or Calendar state.",
|
||||||
|
executable=True,
|
||||||
|
irreversible=True,
|
||||||
|
metadata={"tenant_id": tenant_id},
|
||||||
|
)
|
||||||
|
)
|
||||||
|
action_ids = [action.action_id for action in actions]
|
||||||
|
if len(action_ids) != len(set(action_ids)):
|
||||||
|
raise ValueError("Scheduling DSAR produced duplicate action ids.")
|
||||||
|
return tuple(actions)
|
||||||
|
|
||||||
|
def execute_erasure(
|
||||||
|
self,
|
||||||
|
session: object,
|
||||||
|
*,
|
||||||
|
tenant_id: str,
|
||||||
|
subject: DsarSubjectRef,
|
||||||
|
actions: Sequence[DsarErasureActionRef],
|
||||||
|
request_id: str,
|
||||||
|
) -> Sequence[DsarExecutionResultRef]:
|
||||||
|
db = _session(session)
|
||||||
|
results: list[DsarExecutionResultRef] = []
|
||||||
|
for action in actions:
|
||||||
|
if (
|
||||||
|
action.provider_id != self.provider_id
|
||||||
|
or action.module_id != self.module_id
|
||||||
|
or action.metadata.get("tenant_id") != tenant_id
|
||||||
|
or not action.action_id.startswith(
|
||||||
|
"scheduling:anonymize:scheduling_participant:"
|
||||||
|
)
|
||||||
|
):
|
||||||
|
results.append(
|
||||||
|
_blocked(action, "The Scheduling DSAR action is stale or invalid.")
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
results.append(
|
||||||
|
_anonymize_unengaged_participant(
|
||||||
|
db,
|
||||||
|
tenant_id=tenant_id,
|
||||||
|
subject=subject,
|
||||||
|
action=action,
|
||||||
|
request_id=request_id,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
db.flush()
|
||||||
|
return tuple(results)
|
||||||
|
|
||||||
|
|
||||||
|
def _matching_participants(
|
||||||
|
session: Session,
|
||||||
|
*,
|
||||||
|
tenant_id: str,
|
||||||
|
participant_id: str | None,
|
||||||
|
respondent_ids: set[str],
|
||||||
|
account_ids: set[str],
|
||||||
|
email: str | None,
|
||||||
|
) -> list[SchedulingParticipant]:
|
||||||
|
conditions = []
|
||||||
|
if participant_id:
|
||||||
|
conditions.append(SchedulingParticipant.id == participant_id)
|
||||||
|
if respondent_ids:
|
||||||
|
conditions.append(SchedulingParticipant.respondent_id.in_(respondent_ids))
|
||||||
|
if account_ids:
|
||||||
|
conditions.append(SchedulingParticipant.bound_account_id.in_(account_ids))
|
||||||
|
if email:
|
||||||
|
conditions.append(func.lower(SchedulingParticipant.email) == email)
|
||||||
|
if not conditions:
|
||||||
|
return []
|
||||||
|
candidates = _bounded_rows(
|
||||||
|
session.query(SchedulingParticipant)
|
||||||
|
.filter(SchedulingParticipant.tenant_id == tenant_id, or_(*conditions))
|
||||||
|
.order_by(SchedulingParticipant.id)
|
||||||
|
)
|
||||||
|
return [
|
||||||
|
row
|
||||||
|
for row in candidates
|
||||||
|
if _participant_matching_fields(
|
||||||
|
row,
|
||||||
|
participant_id=participant_id,
|
||||||
|
respondent_ids=respondent_ids,
|
||||||
|
account_ids=account_ids,
|
||||||
|
email=email,
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _matching_requests(
|
||||||
|
session: Session,
|
||||||
|
*,
|
||||||
|
tenant_id: str,
|
||||||
|
request_ids: set[str],
|
||||||
|
organizer_ids: set[str],
|
||||||
|
) -> list[SchedulingRequest]:
|
||||||
|
conditions = []
|
||||||
|
if request_ids:
|
||||||
|
conditions.append(SchedulingRequest.id.in_(request_ids))
|
||||||
|
if organizer_ids:
|
||||||
|
conditions.append(SchedulingRequest.organizer_user_id.in_(organizer_ids))
|
||||||
|
if not conditions:
|
||||||
|
return []
|
||||||
|
return _bounded_rows(
|
||||||
|
session.query(SchedulingRequest)
|
||||||
|
.filter(SchedulingRequest.tenant_id == tenant_id, or_(*conditions))
|
||||||
|
.order_by(SchedulingRequest.id)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _candidate_slots(
|
||||||
|
session: Session,
|
||||||
|
*,
|
||||||
|
tenant_id: str,
|
||||||
|
request_ids: set[str],
|
||||||
|
) -> list[SchedulingCandidateSlot]:
|
||||||
|
if not request_ids:
|
||||||
|
return []
|
||||||
|
return _bounded_rows(
|
||||||
|
session.query(SchedulingCandidateSlot)
|
||||||
|
.filter(
|
||||||
|
SchedulingCandidateSlot.tenant_id == tenant_id,
|
||||||
|
SchedulingCandidateSlot.request_id.in_(request_ids),
|
||||||
|
)
|
||||||
|
.order_by(SchedulingCandidateSlot.request_id, SchedulingCandidateSlot.position)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _matching_notifications(
|
||||||
|
session: Session,
|
||||||
|
*,
|
||||||
|
tenant_id: str,
|
||||||
|
request_ids: set[str],
|
||||||
|
participant_ids: set[str],
|
||||||
|
respondent_ids: set[str],
|
||||||
|
email: str | None,
|
||||||
|
) -> list[SchedulingNotification]:
|
||||||
|
if not request_ids:
|
||||||
|
return []
|
||||||
|
conditions = []
|
||||||
|
if participant_ids:
|
||||||
|
conditions.append(SchedulingNotification.participant_id.in_(participant_ids))
|
||||||
|
if respondent_ids:
|
||||||
|
conditions.append(SchedulingNotification.recipient.in_(respondent_ids))
|
||||||
|
if email:
|
||||||
|
conditions.append(func.lower(SchedulingNotification.recipient) == email)
|
||||||
|
if not conditions:
|
||||||
|
return []
|
||||||
|
candidates = _bounded_rows(
|
||||||
|
session.query(SchedulingNotification)
|
||||||
|
.filter(
|
||||||
|
SchedulingNotification.tenant_id == tenant_id,
|
||||||
|
SchedulingNotification.request_id.in_(request_ids),
|
||||||
|
or_(*conditions),
|
||||||
|
)
|
||||||
|
.order_by(SchedulingNotification.id)
|
||||||
|
)
|
||||||
|
return [
|
||||||
|
row
|
||||||
|
for row in candidates
|
||||||
|
if _notification_matching_fields(
|
||||||
|
row,
|
||||||
|
participant_ids=participant_ids,
|
||||||
|
respondent_ids=respondent_ids,
|
||||||
|
email=email,
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _participant_matching_fields(
|
||||||
|
row: SchedulingParticipant,
|
||||||
|
*,
|
||||||
|
participant_id: str | None,
|
||||||
|
respondent_ids: set[str],
|
||||||
|
account_ids: set[str],
|
||||||
|
email: str | None,
|
||||||
|
) -> list[str]:
|
||||||
|
fields = []
|
||||||
|
if participant_id and row.id == participant_id:
|
||||||
|
fields.append("id")
|
||||||
|
if row.respondent_id and row.respondent_id in respondent_ids:
|
||||||
|
fields.append("respondent_id")
|
||||||
|
if row.bound_account_id and row.bound_account_id in account_ids:
|
||||||
|
fields.append("bound_account_id")
|
||||||
|
if email and _normalized_email(row.email) == email:
|
||||||
|
fields.append("email")
|
||||||
|
return fields
|
||||||
|
|
||||||
|
|
||||||
|
def _notification_matching_fields(
|
||||||
|
row: SchedulingNotification,
|
||||||
|
*,
|
||||||
|
participant_ids: set[str],
|
||||||
|
respondent_ids: set[str],
|
||||||
|
email: str | None,
|
||||||
|
) -> list[str]:
|
||||||
|
fields = []
|
||||||
|
if row.participant_id and row.participant_id in participant_ids:
|
||||||
|
fields.append("participant_id")
|
||||||
|
recipient = str(row.recipient or "").strip()
|
||||||
|
if recipient in respondent_ids:
|
||||||
|
fields.append("recipient")
|
||||||
|
if email and _normalized_email(recipient) == email:
|
||||||
|
fields.append("recipient")
|
||||||
|
return list(dict.fromkeys(fields))
|
||||||
|
|
||||||
|
|
||||||
|
def _matching_recipient(
|
||||||
|
value: object,
|
||||||
|
*,
|
||||||
|
respondent_ids: set[str],
|
||||||
|
email: str | None,
|
||||||
|
) -> str | None:
|
||||||
|
candidate = str(value or "").strip()
|
||||||
|
if candidate in respondent_ids:
|
||||||
|
return candidate
|
||||||
|
if email and _normalized_email(candidate) == email:
|
||||||
|
return email
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _request_is_evidence(row: SchedulingRequest) -> bool:
|
||||||
|
return bool(
|
||||||
|
row.status in _TERMINAL_REQUEST_STATUSES
|
||||||
|
or row.handed_off_at
|
||||||
|
or row.cancelled_at
|
||||||
|
or row.deleted_at
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _participant_is_evidence(
|
||||||
|
row: SchedulingParticipant,
|
||||||
|
notifications: Sequence[SchedulingNotification],
|
||||||
|
) -> bool:
|
||||||
|
return bool(
|
||||||
|
row.poll_invitation_id
|
||||||
|
or row.responded_at
|
||||||
|
or row.response_comment
|
||||||
|
or row.self_enrollment_link_id
|
||||||
|
or row.self_enrollment_proof_hash
|
||||||
|
or row.status in {"responded", "removed"}
|
||||||
|
or notifications
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _participant_is_unengaged(
|
||||||
|
row: SchedulingParticipant,
|
||||||
|
notifications: Sequence[SchedulingNotification],
|
||||||
|
) -> bool:
|
||||||
|
return bool(
|
||||||
|
row.deleted_at is None
|
||||||
|
and row.status in {"draft", "invited"}
|
||||||
|
and row.poll_invitation_id is None
|
||||||
|
and row.responded_at is None
|
||||||
|
and not row.response_comment
|
||||||
|
and row.self_enrollment_link_id is None
|
||||||
|
and row.self_enrollment_proof_hash is None
|
||||||
|
and not notifications
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _anonymize_unengaged_participant(
|
||||||
|
session: Session,
|
||||||
|
*,
|
||||||
|
tenant_id: str,
|
||||||
|
subject: DsarSubjectRef,
|
||||||
|
action: DsarErasureActionRef,
|
||||||
|
request_id: str,
|
||||||
|
) -> DsarExecutionResultRef:
|
||||||
|
row = (
|
||||||
|
session.query(SchedulingParticipant)
|
||||||
|
.filter(
|
||||||
|
SchedulingParticipant.id == action.resource_id,
|
||||||
|
SchedulingParticipant.tenant_id == tenant_id,
|
||||||
|
)
|
||||||
|
.with_for_update()
|
||||||
|
.one_or_none()
|
||||||
|
)
|
||||||
|
if row is None:
|
||||||
|
return _result(
|
||||||
|
action,
|
||||||
|
"unchanged",
|
||||||
|
"The Scheduling participant was already absent.",
|
||||||
|
{"request_id": request_id},
|
||||||
|
)
|
||||||
|
if _participant_is_anonymized(row):
|
||||||
|
return _result(
|
||||||
|
action,
|
||||||
|
"unchanged",
|
||||||
|
"The Scheduling participant was already anonymized.",
|
||||||
|
{"request_id": request_id},
|
||||||
|
)
|
||||||
|
if not _participant_matches_subject(row, subject):
|
||||||
|
return _blocked(
|
||||||
|
action, "The Scheduling participant identity changed after planning."
|
||||||
|
)
|
||||||
|
request = (
|
||||||
|
session.query(SchedulingRequest)
|
||||||
|
.filter(
|
||||||
|
SchedulingRequest.id == row.request_id,
|
||||||
|
SchedulingRequest.tenant_id == tenant_id,
|
||||||
|
)
|
||||||
|
.with_for_update()
|
||||||
|
.one_or_none()
|
||||||
|
)
|
||||||
|
if request is None or _request_is_evidence(request):
|
||||||
|
return _blocked(
|
||||||
|
action,
|
||||||
|
"The Scheduling request is absent or became retained decision evidence.",
|
||||||
|
)
|
||||||
|
notifications = _participant_notifications(session, row)
|
||||||
|
if not _participant_is_unengaged(row, notifications):
|
||||||
|
return _blocked(
|
||||||
|
action,
|
||||||
|
"The participant gained invitation, response, enrollment, or notification evidence after planning.",
|
||||||
|
)
|
||||||
|
|
||||||
|
now = datetime.now(timezone.utc)
|
||||||
|
row.respondent_id = None
|
||||||
|
row.display_name = None
|
||||||
|
row.email = None
|
||||||
|
row.status = "removed"
|
||||||
|
row.poll_invitation_id = None
|
||||||
|
row.participation_gateway = None
|
||||||
|
row.self_enrollment_link_id = None
|
||||||
|
row.self_enrollment_proof_hash = None
|
||||||
|
row.bound_account_id = None
|
||||||
|
row.account_bound_at = None
|
||||||
|
row.last_invited_at = None
|
||||||
|
row.responded_at = None
|
||||||
|
row.response_comment = None
|
||||||
|
row.deleted_at = now
|
||||||
|
row.metadata_ = None
|
||||||
|
return _result(
|
||||||
|
action,
|
||||||
|
"executed",
|
||||||
|
"The unengaged Scheduling participant was anonymized and retired.",
|
||||||
|
{"request_id": request_id},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _participant_notifications(
|
||||||
|
session: Session,
|
||||||
|
row: SchedulingParticipant,
|
||||||
|
) -> list[SchedulingNotification]:
|
||||||
|
conditions = [SchedulingNotification.participant_id == row.id]
|
||||||
|
email = _normalized_email(row.email)
|
||||||
|
if email:
|
||||||
|
conditions.append(func.lower(SchedulingNotification.recipient) == email)
|
||||||
|
return _bounded_rows(
|
||||||
|
session.query(SchedulingNotification)
|
||||||
|
.filter(
|
||||||
|
SchedulingNotification.tenant_id == row.tenant_id,
|
||||||
|
SchedulingNotification.request_id == row.request_id,
|
||||||
|
or_(*conditions),
|
||||||
|
)
|
||||||
|
.order_by(SchedulingNotification.id)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _participant_matches_subject(
|
||||||
|
row: SchedulingParticipant,
|
||||||
|
subject: DsarSubjectRef,
|
||||||
|
) -> bool:
|
||||||
|
return bool(
|
||||||
|
_participant_matching_fields(
|
||||||
|
row,
|
||||||
|
participant_id=_scheduling_references(subject).get("participant"),
|
||||||
|
respondent_ids=_respondent_ids(subject),
|
||||||
|
account_ids=_account_ids(subject),
|
||||||
|
email=_subject_email(subject),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _participant_is_anonymized(row: SchedulingParticipant) -> bool:
|
||||||
|
return bool(
|
||||||
|
row.deleted_at is not None
|
||||||
|
and row.status == "removed"
|
||||||
|
and row.respondent_id is None
|
||||||
|
and row.display_name is None
|
||||||
|
and row.email is None
|
||||||
|
and row.poll_invitation_id is None
|
||||||
|
and row.self_enrollment_link_id is None
|
||||||
|
and row.self_enrollment_proof_hash is None
|
||||||
|
and row.bound_account_id is None
|
||||||
|
and row.response_comment is None
|
||||||
|
and row.metadata_ is None
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _scheduling_references(subject: DsarSubjectRef) -> dict[str, str]:
|
||||||
|
aliases = {
|
||||||
|
"scheduling.request": "request",
|
||||||
|
"scheduling.request_id": "request",
|
||||||
|
"scheduling.participant": "participant",
|
||||||
|
"scheduling.participant_id": "participant",
|
||||||
|
}
|
||||||
|
references: dict[str, str] = {}
|
||||||
|
for key, target in aliases.items():
|
||||||
|
value = str(subject.external_references.get(key) or "").strip()
|
||||||
|
if value and target not in references:
|
||||||
|
references[target] = value
|
||||||
|
return references
|
||||||
|
|
||||||
|
|
||||||
|
def _membership_ids(subject: DsarSubjectRef) -> set[str]:
|
||||||
|
values = [subject.membership_id]
|
||||||
|
values.extend(
|
||||||
|
subject.external_references.get(key)
|
||||||
|
for key in (
|
||||||
|
"scheduling.user",
|
||||||
|
"scheduling.membership",
|
||||||
|
"access.membership",
|
||||||
|
"membership_id",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return _identifiers(values)
|
||||||
|
|
||||||
|
|
||||||
|
def _respondent_ids(subject: DsarSubjectRef) -> set[str]:
|
||||||
|
values = [subject.membership_id, subject.identity_id, subject.account_id]
|
||||||
|
values.extend(
|
||||||
|
subject.external_references.get(key)
|
||||||
|
for key in (
|
||||||
|
"scheduling.respondent",
|
||||||
|
"poll.respondent",
|
||||||
|
"access.membership",
|
||||||
|
"membership_id",
|
||||||
|
"identity_id",
|
||||||
|
"account_id",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return _identifiers(values)
|
||||||
|
|
||||||
|
|
||||||
|
def _account_ids(subject: DsarSubjectRef) -> set[str]:
|
||||||
|
values = [subject.account_id]
|
||||||
|
values.extend(
|
||||||
|
subject.external_references.get(key)
|
||||||
|
for key in ("scheduling.account", "access.account", "account_id")
|
||||||
|
)
|
||||||
|
return _identifiers(values)
|
||||||
|
|
||||||
|
|
||||||
|
def _identifiers(values: Sequence[object]) -> set[str]:
|
||||||
|
return {text for value in values if (text := str(value or "").strip())}
|
||||||
|
|
||||||
|
|
||||||
|
def _subject_email(subject: DsarSubjectRef) -> str | None:
|
||||||
|
candidates = [subject.email]
|
||||||
|
candidates.extend(
|
||||||
|
subject.external_references.get(key)
|
||||||
|
for key in ("scheduling.email", "scheduling.participant_email")
|
||||||
|
)
|
||||||
|
normalized = {
|
||||||
|
email for value in candidates if (email := _normalized_email(value)) is not None
|
||||||
|
}
|
||||||
|
return normalized.pop() if len(normalized) == 1 else None
|
||||||
|
|
||||||
|
|
||||||
|
def _normalized_email(value: object) -> str | None:
|
||||||
|
if not isinstance(value, str):
|
||||||
|
return None
|
||||||
|
normalized = value.strip().casefold()
|
||||||
|
return normalized or None
|
||||||
|
|
||||||
|
|
||||||
|
def _bounded_text(value: str | None) -> str | None:
|
||||||
|
return value[:2_000] if value else None
|
||||||
|
|
||||||
|
|
||||||
|
def _record(
|
||||||
|
resource_type: str,
|
||||||
|
resource_id: str,
|
||||||
|
category: str,
|
||||||
|
title: str,
|
||||||
|
data: Mapping[str, object],
|
||||||
|
*,
|
||||||
|
observed_at: datetime | None = None,
|
||||||
|
immutable: bool = False,
|
||||||
|
retention_reason: str | None = None,
|
||||||
|
source_path: str | None = None,
|
||||||
|
) -> DsarRecordRef:
|
||||||
|
return DsarRecordRef(
|
||||||
|
provider_id="scheduling",
|
||||||
|
module_id="scheduling",
|
||||||
|
resource_type=resource_type,
|
||||||
|
resource_id=resource_id,
|
||||||
|
category=category,
|
||||||
|
title=title,
|
||||||
|
data=data,
|
||||||
|
observed_at=observed_at,
|
||||||
|
immutable_evidence=immutable,
|
||||||
|
retention_reason=retention_reason,
|
||||||
|
source_path=source_path,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _action(
|
||||||
|
action_id: str,
|
||||||
|
kind: str,
|
||||||
|
record: DsarRecordRef,
|
||||||
|
title: str,
|
||||||
|
rationale: str,
|
||||||
|
*,
|
||||||
|
executable: bool,
|
||||||
|
irreversible: bool = False,
|
||||||
|
metadata: Mapping[str, object] | None = None,
|
||||||
|
) -> DsarErasureActionRef:
|
||||||
|
return DsarErasureActionRef(
|
||||||
|
action_id=action_id,
|
||||||
|
provider_id="scheduling",
|
||||||
|
module_id="scheduling",
|
||||||
|
kind=kind, # type: ignore[arg-type]
|
||||||
|
resource_type=record.resource_type,
|
||||||
|
resource_id=record.resource_id,
|
||||||
|
title=title,
|
||||||
|
rationale=rationale,
|
||||||
|
executable=executable,
|
||||||
|
irreversible=irreversible,
|
||||||
|
metadata=metadata or {},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _result(
|
||||||
|
action: DsarErasureActionRef,
|
||||||
|
status: str,
|
||||||
|
summary: str,
|
||||||
|
evidence: Mapping[str, object] | None = None,
|
||||||
|
) -> DsarExecutionResultRef:
|
||||||
|
return DsarExecutionResultRef(
|
||||||
|
action_id=action.action_id,
|
||||||
|
status=status, # type: ignore[arg-type]
|
||||||
|
summary=summary,
|
||||||
|
evidence=evidence or {},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _blocked(action: DsarErasureActionRef, summary: str) -> DsarExecutionResultRef:
|
||||||
|
return _result(action, "blocked", summary)
|
||||||
|
|
||||||
|
|
||||||
|
def _session(value: object) -> Session:
|
||||||
|
if not isinstance(value, Session):
|
||||||
|
raise TypeError("Scheduling DSAR provider requires a SQLAlchemy session.")
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def _bounded_rows(query: object) -> list[object]:
|
||||||
|
rows = query.limit(_MAX_RECORDS + 1).all() # type: ignore[attr-defined]
|
||||||
|
if len(rows) > _MAX_RECORDS:
|
||||||
|
raise ValueError(
|
||||||
|
"Scheduling DSAR match limit exceeded; narrow the subject selectors."
|
||||||
|
)
|
||||||
|
return rows
|
||||||
|
|
||||||
|
|
||||||
|
def _iso(value: datetime | None) -> str | None:
|
||||||
|
if value is None:
|
||||||
|
return None
|
||||||
|
if value.tzinfo is None:
|
||||||
|
value = value.replace(tzinfo=timezone.utc)
|
||||||
|
return value.isoformat()
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ["SCHEDULING_DSAR_CAPABILITY", "SchedulingDsarProvider"]
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
"""German translations for public structured documentation metadata."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
|
GERMAN_STRUCTURED_TRANSLATIONS: dict[str, dict[str, Any]] = {'scheduling.find-and-decide-meeting-time': {'outcome': 'Eine aufgezeichnete '
|
||||||
|
'Terminplanungsentscheidung mit begrenzter '
|
||||||
|
'Teilnahme und optionaler '
|
||||||
|
'Kalenderübergabe.',
|
||||||
|
'steps': ['Bereiten Sie Kandidatenzeiten und '
|
||||||
|
'Teilnahmekontrollen vor.',
|
||||||
|
'Erfassen und Überprüfen der Verfügbarkeit.',
|
||||||
|
'Schließen Sie die Umfrage und bestätigen '
|
||||||
|
'Sie die gewählte Zeit.',
|
||||||
|
'Geben Sie die Entscheidung an den '
|
||||||
|
'Kalender, wenn er konfiguriert ist.'],
|
||||||
|
'verification': 'Das Anforderungsdetail zeigt den '
|
||||||
|
'entschiedenen Slot, den '
|
||||||
|
'Lebenszykluszustand, das '
|
||||||
|
'Teilnehmeraggregat und jede '
|
||||||
|
'Kalenderereignisreferenz.'},
|
||||||
|
'scheduling.privacy.data-subject-requests': {'limitations': ['Umfragen und Einladungsbeweise '
|
||||||
|
'werden nicht in den Export von '
|
||||||
|
'Scheduling kopiert.',
|
||||||
|
'Die Löschung der Teilnehmer bleibt '
|
||||||
|
'manuell, wenn gemeinsame Antworten, '
|
||||||
|
'Lieferung, Selbsteinschreibung, '
|
||||||
|
'Kalendereffekte oder '
|
||||||
|
'Terminalentscheidungen vorliegen.'],
|
||||||
|
'prerequisites': ['Die Datenschutzanfrage und die '
|
||||||
|
'Planungsauswahl wurden unabhängig '
|
||||||
|
'autorisiert und bestätigt.',
|
||||||
|
'Der Rezensent kann sich mit Poll- '
|
||||||
|
'und Kalenderbesitzern abstimmen, '
|
||||||
|
'wenn eine Antwort oder ein '
|
||||||
|
'Ereignis involviert ist.'],
|
||||||
|
'steps': ['Führen Sie die Scheduling-Provider-Such- '
|
||||||
|
'und Überprüfungsdispositionen für '
|
||||||
|
'Teilnehmer, Anfrage, Slot und '
|
||||||
|
'Benachrichtigung aus.',
|
||||||
|
'Führen Sie den Umfrageanbieter für '
|
||||||
|
'tatsächliche Verfügbarkeitsoptionen und '
|
||||||
|
'den Kalenderanbieter für Ereignis oder '
|
||||||
|
'Haltezustand aus.',
|
||||||
|
'Bewahren Sie die Entscheidung und den '
|
||||||
|
'Liefernachweis mit dem Grund auf.',
|
||||||
|
'Anonymisierung nur für einen zugelassenen '
|
||||||
|
'Teilnehmer durchführen, der nach der '
|
||||||
|
'Revalidierung als nicht engagiert '
|
||||||
|
'eingestuft wurde.']},
|
||||||
|
'scheduling.public-self-enrollment': {'steps': ['Wählen Sie eine begrenzte Kapazität, Ablauf und '
|
||||||
|
'erlaubte Identitätsmodi.',
|
||||||
|
'Kopieren Sie den neu ausgestellten Link; der '
|
||||||
|
'Rohnachweis wird nur einmal angezeigt.',
|
||||||
|
'Überwachen Sie die Anzahl der Registrierungen '
|
||||||
|
'und widerrufen Sie den Link, wenn er nicht mehr '
|
||||||
|
'benötigt wird.',
|
||||||
|
'Erfordern Sie einen Wiederherstellungsnachweis, '
|
||||||
|
'bevor Sie eine anonyme Antwort aktualisieren '
|
||||||
|
'oder binden.'],
|
||||||
|
'verification': 'Die Linkliste zeigt Status, Ablauf, '
|
||||||
|
'Kapazitätsnutzung, Zugriffsmodi und '
|
||||||
|
'Widerruf an, ohne die Anmeldeinformationen '
|
||||||
|
'erneut anzuzeigen.'}}
|
||||||
@@ -1,13 +1,26 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from govoplan_core.core.modules import with_documentation_structured_translations
|
||||||
|
from govoplan_scheduling.backend.german_structured_documentation import GERMAN_STRUCTURED_TRANSLATIONS
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from govoplan_core.core.access import CAPABILITY_AUTH_PERMISSION_EVALUATOR, CAPABILITY_AUTH_PRINCIPAL_RESOLVER
|
from govoplan_core.core.access import (
|
||||||
|
CAPABILITY_AUTH_PERMISSION_EVALUATOR,
|
||||||
|
CAPABILITY_AUTH_PRINCIPAL_RESOLVER,
|
||||||
|
)
|
||||||
from govoplan_core.core.calendar import CAPABILITY_CALENDAR_SCHEDULING
|
from govoplan_core.core.calendar import CAPABILITY_CALENDAR_SCHEDULING
|
||||||
from govoplan_core.core.module_guards import drop_table_retirement_provider, persistent_table_uninstall_guard
|
from govoplan_core.core.module_guards import (
|
||||||
|
drop_table_retirement_provider,
|
||||||
|
persistent_table_uninstall_guard,
|
||||||
|
)
|
||||||
from govoplan_core.core.modules import (
|
from govoplan_core.core.modules import (
|
||||||
|
CapabilityDocumentation,
|
||||||
DocumentationTopic,
|
DocumentationTopic,
|
||||||
|
DocumentationCondition,
|
||||||
|
DocumentationLink,
|
||||||
FrontendModule,
|
FrontendModule,
|
||||||
|
FrontendRoute,
|
||||||
MigrationSpec,
|
MigrationSpec,
|
||||||
ModuleContext,
|
ModuleContext,
|
||||||
ModuleInterfaceProvider,
|
ModuleInterfaceProvider,
|
||||||
@@ -15,22 +28,30 @@ from govoplan_core.core.modules import (
|
|||||||
ModuleManifest,
|
ModuleManifest,
|
||||||
NavItem,
|
NavItem,
|
||||||
PermissionDefinition,
|
PermissionDefinition,
|
||||||
|
ProductAreaContribution,
|
||||||
PublicFrontendRoute,
|
PublicFrontendRoute,
|
||||||
RoleTemplate,
|
RoleTemplate,
|
||||||
)
|
)
|
||||||
|
from govoplan_core.core.provider_governance import declared_module_architecture
|
||||||
from govoplan_core.core.people import (
|
from govoplan_core.core.people import (
|
||||||
CAPABILITY_ACCESS_PEOPLE_SEARCH,
|
CAPABILITY_ACCESS_PEOPLE_SEARCH,
|
||||||
CAPABILITY_ADDRESSES_PEOPLE_SEARCH,
|
CAPABILITY_ADDRESSES_PEOPLE_SEARCH,
|
||||||
)
|
)
|
||||||
from govoplan_core.core.poll import CAPABILITY_POLL_SCHEDULING
|
from govoplan_core.core.poll import CAPABILITY_POLL_SCHEDULING, PollCapabilityError
|
||||||
from govoplan_core.core.poll_participation import CAPABILITY_POLL_PARTICIPATION_GATEWAY
|
from govoplan_core.core.poll_participation import (
|
||||||
|
CAPABILITY_POLL_PARTICIPATION_GATEWAY,
|
||||||
|
PollResponseGatewayRef,
|
||||||
|
poll_participation_gateway_provider,
|
||||||
|
)
|
||||||
from govoplan_core.core.policy import CAPABILITY_POLICY_SCHEDULING_PARTICIPANT_PRIVACY
|
from govoplan_core.core.policy import CAPABILITY_POLICY_SCHEDULING_PARTICIPANT_PRIVACY
|
||||||
|
from govoplan_core.core.views import ViewSurface
|
||||||
from govoplan_core.db.base import Base
|
from govoplan_core.db.base import Base
|
||||||
from govoplan_scheduling.backend.db import models as scheduling_models # noqa: F401 - populate Scheduling ORM metadata
|
from govoplan_scheduling.backend.db import models as scheduling_models # noqa: F401 - populate Scheduling ORM metadata
|
||||||
|
from govoplan_scheduling.backend.dsar_provider import SCHEDULING_DSAR_CAPABILITY
|
||||||
|
|
||||||
MODULE_ID = "scheduling"
|
MODULE_ID = "scheduling"
|
||||||
MODULE_NAME = "Scheduling"
|
MODULE_NAME = "Scheduling"
|
||||||
MODULE_VERSION = "0.1.11"
|
MODULE_VERSION = "0.1.21"
|
||||||
READ_SCOPE = "scheduling:schedule:read"
|
READ_SCOPE = "scheduling:schedule:read"
|
||||||
WRITE_SCOPE = "scheduling:schedule:write"
|
WRITE_SCOPE = "scheduling:schedule:write"
|
||||||
ADMIN_SCOPE = "scheduling:schedule:admin"
|
ADMIN_SCOPE = "scheduling:schedule:admin"
|
||||||
@@ -52,10 +73,26 @@ def _permission(scope: str, label: str, description: str) -> PermissionDefinitio
|
|||||||
|
|
||||||
|
|
||||||
PERMISSIONS = (
|
PERMISSIONS = (
|
||||||
_permission(READ_SCOPE, "View scheduling", "Read scheduling polls, proposals, participant state, and selected outcomes."),
|
_permission(
|
||||||
_permission(WRITE_SCOPE, "Manage own scheduling", "Create scheduling polls and manage requests for which the account is the organizer."),
|
READ_SCOPE,
|
||||||
_permission(ADMIN_SCOPE, "Administer scheduling", "Manage every tenant scheduling request and configure scheduling policies, external participation, and retention defaults."),
|
"View scheduling",
|
||||||
_permission(RESPOND_SCOPE, "Respond to scheduling polls", "Submit and update own scheduling availability responses."),
|
"Read scheduling polls, proposals, participant state, and selected outcomes.",
|
||||||
|
),
|
||||||
|
_permission(
|
||||||
|
WRITE_SCOPE,
|
||||||
|
"Manage own scheduling",
|
||||||
|
"Create scheduling polls and manage requests for which the account is the organizer.",
|
||||||
|
),
|
||||||
|
_permission(
|
||||||
|
ADMIN_SCOPE,
|
||||||
|
"Administer scheduling",
|
||||||
|
"Manage every tenant scheduling request and configure scheduling policies, external participation, and retention defaults.",
|
||||||
|
),
|
||||||
|
_permission(
|
||||||
|
RESPOND_SCOPE,
|
||||||
|
"Respond to scheduling polls",
|
||||||
|
"Submit and update own scheduling availability responses.",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
ROLE_TEMPLATES = (
|
ROLE_TEMPLATES = (
|
||||||
@@ -88,36 +125,368 @@ DOCUMENTATION = (
|
|||||||
"flows remain possible."
|
"flows remain possible."
|
||||||
),
|
),
|
||||||
layer="available",
|
layer="available",
|
||||||
documentation_types=("admin",),
|
documentation_types=("admin", "user"),
|
||||||
audience=("operator", "module_admin", "product_owner"),
|
audience=("user", "operator", "module_admin", "product_owner"),
|
||||||
related_modules=("poll", "evaluation", "calendar", "appointments", "mail", "notifications", "portal"),
|
related_modules=(
|
||||||
|
"poll",
|
||||||
|
"evaluation",
|
||||||
|
"calendar",
|
||||||
|
"appointments",
|
||||||
|
"mail",
|
||||||
|
"notifications",
|
||||||
|
"portal",
|
||||||
|
),
|
||||||
|
translations={
|
||||||
|
"de": {
|
||||||
|
"title": "Modulgrenze von Scheduling",
|
||||||
|
"summary": "Terminplanung und Terminfindung auf Grundlage wiederverwendbarer Verfügbarkeitsbausteine von Poll.",
|
||||||
|
"body": (
|
||||||
|
"Scheduling besitzt Abläufe zur Terminfindung, Terminkandidaten, Erfassung der Teilnehmendenverfügbarkeit, "
|
||||||
|
"Konflikterklärung, Erinnerungen und Entscheidungsübergabe. Für wiederverwendbare Verfügbarkeitsmatrizen und den "
|
||||||
|
"pollgestützten Workflow-Kontext verwendet es Poll und kann optional Evaluation für Rückmeldungen nach einem Termin "
|
||||||
|
"auslösen. Access ist optional: Ist es installiert, kann Scheduling Hauptpersonenauflösung, Berechtigungsprüfung, Gruppen "
|
||||||
|
"und Rollenvorlagen verwenden; ohne Access bleiben eingeschränkte Abläufe über signierte Links oder lokale Organisation möglich."
|
||||||
|
),
|
||||||
|
}
|
||||||
|
},
|
||||||
metadata={"seed": True},
|
metadata={"seed": True},
|
||||||
),
|
),
|
||||||
|
DocumentationTopic(
|
||||||
|
id="scheduling.privacy.data-subject-requests",
|
||||||
|
title="Review Scheduling data in a data-subject request",
|
||||||
|
summary="Collect tenant-scoped participation and coordination metadata while leaving Poll responses and Calendar effects with their owners.",
|
||||||
|
body=(
|
||||||
|
"Scheduling's DSAR provider searches the effective tenant by normalized participant email, membership, identity or bound-account references, and namespaced Scheduling request or participant references. "
|
||||||
|
"It isolates the matching participant, request and candidate-slot context, and matching notification envelopes. It does not export Poll or invitation identifiers, participation-gateway state, reusable enrollment links or proof hashes, anonymous-password hashes, Calendar event or hold identifiers, free/busy conflict detail, notification payloads or errors, token material, opaque metadata, or unrelated participants. Poll remains authoritative for actual availability choices and response-retirement evidence; Calendar remains authoritative for event, hold, and synchronization state. "
|
||||||
|
"Decided, handed-off, cancelled, archived, responded, notified, or removed state is retained with a reason. Active shared scheduling content requires coordinated manual review. The provider can anonymize and retire only a participant who has no invitation, response, enrollment, notification, or terminal decision evidence, and revalidates all of those conditions under tenant-bound row locks before acting."
|
||||||
|
),
|
||||||
|
layer="configured",
|
||||||
|
documentation_types=("admin",),
|
||||||
|
audience=(
|
||||||
|
"privacy_officer",
|
||||||
|
"scheduling_manager",
|
||||||
|
"records_manager",
|
||||||
|
"operator",
|
||||||
|
),
|
||||||
|
order=5,
|
||||||
|
conditions=(
|
||||||
|
DocumentationCondition(
|
||||||
|
required_modules=("scheduling", "access"),
|
||||||
|
any_scopes=(
|
||||||
|
"access:privacy:read",
|
||||||
|
"access:privacy:manage",
|
||||||
|
"access:privacy:erase",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
links=(
|
||||||
|
DocumentationLink(
|
||||||
|
label="Data-subject requests",
|
||||||
|
href="/admin?section=tenant-data-subject-requests",
|
||||||
|
kind="runtime",
|
||||||
|
),
|
||||||
|
DocumentationLink(
|
||||||
|
label="Scheduling module guide",
|
||||||
|
href="govoplan-scheduling/README.md",
|
||||||
|
kind="repository",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
related_modules=("access", "audit", "poll", "calendar", "notifications"),
|
||||||
|
translations={
|
||||||
|
"de": {
|
||||||
|
"title": "Scheduling-Daten in einer Betroffenenanfrage prüfen",
|
||||||
|
"summary": (
|
||||||
|
"Mandantenbezogene Teilnahme- und Koordinationsmetadaten erfassen, während Poll-Antworten und Calendar-Wirkungen "
|
||||||
|
"bei ihren zuständigen Modulen verbleiben."
|
||||||
|
),
|
||||||
|
"body": (
|
||||||
|
"Der DSAR-Provider von Scheduling durchsucht den wirksamen Mandanten anhand normalisierter E-Mail-Adressen der "
|
||||||
|
"Teilnehmenden, Mitgliedschafts-, Identitäts- oder gebundener Kontoverweise sowie namensraumgebundener Scheduling-Anfrage- "
|
||||||
|
"oder Teilnehmendenverweise. Er isoliert die passende Person, ihren Anfrage- und Terminkandidatenkontext sowie passende "
|
||||||
|
"Benachrichtigungshüllen. Nicht exportiert werden Poll- oder Einladungskennungen, Zustände des Teilnahme-Gateways, "
|
||||||
|
"wiederverwendbare Einschreibelinks oder Nachweishashes, Hashes anonymer Passwörter, Calendar-Ereignis- oder Haltekennungen, "
|
||||||
|
"Details zu Frei-/Belegt-Konflikten, Benachrichtigungsnutzdaten oder -fehler, Tokenmaterial, undurchsichtige Metadaten oder "
|
||||||
|
"andere Teilnehmende. Poll bleibt maßgeblich für tatsächliche Verfügbarkeitsangaben und Nachweise zur Beendigung von Antworten; "
|
||||||
|
"Calendar bleibt maßgeblich für Ereignisse, Vormerkungen und Synchronisationszustände. Entschiedene, übergebene, abgesagte, "
|
||||||
|
"archivierte, beantwortete, benachrichtigte oder entfernte Zustände werden mit Begründung aufbewahrt. Aktive gemeinsame "
|
||||||
|
"Terminplanungsinhalte erfordern eine koordinierte manuelle Prüfung. Der Provider darf nur Personen anonymisieren und "
|
||||||
|
"ausmustern, zu denen keine Einladung, Antwort, Einschreibung, Benachrichtigung oder abschließende Entscheidung vorliegt, "
|
||||||
|
"und prüft alle Bedingungen unter mandantengebundenen Zeilensperren erneut."
|
||||||
|
),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
metadata={
|
||||||
|
"kind": "workflow",
|
||||||
|
"route": "/admin?section=tenant-data-subject-requests",
|
||||||
|
"screen": "Data-subject requests",
|
||||||
|
"help_contexts": ["admin.privacy.data-subject-requests"],
|
||||||
|
"prerequisites": [
|
||||||
|
"The privacy request and Scheduling selectors have been independently authorized and corroborated.",
|
||||||
|
"The reviewer can coordinate with Poll and Calendar owners when a response or event is involved.",
|
||||||
|
],
|
||||||
|
"steps": [
|
||||||
|
"Run the Scheduling provider search and review participant, request, slot, and notification dispositions.",
|
||||||
|
"Run the Poll provider for actual availability choices and the Calendar provider for event or hold state.",
|
||||||
|
"Retain terminal decision and delivery evidence with its reason.",
|
||||||
|
"Execute anonymization only for an approved participant classified as unengaged after revalidation.",
|
||||||
|
],
|
||||||
|
"limitations": [
|
||||||
|
"Poll choices and invitation evidence are not copied into Scheduling's export.",
|
||||||
|
"Participant erasure remains manual whenever shared responses, delivery, self-enrollment, Calendar effects, or terminal decisions exist.",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
DocumentationTopic(
|
||||||
|
id="scheduling.find-and-decide-meeting-time",
|
||||||
|
title="Find and decide a meeting time",
|
||||||
|
summary="Create candidate slots, invite internal or external participants, compare availability, and turn the selected slot into a calendar event when Calendar is available.",
|
||||||
|
body=(
|
||||||
|
"Scheduling records participant requirements, quorum and weighting constraints, response deadlines, reminders, and yes/no/maybe availability through Poll. "
|
||||||
|
"Calendar-aware organizers can inspect conflicts and create tentative holds before deciding. After a decision, Scheduling releases unused holds, creates or links the final event, and records notification handoff state. "
|
||||||
|
"Signed external links expose only the bounded request information allowed by the request's participation and privacy policy. Their governed Poll invitation resolves the tenant before Scheduling runs, so tenant module policy can withdraw public participation without weakening token validation."
|
||||||
|
),
|
||||||
|
layer="configured",
|
||||||
|
documentation_types=("user",),
|
||||||
|
audience=("user", "organizer", "participant"),
|
||||||
|
conditions=(
|
||||||
|
DocumentationCondition(
|
||||||
|
any_scopes=(READ_SCOPE, WRITE_SCOPE, ADMIN_SCOPE, RESPOND_SCOPE),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
related_modules=("poll", "calendar", "notifications", "mail"),
|
||||||
|
translations={
|
||||||
|
"de": {
|
||||||
|
"title": "Termin finden und entscheiden",
|
||||||
|
"summary": (
|
||||||
|
"Terminkandidaten anlegen, interne oder externe Personen einladen, Verfügbarkeiten vergleichen und den gewählten Termin "
|
||||||
|
"bei verfügbarem Calendar in ein Kalenderereignis überführen."
|
||||||
|
),
|
||||||
|
"body": (
|
||||||
|
"Scheduling erfasst Anforderungen an Teilnehmende, Quorum- und Gewichtungsregeln, Antwortfristen, Erinnerungen und "
|
||||||
|
"Ja-/Nein-/Vielleicht-Verfügbarkeiten über Poll. Organisierende mit Calendar-Anbindung können vor der Entscheidung Konflikte "
|
||||||
|
"prüfen und vorläufige Vormerkungen anlegen. Nach der Entscheidung gibt Scheduling nicht verwendete Vormerkungen frei, "
|
||||||
|
"legt das endgültige Ereignis an oder verknüpft es und zeichnet die Übergabe an Notifications auf. Signierte externe Links "
|
||||||
|
"zeigen nur die begrenzten Anfrageinformationen, welche die Teilnahme- und Datenschutzrichtlinie der Anfrage erlaubt. Die "
|
||||||
|
"gesteuerte Poll-Einladung löst den Mandanten auf, bevor Scheduling ausgeführt wird. Dadurch kann die Mandanten-Modulrichtlinie "
|
||||||
|
"die öffentliche Teilnahme zurückziehen, ohne die Tokenprüfung abzuschwächen."
|
||||||
|
),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
metadata={
|
||||||
|
"kind": "workflow",
|
||||||
|
"route": "/scheduling",
|
||||||
|
"screen": "Scheduling",
|
||||||
|
"help_contexts": [
|
||||||
|
"scheduling.list",
|
||||||
|
"scheduling.request",
|
||||||
|
"scheduling.editor",
|
||||||
|
"scheduling.public-participation",
|
||||||
|
],
|
||||||
|
"steps": [
|
||||||
|
"Prepare candidate times and participation controls.",
|
||||||
|
"Collect and review availability.",
|
||||||
|
"Close the poll and confirm the selected time.",
|
||||||
|
"Hand the decision to Calendar when configured.",
|
||||||
|
],
|
||||||
|
"outcome": "A recorded scheduling decision with bounded participation and optional Calendar handoff.",
|
||||||
|
"verification": "The request detail shows the decided slot, lifecycle state, participant aggregate, and any Calendar event reference.",
|
||||||
|
},
|
||||||
|
),
|
||||||
|
DocumentationTopic(
|
||||||
|
id="scheduling.calendar-coordination",
|
||||||
|
title="Configure scheduling calendar coordination",
|
||||||
|
summary="Understand the Calendar capability and permissions required for conflict checks, tentative holds, and final event handoff.",
|
||||||
|
body=(
|
||||||
|
"Calendar coordination remains optional. It is available only when Calendar contributes its picker capability and the actor can read calendars and availability and write events. "
|
||||||
|
"A disabled Calendar control therefore names the missing integration or authority instead of silently accepting a configuration that cannot run. "
|
||||||
|
"At decision time, a selected tentative hold is promoted in place while every unused hold is submitted to Calendar for durable release. Cancellation likewise waits until Calendar accepts every release. "
|
||||||
|
"Partial or unavailable Calendar effects keep the Scheduling lifecycle incomplete and expose retry-required cleanup state; an exact retry reuses the recorded event and operation identities instead of duplicating effects. "
|
||||||
|
"Administrators recover synchronized failures through Calendar's outbound-change reconciliation and then repeat the Scheduling action. Scheduling stores only operation identifiers, last-known state, and pending slot references; Calendar remains authoritative for event and outbox evidence. "
|
||||||
|
"Administrators should enable the Calendar module and grant the bounded calendar, availability, and event permissions needed by the organizer; Scheduling never imports Calendar internals."
|
||||||
|
),
|
||||||
|
layer="configured",
|
||||||
|
documentation_types=("admin", "user"),
|
||||||
|
audience=("organizer", "module_admin", "tenant_admin"),
|
||||||
|
related_modules=("calendar", "access", "policy"),
|
||||||
|
translations={
|
||||||
|
"de": {
|
||||||
|
"title": "Calendar-Koordination für Scheduling konfigurieren",
|
||||||
|
"summary": (
|
||||||
|
"Die Calendar-Fähigkeit und Berechtigungen für Konfliktprüfungen, vorläufige Vormerkungen und die endgültige "
|
||||||
|
"Ereignisübergabe verstehen."
|
||||||
|
),
|
||||||
|
"body": (
|
||||||
|
"Die Calendar-Koordination bleibt optional. Sie ist nur verfügbar, wenn Calendar seine Auswahlfähigkeit bereitstellt und "
|
||||||
|
"die handelnde Person Kalender und Verfügbarkeiten lesen sowie Ereignisse schreiben darf. Eine deaktivierte Calendar-Steuerung "
|
||||||
|
"nennt daher die fehlende Integration oder Berechtigung, statt eine nicht ausführbare Konfiguration stillschweigend zu "
|
||||||
|
"akzeptieren. Bei der Entscheidung wird eine ausgewählte vorläufige Vormerkung direkt bestätigt und jede ungenutzte "
|
||||||
|
"Vormerkung zur dauerhaften Freigabe an Calendar übergeben. Auch eine Absage wartet, bis Calendar jede Freigabe angenommen hat. "
|
||||||
|
"Teilweise oder nicht verfügbare Calendar-Wirkungen halten den Scheduling-Lebenszyklus unvollständig und zeigen einen "
|
||||||
|
"bereinigungsbedürftigen Wiederholungszustand; eine identische Wiederholung verwendet die aufgezeichneten Ereignis- und "
|
||||||
|
"Vorgangskennungen wieder, statt Wirkungen zu duplizieren. Administrierende beheben synchronisierte Fehler über Calendars "
|
||||||
|
"Abgleich ausgehender Änderungen und wiederholen anschließend die Scheduling-Aktion. Scheduling speichert nur "
|
||||||
|
"Vorgangskennungen, zuletzt bekannten Zustand und Verweise auf ausstehende Termine; Calendar bleibt maßgeblich für Ereignis- "
|
||||||
|
"und Outbox-Nachweise. Administrierende sollten Calendar aktivieren und der organisierenden Person die begrenzten Kalender-, "
|
||||||
|
"Verfügbarkeits- und Ereignisberechtigungen gewähren; Scheduling importiert keine Calendar-Interna."
|
||||||
|
),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
metadata={
|
||||||
|
"kind": "reference",
|
||||||
|
"help_contexts": [
|
||||||
|
"scheduling.calendar-integration",
|
||||||
|
"scheduling.calendar-coordination",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
DocumentationTopic(
|
||||||
|
id="scheduling.participation-governance",
|
||||||
|
title="Govern public scheduling participation",
|
||||||
|
summary="Resolve disabled guest invitations without weakening signed-link privacy or participation policy.",
|
||||||
|
body=(
|
||||||
|
"Public invitation links are issued only when the configured response, privacy, password, email, and update controls can be enforced by the public participation gateway. "
|
||||||
|
"When enforcement is unavailable, signed-in participants may continue to respond through their assigned request, but the system does not issue a weaker guest link. "
|
||||||
|
"A system or tenant administrator must restore the governed Poll/public-participation capability or keep the request limited to signed-in participation."
|
||||||
|
),
|
||||||
|
layer="configured",
|
||||||
|
documentation_types=("admin",),
|
||||||
|
audience=("operator", "module_admin", "tenant_admin"),
|
||||||
|
related_modules=("poll", "policy", "access"),
|
||||||
|
translations={
|
||||||
|
"de": {
|
||||||
|
"title": "Öffentliche Teilnahme an Terminplanungen steuern",
|
||||||
|
"summary": (
|
||||||
|
"Deaktivierte Gasteinladungen behandeln, ohne Datenschutz signierter Links oder Teilnahmerichtlinien abzuschwächen."
|
||||||
|
),
|
||||||
|
"body": (
|
||||||
|
"Öffentliche Einladungslinks werden nur ausgestellt, wenn das Gateway für öffentliche Teilnahme die konfigurierten "
|
||||||
|
"Antwort-, Datenschutz-, Passwort-, E-Mail- und Änderungsregeln durchsetzen kann. Ist diese Durchsetzung nicht verfügbar, "
|
||||||
|
"dürfen angemeldete Teilnehmende weiterhin über ihre zugewiesene Anfrage antworten; das System stellt jedoch keinen "
|
||||||
|
"schwächeren Gastlink aus. Eine System- oder Mandantenadministration muss die gesteuerte Poll-/Teilnahmefähigkeit "
|
||||||
|
"wiederherstellen oder die Anfrage auf angemeldete Teilnahme beschränken."
|
||||||
|
),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
metadata={
|
||||||
|
"kind": "pattern",
|
||||||
|
"help_contexts": [
|
||||||
|
"scheduling.public-participation-blocker",
|
||||||
|
"scheduling.public-participation",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
DocumentationTopic(
|
||||||
|
id="scheduling.public-self-enrollment",
|
||||||
|
title="Use governed public self-enrollment links",
|
||||||
|
summary="Issue reusable scheduling links with explicit capacity, expiry, identity, account-binding, and abuse controls.",
|
||||||
|
body=(
|
||||||
|
"A public self-enrollment link is distinct from a participant-specific invitation. "
|
||||||
|
"Organizers must choose a capacity and future expiry, and can independently allow anonymous and signed-in enrollment. "
|
||||||
|
"Every participant supplies a display name; email is required only when the request policy says so. Anonymous participants create and retain a separate recovery proof, which is submitted in the request body and is never embedded in the link, logs, analytics, or durable clear text. "
|
||||||
|
"Signed-in participants must explicitly confirm account binding. A later signed-in submission may bind an anonymous enrollment only when its recovery proof is supplied; the binding is audited. "
|
||||||
|
"Deployment policy can disable self-enrollment or cap its maximum capacity. Redis provides shared fixed-window throttling when configured, while development uses the bounded single-node fallback. Existing personalized invitation links are unchanged. "
|
||||||
|
"Revoking or expiring the reusable link prevents new access immediately. Capacity is serialized with participant creation, retries are idempotent through the caller's idempotency key, and existing proof holders can update only while request policy permits updates. Other participants receive only the request's existing aggregate or governed roster projection."
|
||||||
|
),
|
||||||
|
layer="configured",
|
||||||
|
documentation_types=("admin", "user"),
|
||||||
|
audience=("organizer", "participant", "module_admin", "tenant_admin"),
|
||||||
|
conditions=(
|
||||||
|
DocumentationCondition(
|
||||||
|
any_scopes=(WRITE_SCOPE, ADMIN_SCOPE, RESPOND_SCOPE),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
related_modules=("poll", "access", "policy"),
|
||||||
|
translations={
|
||||||
|
"de": {
|
||||||
|
"title": "Gesteuerte öffentliche Selbsteinschreibelinks verwenden",
|
||||||
|
"summary": (
|
||||||
|
"Wiederverwendbare Terminplanungslinks mit ausdrücklicher Kapazität, Laufzeit, Identitäts-, Kontobindungs- und "
|
||||||
|
"Missbrauchsschutzsteuerung ausstellen."
|
||||||
|
),
|
||||||
|
"body": (
|
||||||
|
"Ein öffentlicher Selbsteinschreibelink unterscheidet sich von einer personenspezifischen Einladung. Organisierende müssen "
|
||||||
|
"Kapazität und zukünftigen Ablauf festlegen und können anonyme sowie angemeldete Einschreibung unabhängig zulassen. Alle "
|
||||||
|
"Teilnehmenden geben einen Anzeigenamen an; eine E-Mail-Adresse ist nur erforderlich, wenn die Anfragerichtlinie dies verlangt. "
|
||||||
|
"Anonyme Teilnehmende erzeugen und verwahren einen getrennten Wiederherstellungsnachweis. Dieser wird im Anfragekörper "
|
||||||
|
"übermittelt und niemals in Link, Protokollen, Analysen oder dauerhaftem Klartext abgelegt. Angemeldete Teilnehmende müssen "
|
||||||
|
"die Kontobindung ausdrücklich bestätigen. Eine spätere angemeldete Einreichung darf eine anonyme Einschreibung nur mit "
|
||||||
|
"deren Wiederherstellungsnachweis binden; die Bindung wird auditiert. Die Deployment-Richtlinie kann Selbsteinschreibung "
|
||||||
|
"deaktivieren oder die maximale Kapazität begrenzen. Redis stellt bei Konfiguration eine gemeinsame Drosselung mit festem "
|
||||||
|
"Zeitfenster bereit; in der Entwicklung gilt der begrenzte Einzelknoten-Rückfall. Vorhandene persönliche Einladungslinks "
|
||||||
|
"bleiben unverändert. Widerruf oder Ablauf des wiederverwendbaren Links verhindert neuen Zugriff sofort. Die Kapazität wird "
|
||||||
|
"gemeinsam mit dem Anlegen der Person serialisiert, Wiederholungen sind über den Idempotenzschlüssel idempotent und bestehende "
|
||||||
|
"Nachweisinhaber dürfen nur ändern, solange die Anfragerichtlinie Änderungen erlaubt. Andere Teilnehmende erhalten nur die "
|
||||||
|
"bereits vorhandene Aggregat- oder gesteuerte Teilnehmerlistenansicht der Anfrage."
|
||||||
|
),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
metadata={
|
||||||
|
"kind": "workflow",
|
||||||
|
"route": "/scheduling",
|
||||||
|
"help_contexts": [
|
||||||
|
"scheduling.public-self-enrollment",
|
||||||
|
"scheduling.public-self-enrollment-governance",
|
||||||
|
],
|
||||||
|
"steps": [
|
||||||
|
"Choose a bounded capacity, expiry, and permitted identity modes.",
|
||||||
|
"Copy the newly issued link; the raw credential is shown only once.",
|
||||||
|
"Monitor enrollment count and revoke the link when it is no longer needed.",
|
||||||
|
"Require recovery proof before updating or binding an anonymous response.",
|
||||||
|
],
|
||||||
|
"verification": "The link list shows status, expiry, capacity use, access modes, and revocation without redisplaying its credential.",
|
||||||
|
},
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _tenant_summary(session, tenant_id: str) -> dict[str, int]:
|
def _tenant_summary(session, tenant_id: str) -> dict[str, int]:
|
||||||
from govoplan_scheduling.backend.db.models import SchedulingCandidateSlot, SchedulingNotification, SchedulingParticipant, SchedulingRequest
|
from govoplan_scheduling.backend.db.models import (
|
||||||
|
SchedulingCandidateSlot,
|
||||||
|
SchedulingNotification,
|
||||||
|
SchedulingParticipant,
|
||||||
|
SchedulingPublicEnrollmentLink,
|
||||||
|
SchedulingRequest,
|
||||||
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"scheduling_requests": (
|
"scheduling_requests": (
|
||||||
session.query(SchedulingRequest)
|
session.query(SchedulingRequest)
|
||||||
.filter(SchedulingRequest.tenant_id == tenant_id, SchedulingRequest.deleted_at.is_(None))
|
.filter(
|
||||||
|
SchedulingRequest.tenant_id == tenant_id,
|
||||||
|
SchedulingRequest.deleted_at.is_(None),
|
||||||
|
)
|
||||||
.count()
|
.count()
|
||||||
),
|
),
|
||||||
"scheduling_candidate_slots": (
|
"scheduling_candidate_slots": (
|
||||||
session.query(SchedulingCandidateSlot)
|
session.query(SchedulingCandidateSlot)
|
||||||
.filter(SchedulingCandidateSlot.tenant_id == tenant_id, SchedulingCandidateSlot.deleted_at.is_(None))
|
.filter(
|
||||||
|
SchedulingCandidateSlot.tenant_id == tenant_id,
|
||||||
|
SchedulingCandidateSlot.deleted_at.is_(None),
|
||||||
|
)
|
||||||
.count()
|
.count()
|
||||||
),
|
),
|
||||||
"scheduling_participants": (
|
"scheduling_participants": (
|
||||||
session.query(SchedulingParticipant)
|
session.query(SchedulingParticipant)
|
||||||
.filter(SchedulingParticipant.tenant_id == tenant_id, SchedulingParticipant.deleted_at.is_(None))
|
.filter(
|
||||||
|
SchedulingParticipant.tenant_id == tenant_id,
|
||||||
|
SchedulingParticipant.deleted_at.is_(None),
|
||||||
|
)
|
||||||
.count()
|
.count()
|
||||||
),
|
),
|
||||||
"scheduling_notifications": (
|
"scheduling_notifications": (
|
||||||
session.query(SchedulingNotification)
|
session.query(SchedulingNotification)
|
||||||
.filter(SchedulingNotification.tenant_id == tenant_id, SchedulingNotification.status == "pending")
|
.filter(
|
||||||
|
SchedulingNotification.tenant_id == tenant_id,
|
||||||
|
SchedulingNotification.status == "pending",
|
||||||
|
)
|
||||||
|
.count()
|
||||||
|
),
|
||||||
|
"scheduling_public_enrollment_links": (
|
||||||
|
session.query(SchedulingPublicEnrollmentLink)
|
||||||
|
.filter(
|
||||||
|
SchedulingPublicEnrollmentLink.tenant_id == tenant_id,
|
||||||
|
SchedulingPublicEnrollmentLink.revoked_at.is_(None),
|
||||||
|
)
|
||||||
.count()
|
.count()
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
@@ -131,12 +500,95 @@ def _scheduling_router(context: ModuleContext):
|
|||||||
return router
|
return router
|
||||||
|
|
||||||
|
|
||||||
|
def _scheduling_dsar_provider(context: ModuleContext) -> object:
|
||||||
|
del context
|
||||||
|
from govoplan_scheduling.backend.dsar_provider import SchedulingDsarProvider
|
||||||
|
|
||||||
|
return SchedulingDsarProvider()
|
||||||
|
|
||||||
|
|
||||||
|
def _public_tenant_resolver(request: object, session: object) -> str | None:
|
||||||
|
path_params = getattr(request, "path_params", {})
|
||||||
|
request_id = str(path_params.get("request_id") or "").strip()
|
||||||
|
token = str(path_params.get("token") or "").strip()
|
||||||
|
path = str(getattr(getattr(request, "url", None), "path", ""))
|
||||||
|
if not request_id or not token:
|
||||||
|
return None
|
||||||
|
|
||||||
|
from govoplan_scheduling.backend.db.models import (
|
||||||
|
SchedulingPublicEnrollmentLink,
|
||||||
|
SchedulingRequest,
|
||||||
|
)
|
||||||
|
from govoplan_scheduling.backend.security import public_credential_hash
|
||||||
|
from govoplan_core.db.base import utcnow
|
||||||
|
|
||||||
|
if "/scheduling/public-enrollment/" in path:
|
||||||
|
link = (
|
||||||
|
session.query(SchedulingPublicEnrollmentLink)
|
||||||
|
.filter(
|
||||||
|
SchedulingPublicEnrollmentLink.request_id == request_id,
|
||||||
|
SchedulingPublicEnrollmentLink.token_hash
|
||||||
|
== public_credential_hash(token),
|
||||||
|
SchedulingPublicEnrollmentLink.revoked_at.is_(None),
|
||||||
|
SchedulingPublicEnrollmentLink.expires_at > utcnow(),
|
||||||
|
)
|
||||||
|
.one_or_none()
|
||||||
|
)
|
||||||
|
return link.tenant_id if link is not None else None
|
||||||
|
if "/scheduling/public/" not in path:
|
||||||
|
return None
|
||||||
|
|
||||||
|
app = getattr(request, "app", None)
|
||||||
|
registry = getattr(getattr(app, "state", None), "govoplan_registry", None)
|
||||||
|
provider = poll_participation_gateway_provider(registry)
|
||||||
|
if provider is None:
|
||||||
|
return None
|
||||||
|
gateway = PollResponseGatewayRef(
|
||||||
|
module_id=MODULE_ID,
|
||||||
|
resource_type="scheduling_request",
|
||||||
|
resource_id=request_id,
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
invitation = provider.resolve_public_invitation(
|
||||||
|
session,
|
||||||
|
token=token,
|
||||||
|
gateway=gateway,
|
||||||
|
)
|
||||||
|
except PollCapabilityError:
|
||||||
|
return None
|
||||||
|
scheduling_request = (
|
||||||
|
session.query(SchedulingRequest)
|
||||||
|
.filter(
|
||||||
|
SchedulingRequest.id == request_id,
|
||||||
|
SchedulingRequest.tenant_id == invitation.tenant_id,
|
||||||
|
SchedulingRequest.poll_id == invitation.poll_id,
|
||||||
|
SchedulingRequest.deleted_at.is_(None),
|
||||||
|
)
|
||||||
|
.one_or_none()
|
||||||
|
)
|
||||||
|
return scheduling_request.tenant_id if scheduling_request is not None else None
|
||||||
|
|
||||||
|
|
||||||
manifest = ModuleManifest(
|
manifest = ModuleManifest(
|
||||||
id=MODULE_ID,
|
id=MODULE_ID,
|
||||||
name=MODULE_NAME,
|
name=MODULE_NAME,
|
||||||
version=MODULE_VERSION,
|
version=MODULE_VERSION,
|
||||||
dependencies=("poll",),
|
dependencies=("poll",),
|
||||||
optional_dependencies=("access", "calendar", "appointments", "evaluation", "mail", "notifications", "policy", "portal", "workflow", "tasks", "idm", "organizations", "addresses"),
|
optional_dependencies=(
|
||||||
|
"access",
|
||||||
|
"calendar",
|
||||||
|
"appointments",
|
||||||
|
"evaluation",
|
||||||
|
"mail",
|
||||||
|
"notifications",
|
||||||
|
"policy",
|
||||||
|
"portal",
|
||||||
|
"workflow_engine",
|
||||||
|
"tasks",
|
||||||
|
"idm",
|
||||||
|
"organizations",
|
||||||
|
"addresses",
|
||||||
|
),
|
||||||
optional_capabilities=(
|
optional_capabilities=(
|
||||||
CAPABILITY_AUTH_PRINCIPAL_RESOLVER,
|
CAPABILITY_AUTH_PRINCIPAL_RESOLVER,
|
||||||
CAPABILITY_AUTH_PERMISSION_EVALUATOR,
|
CAPABILITY_AUTH_PERMISSION_EVALUATOR,
|
||||||
@@ -150,37 +602,140 @@ manifest = ModuleManifest(
|
|||||||
CAPABILITY_POLL_PARTICIPATION_GATEWAY,
|
CAPABILITY_POLL_PARTICIPATION_GATEWAY,
|
||||||
),
|
),
|
||||||
provides_interfaces=(
|
provides_interfaces=(
|
||||||
ModuleInterfaceProvider(name="scheduling.candidate_slots", version=MODULE_VERSION),
|
ModuleInterfaceProvider(
|
||||||
ModuleInterfaceProvider(name="scheduling.decision_handoff", version=MODULE_VERSION),
|
name="scheduling.candidate_slots", version=MODULE_VERSION
|
||||||
|
),
|
||||||
|
ModuleInterfaceProvider(
|
||||||
|
name="scheduling.decision_handoff", version=MODULE_VERSION
|
||||||
|
),
|
||||||
|
ModuleInterfaceProvider(name=SCHEDULING_DSAR_CAPABILITY, version="0.1.0"),
|
||||||
),
|
),
|
||||||
requires_interfaces=(
|
requires_interfaces=(
|
||||||
ModuleInterfaceRequirement(name="poll.option_ordering", version_min="0.1.11", version_max_exclusive="0.2.0"),
|
ModuleInterfaceRequirement(
|
||||||
ModuleInterfaceRequirement(name="poll.availability_matrix", version_min="0.1.11", version_max_exclusive="0.2.0"),
|
name="poll.option_ordering",
|
||||||
ModuleInterfaceRequirement(name="poll.response_collection", version_min="0.1.11", version_max_exclusive="0.2.0"),
|
version_min="0.1.11",
|
||||||
ModuleInterfaceRequirement(name="poll.workflow_context", version_min="0.1.11", version_max_exclusive="0.2.0"),
|
version_max_exclusive="0.2.0",
|
||||||
ModuleInterfaceRequirement(name="poll.governed_participation", version_min="0.1.11", version_max_exclusive="0.2.0"),
|
),
|
||||||
ModuleInterfaceRequirement(name="evaluation.feedback", version_min="0.1.8", version_max_exclusive="0.2.0", optional=True),
|
ModuleInterfaceRequirement(
|
||||||
ModuleInterfaceRequirement(name="notifications.dispatch", version_min="0.1.8", version_max_exclusive="0.2.0", optional=True),
|
name="poll.availability_matrix",
|
||||||
ModuleInterfaceRequirement(name=CAPABILITY_ACCESS_PEOPLE_SEARCH, version_min="0.1.0", version_max_exclusive="0.2.0", optional=True),
|
version_min="0.1.11",
|
||||||
ModuleInterfaceRequirement(name=CAPABILITY_ADDRESSES_PEOPLE_SEARCH, version_min="0.1.0", version_max_exclusive="0.2.0", optional=True),
|
version_max_exclusive="0.2.0",
|
||||||
ModuleInterfaceRequirement(name="calendar.scheduling", version_min="0.1.8", version_max_exclusive="0.2.0", optional=True),
|
),
|
||||||
|
ModuleInterfaceRequirement(
|
||||||
|
name="poll.response_collection",
|
||||||
|
version_min="0.1.11",
|
||||||
|
version_max_exclusive="0.2.0",
|
||||||
|
),
|
||||||
|
ModuleInterfaceRequirement(
|
||||||
|
name="poll.workflow_context",
|
||||||
|
version_min="0.1.11",
|
||||||
|
version_max_exclusive="0.2.0",
|
||||||
|
),
|
||||||
|
ModuleInterfaceRequirement(
|
||||||
|
name="poll.governed_participation",
|
||||||
|
version_min="0.1.11",
|
||||||
|
version_max_exclusive="0.2.0",
|
||||||
|
),
|
||||||
|
ModuleInterfaceRequirement(
|
||||||
|
name="evaluation.feedback",
|
||||||
|
version_min="0.1.8",
|
||||||
|
version_max_exclusive="0.2.0",
|
||||||
|
optional=True,
|
||||||
|
),
|
||||||
|
ModuleInterfaceRequirement(
|
||||||
|
name="notifications.dispatch",
|
||||||
|
version_min="0.1.8",
|
||||||
|
version_max_exclusive="0.2.0",
|
||||||
|
optional=True,
|
||||||
|
),
|
||||||
|
ModuleInterfaceRequirement(
|
||||||
|
name=CAPABILITY_ACCESS_PEOPLE_SEARCH,
|
||||||
|
version_min="0.1.0",
|
||||||
|
version_max_exclusive="0.2.0",
|
||||||
|
optional=True,
|
||||||
|
),
|
||||||
|
ModuleInterfaceRequirement(
|
||||||
|
name=CAPABILITY_ADDRESSES_PEOPLE_SEARCH,
|
||||||
|
version_min="0.1.0",
|
||||||
|
version_max_exclusive="0.2.0",
|
||||||
|
optional=True,
|
||||||
|
),
|
||||||
|
ModuleInterfaceRequirement(
|
||||||
|
name="calendar.scheduling",
|
||||||
|
version_min="0.1.9",
|
||||||
|
version_max_exclusive="0.2.0",
|
||||||
|
optional=True,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
permissions=PERMISSIONS,
|
permissions=PERMISSIONS,
|
||||||
role_templates=ROLE_TEMPLATES,
|
role_templates=ROLE_TEMPLATES,
|
||||||
nav_items=(NavItem(path="/scheduling", label="Scheduling", icon="calendar-clock", required_any=(READ_SCOPE,), order=56),),
|
nav_items=(
|
||||||
|
NavItem(
|
||||||
|
path="/scheduling",
|
||||||
|
label="Scheduling",
|
||||||
|
icon="calendar-clock",
|
||||||
|
required_any=(READ_SCOPE,),
|
||||||
|
order=56,
|
||||||
|
),
|
||||||
|
),
|
||||||
frontend=FrontendModule(
|
frontend=FrontendModule(
|
||||||
module_id=MODULE_ID,
|
module_id=MODULE_ID,
|
||||||
package_name="@govoplan/scheduling-webui",
|
package_name="@govoplan/scheduling-webui",
|
||||||
|
routes=(
|
||||||
|
FrontendRoute(
|
||||||
|
path="/scheduling",
|
||||||
|
component="SchedulingPage",
|
||||||
|
required_any=(READ_SCOPE,),
|
||||||
|
order=56,
|
||||||
|
),
|
||||||
|
),
|
||||||
public_routes=(
|
public_routes=(
|
||||||
PublicFrontendRoute(
|
PublicFrontendRoute(
|
||||||
path="/scheduling/public/:requestId/:token",
|
path="/scheduling/public/:requestId/:token",
|
||||||
component="SchedulingPublicPage",
|
component="SchedulingPublicPage",
|
||||||
order=10,
|
order=10,
|
||||||
),
|
),
|
||||||
|
PublicFrontendRoute(
|
||||||
|
path="/scheduling/enrol/:requestId/:token",
|
||||||
|
component="SchedulingEnrollmentPage",
|
||||||
|
order=11,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
nav_items=(
|
||||||
|
NavItem(
|
||||||
|
path="/scheduling",
|
||||||
|
label="Scheduling",
|
||||||
|
icon="calendar-clock",
|
||||||
|
required_any=(READ_SCOPE,),
|
||||||
|
order=56,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
product_areas=(
|
||||||
|
ProductAreaContribution(
|
||||||
|
id="meetings-decisions",
|
||||||
|
module_id=MODULE_ID,
|
||||||
|
label="i18n:govoplan-core.product_area.meetings_decisions",
|
||||||
|
icon="calendar",
|
||||||
|
description="i18n:govoplan-core.product_area.meetings_decisions_description",
|
||||||
|
surface_ids=(
|
||||||
|
"scheduling.nav.scheduling",
|
||||||
|
"scheduling.route.scheduling",
|
||||||
|
),
|
||||||
|
order=50,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
view_surfaces=(
|
||||||
|
ViewSurface(
|
||||||
|
id="scheduling.widget.open-requests",
|
||||||
|
module_id=MODULE_ID,
|
||||||
|
kind="section",
|
||||||
|
label="Scheduling requests widget",
|
||||||
|
order=45,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
nav_items=(NavItem(path="/scheduling", label="Scheduling", icon="calendar-clock", required_any=(READ_SCOPE,), order=56),),
|
|
||||||
),
|
),
|
||||||
route_factory=_scheduling_router,
|
route_factory=_scheduling_router,
|
||||||
|
public_tenant_resolver=_public_tenant_resolver,
|
||||||
tenant_summary_providers=(_tenant_summary,),
|
tenant_summary_providers=(_tenant_summary,),
|
||||||
migration_spec=MigrationSpec(
|
migration_spec=MigrationSpec(
|
||||||
module_id=MODULE_ID,
|
module_id=MODULE_ID,
|
||||||
@@ -191,6 +746,7 @@ manifest = ModuleManifest(
|
|||||||
scheduling_models.SchedulingRequest,
|
scheduling_models.SchedulingRequest,
|
||||||
scheduling_models.SchedulingCandidateSlot,
|
scheduling_models.SchedulingCandidateSlot,
|
||||||
scheduling_models.SchedulingParticipant,
|
scheduling_models.SchedulingParticipant,
|
||||||
|
scheduling_models.SchedulingPublicEnrollmentLink,
|
||||||
scheduling_models.SchedulingNotification,
|
scheduling_models.SchedulingNotification,
|
||||||
label="Scheduling",
|
label="Scheduling",
|
||||||
),
|
),
|
||||||
@@ -201,11 +757,53 @@ manifest = ModuleManifest(
|
|||||||
scheduling_models.SchedulingRequest,
|
scheduling_models.SchedulingRequest,
|
||||||
scheduling_models.SchedulingCandidateSlot,
|
scheduling_models.SchedulingCandidateSlot,
|
||||||
scheduling_models.SchedulingParticipant,
|
scheduling_models.SchedulingParticipant,
|
||||||
|
scheduling_models.SchedulingPublicEnrollmentLink,
|
||||||
scheduling_models.SchedulingNotification,
|
scheduling_models.SchedulingNotification,
|
||||||
label="Scheduling",
|
label="Scheduling",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
documentation=DOCUMENTATION,
|
documentation=DOCUMENTATION,
|
||||||
|
capability_factories={
|
||||||
|
SCHEDULING_DSAR_CAPABILITY: _scheduling_dsar_provider,
|
||||||
|
},
|
||||||
|
capability_documentation={
|
||||||
|
SCHEDULING_DSAR_CAPABILITY: CapabilityDocumentation(
|
||||||
|
label="Scheduling data-subject request provider",
|
||||||
|
summary="Finds isolated Scheduling participation and coordination metadata and classifies governed erasure actions.",
|
||||||
|
contract_version="0.1.0",
|
||||||
|
documentation_types=("admin",),
|
||||||
|
audience=("privacy_officer", "scheduling_manager", "records_manager"),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
architecture=declared_module_architecture(
|
||||||
|
layer="communication_participation",
|
||||||
|
kind="domain",
|
||||||
|
maturity="vertical_slice",
|
||||||
|
documentation_ref="README.md",
|
||||||
|
test_ref="tests/test_service.py",
|
||||||
|
known_limits=(
|
||||||
|
"Reference deployment notification delivery and every calendar-provider constraint remain incomplete.",
|
||||||
|
),
|
||||||
|
owned_concepts=(
|
||||||
|
"scheduling request",
|
||||||
|
"candidate slot",
|
||||||
|
"scheduling participant",
|
||||||
|
"public self-enrollment link",
|
||||||
|
"scheduling decision",
|
||||||
|
),
|
||||||
|
non_owned_concepts=(
|
||||||
|
"poll response primitive",
|
||||||
|
"calendar event",
|
||||||
|
"mail delivery",
|
||||||
|
),
|
||||||
|
recovery_docs=("README.md",),
|
||||||
|
security_docs=("README.md",),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
manifest = with_documentation_structured_translations(
|
||||||
|
manifest, locale="de", translations=GERMAN_STRUCTURED_TRANSLATIONS
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+134
@@ -0,0 +1,134 @@
|
|||||||
|
"""Governed public self-enrollment links.
|
||||||
|
|
||||||
|
Revision ID: d7a4c1e8f205
|
||||||
|
Revises: c9d4e7f1a2b3
|
||||||
|
Create Date: 2026-08-20 00:00:00.000000
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
revision = "d7a4c1e8f205"
|
||||||
|
down_revision = "c9d4e7f1a2b3"
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade() -> None:
|
||||||
|
inspector = sa.inspect(op.get_bind())
|
||||||
|
table_names = set(inspector.get_table_names())
|
||||||
|
if "scheduling_public_enrollment_links" not in table_names:
|
||||||
|
op.create_table(
|
||||||
|
"scheduling_public_enrollment_links",
|
||||||
|
sa.Column("id", sa.String(length=36), nullable=False),
|
||||||
|
sa.Column("tenant_id", sa.String(length=36), nullable=False),
|
||||||
|
sa.Column("request_id", sa.String(length=36), nullable=False),
|
||||||
|
sa.Column("token_hash", sa.String(length=64), nullable=False),
|
||||||
|
sa.Column("max_enrollments", sa.Integer(), nullable=False),
|
||||||
|
sa.Column("expires_at", sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column("allow_anonymous", sa.Boolean(), nullable=False),
|
||||||
|
sa.Column("allow_authenticated", sa.Boolean(), nullable=False),
|
||||||
|
sa.Column("created_by", sa.String(length=255), nullable=True),
|
||||||
|
sa.Column("revoked_at", sa.DateTime(timezone=True), nullable=True),
|
||||||
|
sa.Column("metadata", sa.JSON(), nullable=True),
|
||||||
|
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(
|
||||||
|
["request_id"],
|
||||||
|
["scheduling_requests.id"],
|
||||||
|
ondelete="CASCADE",
|
||||||
|
),
|
||||||
|
sa.PrimaryKeyConstraint("id"),
|
||||||
|
sa.UniqueConstraint(
|
||||||
|
"token_hash",
|
||||||
|
name="uq_scheduling_enrollment_link_token_hash",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
op.create_index(
|
||||||
|
"ix_scheduling_enrollment_links_request",
|
||||||
|
"scheduling_public_enrollment_links",
|
||||||
|
["tenant_id", "request_id"],
|
||||||
|
)
|
||||||
|
op.create_index(
|
||||||
|
"ix_scheduling_enrollment_links_expiry",
|
||||||
|
"scheduling_public_enrollment_links",
|
||||||
|
["tenant_id", "expires_at"],
|
||||||
|
)
|
||||||
|
for column in ("tenant_id", "request_id", "expires_at", "created_by", "revoked_at"):
|
||||||
|
op.create_index(
|
||||||
|
f"ix_scheduling_public_enrollment_links_{column}",
|
||||||
|
"scheduling_public_enrollment_links",
|
||||||
|
[column],
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
columns = {item["name"] for item in inspector.get_columns("scheduling_public_enrollment_links")}
|
||||||
|
expected = {
|
||||||
|
"id", "tenant_id", "request_id", "token_hash", "max_enrollments",
|
||||||
|
"expires_at", "allow_anonymous", "allow_authenticated", "created_by",
|
||||||
|
"revoked_at", "metadata", "created_at", "updated_at",
|
||||||
|
}
|
||||||
|
if columns != expected:
|
||||||
|
raise RuntimeError(
|
||||||
|
"Cannot adopt scheduling_public_enrollment_links because its schema is unexpected"
|
||||||
|
)
|
||||||
|
|
||||||
|
participant_columns = {
|
||||||
|
item["name"] for item in sa.inspect(op.get_bind()).get_columns("scheduling_participants")
|
||||||
|
}
|
||||||
|
additions = (
|
||||||
|
("self_enrollment_link_id", sa.String(length=36)),
|
||||||
|
("self_enrollment_proof_hash", sa.String(length=64)),
|
||||||
|
("bound_account_id", sa.String(length=255)),
|
||||||
|
("account_bound_at", sa.DateTime(timezone=True)),
|
||||||
|
)
|
||||||
|
present = {name for name, _type in additions if name in participant_columns}
|
||||||
|
if present and len(present) != len(additions):
|
||||||
|
raise RuntimeError(
|
||||||
|
"Cannot adopt partial scheduling participant self-enrollment columns"
|
||||||
|
)
|
||||||
|
if not present:
|
||||||
|
with op.batch_alter_table("scheduling_participants") as batch:
|
||||||
|
batch.add_column(
|
||||||
|
sa.Column("self_enrollment_link_id", sa.String(length=36), nullable=True)
|
||||||
|
)
|
||||||
|
batch.add_column(
|
||||||
|
sa.Column("self_enrollment_proof_hash", sa.String(length=64), nullable=True)
|
||||||
|
)
|
||||||
|
batch.add_column(
|
||||||
|
sa.Column("account_bound_at", sa.DateTime(timezone=True), nullable=True)
|
||||||
|
)
|
||||||
|
batch.add_column(
|
||||||
|
sa.Column("bound_account_id", sa.String(length=255), nullable=True)
|
||||||
|
)
|
||||||
|
batch.create_foreign_key(
|
||||||
|
"fk_scheduling_participants_enrollment_link",
|
||||||
|
"scheduling_public_enrollment_links",
|
||||||
|
["self_enrollment_link_id"],
|
||||||
|
["id"],
|
||||||
|
ondelete="SET NULL",
|
||||||
|
)
|
||||||
|
batch.create_index(
|
||||||
|
"ix_scheduling_participants_self_enrollment_link_id",
|
||||||
|
["self_enrollment_link_id"],
|
||||||
|
)
|
||||||
|
batch.create_index(
|
||||||
|
"ix_scheduling_participants_bound_account_id",
|
||||||
|
["bound_account_id"],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade() -> None:
|
||||||
|
with op.batch_alter_table("scheduling_participants") as batch:
|
||||||
|
batch.drop_index("ix_scheduling_participants_bound_account_id")
|
||||||
|
batch.drop_index("ix_scheduling_participants_self_enrollment_link_id")
|
||||||
|
batch.drop_constraint(
|
||||||
|
"fk_scheduling_participants_enrollment_link",
|
||||||
|
type_="foreignkey",
|
||||||
|
)
|
||||||
|
batch.drop_column("account_bound_at")
|
||||||
|
batch.drop_column("self_enrollment_proof_hash")
|
||||||
|
batch.drop_column("self_enrollment_link_id")
|
||||||
|
batch.drop_column("bound_account_id")
|
||||||
|
op.drop_table("scheduling_public_enrollment_links")
|
||||||
@@ -14,12 +14,17 @@ from govoplan_scheduling.backend.manifest import ADMIN_SCOPE, READ_SCOPE, RESPON
|
|||||||
from govoplan_scheduling.backend.schemas import (
|
from govoplan_scheduling.backend.schemas import (
|
||||||
SchedulingAvailabilityResponse,
|
SchedulingAvailabilityResponse,
|
||||||
SchedulingAvailabilityResponseRequest,
|
SchedulingAvailabilityResponseRequest,
|
||||||
|
SchedulingAuthenticatedEnrollmentSubmitRequest,
|
||||||
SchedulingCalendarActionResponse,
|
SchedulingCalendarActionResponse,
|
||||||
SchedulingCandidateSlotUpdateRequest,
|
SchedulingCandidateSlotUpdateRequest,
|
||||||
SchedulingDecisionRequest,
|
SchedulingDecisionRequest,
|
||||||
SchedulingInvitationActionRequest,
|
SchedulingInvitationActionRequest,
|
||||||
SchedulingInvitationActionResponse,
|
SchedulingInvitationActionResponse,
|
||||||
SchedulingInvitationRevokeRequest,
|
SchedulingInvitationRevokeRequest,
|
||||||
|
SchedulingEnrollmentLinkActionResponse,
|
||||||
|
SchedulingEnrollmentLinkCreateRequest,
|
||||||
|
SchedulingEnrollmentLinkListResponse,
|
||||||
|
SchedulingEnrollmentLinkResponse,
|
||||||
SchedulingNotificationCreateRequest,
|
SchedulingNotificationCreateRequest,
|
||||||
SchedulingNotificationListResponse,
|
SchedulingNotificationListResponse,
|
||||||
SchedulingNotificationResponse,
|
SchedulingNotificationResponse,
|
||||||
@@ -34,6 +39,9 @@ from govoplan_scheduling.backend.schemas import (
|
|||||||
SchedulingPublicParticipationAccessRequest,
|
SchedulingPublicParticipationAccessRequest,
|
||||||
SchedulingPublicParticipationResponse,
|
SchedulingPublicParticipationResponse,
|
||||||
SchedulingPublicParticipationSubmitRequest,
|
SchedulingPublicParticipationSubmitRequest,
|
||||||
|
SchedulingPublicEnrollmentAccessRequest,
|
||||||
|
SchedulingPublicEnrollmentResponse,
|
||||||
|
SchedulingPublicEnrollmentSubmitRequest,
|
||||||
SchedulingStatusResponse,
|
SchedulingStatusResponse,
|
||||||
SchedulingSummaryResponse,
|
SchedulingSummaryResponse,
|
||||||
)
|
)
|
||||||
@@ -47,6 +55,7 @@ from govoplan_scheduling.backend.service import (
|
|||||||
close_scheduling_request,
|
close_scheduling_request,
|
||||||
create_final_calendar_event,
|
create_final_calendar_event,
|
||||||
create_scheduling_notification_jobs,
|
create_scheduling_notification_jobs,
|
||||||
|
create_scheduling_enrollment_link,
|
||||||
create_scheduling_request,
|
create_scheduling_request,
|
||||||
create_tentative_calendar_holds,
|
create_tentative_calendar_holds,
|
||||||
decide_scheduling_request,
|
decide_scheduling_request,
|
||||||
@@ -54,19 +63,25 @@ from govoplan_scheduling.backend.service import (
|
|||||||
get_scheduling_request,
|
get_scheduling_request,
|
||||||
get_scheduling_availability_response,
|
get_scheduling_availability_response,
|
||||||
get_public_scheduling_participation,
|
get_public_scheduling_participation,
|
||||||
|
get_public_scheduling_enrollment,
|
||||||
get_visible_scheduling_request,
|
get_visible_scheduling_request,
|
||||||
list_visible_scheduling_notifications,
|
list_visible_scheduling_notifications,
|
||||||
list_visible_scheduling_requests,
|
list_visible_scheduling_requests,
|
||||||
|
list_scheduling_enrollment_links,
|
||||||
issue_scheduling_participant_invitation,
|
issue_scheduling_participant_invitation,
|
||||||
open_scheduling_request,
|
open_scheduling_request,
|
||||||
refresh_participant_response_state,
|
|
||||||
require_visible_scheduling_results,
|
require_visible_scheduling_results,
|
||||||
revoke_scheduling_participant_invitation,
|
revoke_scheduling_participant_invitation,
|
||||||
|
revoke_scheduling_enrollment_link,
|
||||||
|
response_datetime,
|
||||||
|
scheduling_enrollment_link_response,
|
||||||
scheduling_notification_response,
|
scheduling_notification_response,
|
||||||
scheduling_request_response,
|
scheduling_request_response,
|
||||||
scheduling_request_summary,
|
scheduling_request_summary,
|
||||||
submit_scheduling_availability,
|
submit_scheduling_availability,
|
||||||
submit_public_scheduling_participation,
|
submit_public_scheduling_participation,
|
||||||
|
submit_authenticated_scheduling_enrollment,
|
||||||
|
submit_public_scheduling_enrollment,
|
||||||
update_scheduling_candidate_slot,
|
update_scheduling_candidate_slot,
|
||||||
update_scheduling_request_with_change_log,
|
update_scheduling_request_with_change_log,
|
||||||
)
|
)
|
||||||
@@ -254,6 +269,107 @@ def api_submit_public_scheduling_participation(
|
|||||||
return validated
|
return validated
|
||||||
|
|
||||||
|
|
||||||
|
@router.post(
|
||||||
|
"/public-enrollment/{request_id}/{token}",
|
||||||
|
response_model=SchedulingPublicEnrollmentResponse,
|
||||||
|
)
|
||||||
|
def api_get_public_scheduling_enrollment(
|
||||||
|
request_id: str,
|
||||||
|
token: str,
|
||||||
|
payload: SchedulingPublicEnrollmentAccessRequest,
|
||||||
|
request: Request,
|
||||||
|
response: Response,
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
) -> SchedulingPublicEnrollmentResponse:
|
||||||
|
try:
|
||||||
|
result = get_public_scheduling_enrollment(
|
||||||
|
session,
|
||||||
|
request_id=request_id,
|
||||||
|
token=token,
|
||||||
|
payload=payload,
|
||||||
|
client_address=_client_address(request),
|
||||||
|
)
|
||||||
|
except SchedulingPublicParticipationError as exc:
|
||||||
|
raise _public_participation_http_error(exc) from exc
|
||||||
|
_set_sensitive_response_headers(response)
|
||||||
|
return SchedulingPublicEnrollmentResponse.model_validate(result)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post(
|
||||||
|
"/public-enrollment/{request_id}/{token}/responses",
|
||||||
|
response_model=SchedulingPublicEnrollmentResponse,
|
||||||
|
)
|
||||||
|
def api_submit_public_scheduling_enrollment(
|
||||||
|
request_id: str,
|
||||||
|
token: str,
|
||||||
|
payload: SchedulingPublicEnrollmentSubmitRequest,
|
||||||
|
request: Request,
|
||||||
|
response: Response,
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
) -> SchedulingPublicEnrollmentResponse:
|
||||||
|
try:
|
||||||
|
result = submit_public_scheduling_enrollment(
|
||||||
|
session,
|
||||||
|
request_id=request_id,
|
||||||
|
token=token,
|
||||||
|
payload=payload,
|
||||||
|
client_address=_client_address(request),
|
||||||
|
)
|
||||||
|
except SchedulingPublicParticipationError as exc:
|
||||||
|
raise _public_participation_http_error(exc) from exc
|
||||||
|
except SchedulingError as exc:
|
||||||
|
raise _scheduling_http_error(exc) from exc
|
||||||
|
validated = SchedulingPublicEnrollmentResponse.model_validate(result)
|
||||||
|
_set_sensitive_response_headers(response)
|
||||||
|
session.commit()
|
||||||
|
return validated
|
||||||
|
|
||||||
|
|
||||||
|
@router.post(
|
||||||
|
"/public-enrollment/{request_id}/{token}/authenticated-responses",
|
||||||
|
response_model=SchedulingPublicEnrollmentResponse,
|
||||||
|
)
|
||||||
|
def api_submit_authenticated_scheduling_enrollment(
|
||||||
|
request_id: str,
|
||||||
|
token: str,
|
||||||
|
payload: SchedulingAuthenticatedEnrollmentSubmitRequest,
|
||||||
|
request: Request,
|
||||||
|
response: Response,
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
principal: ApiPrincipal = Depends(get_api_principal),
|
||||||
|
) -> SchedulingPublicEnrollmentResponse:
|
||||||
|
_require_scope(principal, RESPOND_SCOPE)
|
||||||
|
try:
|
||||||
|
result = submit_authenticated_scheduling_enrollment(
|
||||||
|
session,
|
||||||
|
tenant_id=principal.tenant_id,
|
||||||
|
request_id=request_id,
|
||||||
|
token=token,
|
||||||
|
account_id=principal.account_id,
|
||||||
|
account_email=principal.email,
|
||||||
|
payload=payload,
|
||||||
|
client_address=_client_address(request),
|
||||||
|
)
|
||||||
|
except SchedulingPublicParticipationError as exc:
|
||||||
|
raise _public_participation_http_error(exc) from exc
|
||||||
|
except SchedulingError as exc:
|
||||||
|
raise _scheduling_http_error(exc) from exc
|
||||||
|
audit_event(
|
||||||
|
session,
|
||||||
|
tenant_id=principal.tenant_id,
|
||||||
|
user_id=(getattr(principal.user, "id", None) or principal.account_id),
|
||||||
|
api_key_id=principal.api_key_id,
|
||||||
|
action="scheduling.self_enrollment_account_bound",
|
||||||
|
object_type="scheduling_request",
|
||||||
|
object_id=request_id,
|
||||||
|
details={"link_id": result["link_id"]},
|
||||||
|
)
|
||||||
|
validated = SchedulingPublicEnrollmentResponse.model_validate(result)
|
||||||
|
_set_sensitive_response_headers(response)
|
||||||
|
session.commit()
|
||||||
|
return validated
|
||||||
|
|
||||||
|
|
||||||
@router.get("/people", response_model=SchedulingPeopleSearchResponse)
|
@router.get("/people", response_model=SchedulingPeopleSearchResponse)
|
||||||
def api_search_scheduling_people(
|
def api_search_scheduling_people(
|
||||||
query: str = Query(min_length=1),
|
query: str = Query(min_length=1),
|
||||||
@@ -297,6 +413,7 @@ def api_search_scheduling_people(
|
|||||||
@router.get("/requests", response_model=SchedulingRequestListResponse)
|
@router.get("/requests", response_model=SchedulingRequestListResponse)
|
||||||
def api_list_scheduling_requests(
|
def api_list_scheduling_requests(
|
||||||
status_filter: str | None = Query(default=None, alias="status"),
|
status_filter: str | None = Query(default=None, alias="status"),
|
||||||
|
limit: int = 100,
|
||||||
session: Session = Depends(get_session),
|
session: Session = Depends(get_session),
|
||||||
principal: ApiPrincipal = Depends(get_api_principal),
|
principal: ApiPrincipal = Depends(get_api_principal),
|
||||||
) -> SchedulingRequestListResponse:
|
) -> SchedulingRequestListResponse:
|
||||||
@@ -307,21 +424,11 @@ def api_list_scheduling_requests(
|
|||||||
actor_ids=_principal_actor_ids(principal),
|
actor_ids=_principal_actor_ids(principal),
|
||||||
can_manage=_can_manage_scheduling(principal),
|
can_manage=_can_manage_scheduling(principal),
|
||||||
status=status_filter,
|
status=status_filter,
|
||||||
|
limit=limit,
|
||||||
)
|
)
|
||||||
actor_ids = _principal_actor_ids(principal)
|
return SchedulingRequestListResponse(
|
||||||
for request in requests:
|
|
||||||
refresh_participant_response_state(
|
|
||||||
session,
|
|
||||||
request=request,
|
|
||||||
actor_ids=actor_ids,
|
|
||||||
)
|
|
||||||
response = SchedulingRequestListResponse(
|
|
||||||
requests=[_request_response(request, principal=principal) for request in requests]
|
requests=[_request_response(request, principal=principal) for request in requests]
|
||||||
)
|
)
|
||||||
# Poll responses are authoritative, while Scheduling keeps a durable
|
|
||||||
# participant projection used by its task-oriented list.
|
|
||||||
session.commit()
|
|
||||||
return response
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/requests", response_model=SchedulingRequestResponse, status_code=status.HTTP_201_CREATED)
|
@router.post("/requests", response_model=SchedulingRequestResponse, status_code=status.HTTP_201_CREATED)
|
||||||
@@ -407,16 +514,9 @@ def api_get_scheduling_request(
|
|||||||
actor_ids=_principal_actor_ids(principal),
|
actor_ids=_principal_actor_ids(principal),
|
||||||
can_manage=_can_manage_scheduling(principal),
|
can_manage=_can_manage_scheduling(principal),
|
||||||
)
|
)
|
||||||
refresh_participant_response_state(
|
|
||||||
session,
|
|
||||||
request=request,
|
|
||||||
actor_ids=_principal_actor_ids(principal),
|
|
||||||
)
|
|
||||||
except SchedulingError as exc:
|
except SchedulingError as exc:
|
||||||
raise _scheduling_http_error(exc) from exc
|
raise _scheduling_http_error(exc) from exc
|
||||||
response = _request_response(request, principal=principal)
|
return _request_response(request, principal=principal)
|
||||||
session.commit()
|
|
||||||
return response
|
|
||||||
|
|
||||||
|
|
||||||
@router.patch("/requests/{request_id}", response_model=SchedulingRequestResponse)
|
@router.patch("/requests/{request_id}", response_model=SchedulingRequestResponse)
|
||||||
@@ -460,6 +560,126 @@ def api_update_scheduling_request(
|
|||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/requests/{request_id}/enrollment-links",
|
||||||
|
response_model=SchedulingEnrollmentLinkListResponse,
|
||||||
|
)
|
||||||
|
def api_list_scheduling_enrollment_links(
|
||||||
|
request_id: str,
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
principal: ApiPrincipal = Depends(get_api_principal),
|
||||||
|
) -> SchedulingEnrollmentLinkListResponse:
|
||||||
|
_require_request_editor(session, principal=principal, request_id=request_id)
|
||||||
|
try:
|
||||||
|
links = list_scheduling_enrollment_links(
|
||||||
|
session,
|
||||||
|
tenant_id=principal.tenant_id,
|
||||||
|
request_id=request_id,
|
||||||
|
)
|
||||||
|
except SchedulingError as exc:
|
||||||
|
raise _scheduling_http_error(exc) from exc
|
||||||
|
return SchedulingEnrollmentLinkListResponse(
|
||||||
|
links=[
|
||||||
|
SchedulingEnrollmentLinkResponse.model_validate(
|
||||||
|
scheduling_enrollment_link_response(session, link)
|
||||||
|
)
|
||||||
|
for link in links
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post(
|
||||||
|
"/requests/{request_id}/enrollment-links",
|
||||||
|
response_model=SchedulingEnrollmentLinkActionResponse,
|
||||||
|
status_code=status.HTTP_201_CREATED,
|
||||||
|
)
|
||||||
|
def api_create_scheduling_enrollment_link(
|
||||||
|
request_id: str,
|
||||||
|
payload: SchedulingEnrollmentLinkCreateRequest,
|
||||||
|
response: Response,
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
principal: ApiPrincipal = Depends(get_api_principal),
|
||||||
|
) -> SchedulingEnrollmentLinkActionResponse:
|
||||||
|
_require_request_editor(session, principal=principal, request_id=request_id)
|
||||||
|
try:
|
||||||
|
link, token = create_scheduling_enrollment_link(
|
||||||
|
session,
|
||||||
|
tenant_id=principal.tenant_id,
|
||||||
|
request_id=request_id,
|
||||||
|
created_by=principal.account_id,
|
||||||
|
payload=payload,
|
||||||
|
)
|
||||||
|
except SchedulingError as exc:
|
||||||
|
raise _scheduling_http_error(exc) from exc
|
||||||
|
audit_event(
|
||||||
|
session,
|
||||||
|
tenant_id=principal.tenant_id,
|
||||||
|
user_id=(getattr(principal.user, "id", None) or principal.account_id),
|
||||||
|
api_key_id=principal.api_key_id,
|
||||||
|
action="scheduling.self_enrollment_link_issued",
|
||||||
|
object_type="scheduling_request",
|
||||||
|
object_id=request_id,
|
||||||
|
details={
|
||||||
|
"link_id": link.id,
|
||||||
|
"expires_at": response_datetime(link.expires_at).isoformat(),
|
||||||
|
"max_enrollments": link.max_enrollments,
|
||||||
|
"allow_anonymous": link.allow_anonymous,
|
||||||
|
"allow_authenticated": link.allow_authenticated,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
validated = SchedulingEnrollmentLinkActionResponse(
|
||||||
|
link=SchedulingEnrollmentLinkResponse.model_validate(
|
||||||
|
scheduling_enrollment_link_response(session, link)
|
||||||
|
),
|
||||||
|
action_url=f"/scheduling/enrol/{request_id}/{token}",
|
||||||
|
)
|
||||||
|
_set_sensitive_response_headers(response)
|
||||||
|
session.commit()
|
||||||
|
return validated
|
||||||
|
|
||||||
|
|
||||||
|
@router.delete(
|
||||||
|
"/requests/{request_id}/enrollment-links/{link_id}",
|
||||||
|
response_model=SchedulingEnrollmentLinkActionResponse,
|
||||||
|
)
|
||||||
|
def api_revoke_scheduling_enrollment_link(
|
||||||
|
request_id: str,
|
||||||
|
link_id: str,
|
||||||
|
response: Response,
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
principal: ApiPrincipal = Depends(get_api_principal),
|
||||||
|
) -> SchedulingEnrollmentLinkActionResponse:
|
||||||
|
_require_request_editor(session, principal=principal, request_id=request_id)
|
||||||
|
try:
|
||||||
|
link, replayed = revoke_scheduling_enrollment_link(
|
||||||
|
session,
|
||||||
|
tenant_id=principal.tenant_id,
|
||||||
|
request_id=request_id,
|
||||||
|
link_id=link_id,
|
||||||
|
)
|
||||||
|
except SchedulingError as exc:
|
||||||
|
raise _scheduling_http_error(exc) from exc
|
||||||
|
audit_event(
|
||||||
|
session,
|
||||||
|
tenant_id=principal.tenant_id,
|
||||||
|
user_id=(getattr(principal.user, "id", None) or principal.account_id),
|
||||||
|
api_key_id=principal.api_key_id,
|
||||||
|
action="scheduling.self_enrollment_link_revoked",
|
||||||
|
object_type="scheduling_request",
|
||||||
|
object_id=request_id,
|
||||||
|
details={"link_id": link.id, "replayed": replayed},
|
||||||
|
)
|
||||||
|
validated = SchedulingEnrollmentLinkActionResponse(
|
||||||
|
link=SchedulingEnrollmentLinkResponse.model_validate(
|
||||||
|
scheduling_enrollment_link_response(session, link)
|
||||||
|
),
|
||||||
|
replayed=replayed,
|
||||||
|
)
|
||||||
|
_set_sensitive_response_headers(response)
|
||||||
|
session.commit()
|
||||||
|
return validated
|
||||||
|
|
||||||
|
|
||||||
@router.post(
|
@router.post(
|
||||||
"/requests/{request_id}/participants/{participant_id}/invitation",
|
"/requests/{request_id}/participants/{participant_id}/invitation",
|
||||||
response_model=SchedulingInvitationActionResponse,
|
response_model=SchedulingInvitationActionResponse,
|
||||||
@@ -756,7 +976,13 @@ def api_cancel_scheduling_request(
|
|||||||
) -> SchedulingStatusResponse:
|
) -> SchedulingStatusResponse:
|
||||||
_require_request_editor(session, principal=principal, request_id=request_id)
|
_require_request_editor(session, principal=principal, request_id=request_id)
|
||||||
try:
|
try:
|
||||||
request = cancel_scheduling_request(session, tenant_id=principal.tenant_id, request_id=request_id)
|
request = cancel_scheduling_request(
|
||||||
|
session,
|
||||||
|
tenant_id=principal.tenant_id,
|
||||||
|
request_id=request_id,
|
||||||
|
user_id=principal.account_id,
|
||||||
|
allow_calendar_cleanup=has_scope(principal, CALENDAR_EVENT_WRITE_SCOPE),
|
||||||
|
)
|
||||||
except SchedulingError as exc:
|
except SchedulingError as exc:
|
||||||
raise _scheduling_http_error(exc) from exc
|
raise _scheduling_http_error(exc) from exc
|
||||||
response = SchedulingStatusResponse(request=_request_response(request, principal=principal))
|
response = SchedulingStatusResponse(request=_request_response(request, principal=principal))
|
||||||
|
|||||||
@@ -458,6 +458,108 @@ class SchedulingPublicParticipationResponse(BaseModel):
|
|||||||
slots: list[SchedulingPublicCandidateSlotResponse] = Field(default_factory=list)
|
slots: list[SchedulingPublicCandidateSlotResponse] = Field(default_factory=list)
|
||||||
|
|
||||||
|
|
||||||
|
class SchedulingEnrollmentLinkCreateRequest(BaseModel):
|
||||||
|
"""Organizer policy for one reusable, bounded self-enrollment link."""
|
||||||
|
|
||||||
|
model_config = ConfigDict(extra="forbid")
|
||||||
|
|
||||||
|
expires_at: AwareDatetime
|
||||||
|
max_enrollments: int = Field(ge=1, le=10_000)
|
||||||
|
allow_anonymous: bool = True
|
||||||
|
allow_authenticated: bool = True
|
||||||
|
|
||||||
|
@model_validator(mode="after")
|
||||||
|
def validate_access_modes(self) -> "SchedulingEnrollmentLinkCreateRequest":
|
||||||
|
if not self.allow_anonymous and not self.allow_authenticated:
|
||||||
|
raise ValueError("At least one enrollment access mode must be enabled")
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
class SchedulingEnrollmentLinkResponse(BaseModel):
|
||||||
|
id: str
|
||||||
|
request_id: str
|
||||||
|
status: Literal["active", "expired", "revoked", "exhausted"]
|
||||||
|
expires_at: datetime
|
||||||
|
max_enrollments: int
|
||||||
|
enrollment_count: int
|
||||||
|
allow_anonymous: bool
|
||||||
|
allow_authenticated: bool
|
||||||
|
created_at: datetime
|
||||||
|
revoked_at: datetime | None = None
|
||||||
|
|
||||||
|
|
||||||
|
class SchedulingEnrollmentLinkListResponse(BaseModel):
|
||||||
|
links: list[SchedulingEnrollmentLinkResponse] = Field(default_factory=list)
|
||||||
|
|
||||||
|
|
||||||
|
class SchedulingEnrollmentLinkActionResponse(BaseModel):
|
||||||
|
link: SchedulingEnrollmentLinkResponse
|
||||||
|
action_url: str | None = None
|
||||||
|
replayed: bool = False
|
||||||
|
|
||||||
|
|
||||||
|
class SchedulingPublicEnrollmentAccessRequest(BaseModel):
|
||||||
|
model_config = ConfigDict(extra="forbid")
|
||||||
|
|
||||||
|
password: SecretStr | None = Field(default=None, max_length=1024)
|
||||||
|
|
||||||
|
|
||||||
|
class SchedulingPublicEnrollmentSubmitRequest(SchedulingAvailabilityResponseRequest):
|
||||||
|
model_config = ConfigDict(extra="forbid")
|
||||||
|
|
||||||
|
display_name: str = Field(min_length=1, max_length=500)
|
||||||
|
email: str | None = Field(default=None, max_length=320)
|
||||||
|
password: SecretStr | None = Field(default=None, max_length=1024)
|
||||||
|
participant_proof: SecretStr = Field(min_length=32, max_length=1024)
|
||||||
|
idempotency_key: str = Field(min_length=1, max_length=255)
|
||||||
|
|
||||||
|
_validate_email = field_validator("email")(_participant_email)
|
||||||
|
|
||||||
|
|
||||||
|
class SchedulingAuthenticatedEnrollmentSubmitRequest(SchedulingAvailabilityResponseRequest):
|
||||||
|
model_config = ConfigDict(extra="forbid")
|
||||||
|
|
||||||
|
display_name: str = Field(min_length=1, max_length=500)
|
||||||
|
email: str | None = Field(default=None, max_length=320)
|
||||||
|
password: SecretStr | None = Field(default=None, max_length=1024)
|
||||||
|
bind_account_confirmed: bool
|
||||||
|
participant_proof: SecretStr | None = Field(default=None, min_length=32, max_length=1024)
|
||||||
|
idempotency_key: str = Field(min_length=1, max_length=255)
|
||||||
|
|
||||||
|
_validate_email = field_validator("email")(_participant_email)
|
||||||
|
|
||||||
|
|
||||||
|
class SchedulingPublicEnrollmentResponse(BaseModel):
|
||||||
|
request_id: str
|
||||||
|
link_id: str
|
||||||
|
title: str
|
||||||
|
description: str | None = None
|
||||||
|
location: str | None = None
|
||||||
|
timezone: str
|
||||||
|
status: str
|
||||||
|
deadline_at: datetime | None = None
|
||||||
|
enrollment_expires_at: datetime
|
||||||
|
enrollment_remaining: int
|
||||||
|
display_name_required: bool = True
|
||||||
|
participant_email_required: bool
|
||||||
|
anonymous_allowed: bool
|
||||||
|
authenticated_allowed: bool
|
||||||
|
anonymous_password_required: bool
|
||||||
|
single_choice: bool
|
||||||
|
max_participants_per_option: int | None = None
|
||||||
|
allow_maybe: bool
|
||||||
|
allow_comments: bool
|
||||||
|
allow_participant_updates: bool
|
||||||
|
enrolled: bool = False
|
||||||
|
account_bound: bool = False
|
||||||
|
has_response: bool = False
|
||||||
|
submitted_at: datetime | None = None
|
||||||
|
answers: list[SchedulingAvailabilityAnswerResponse] = Field(default_factory=list)
|
||||||
|
comment: str | None = None
|
||||||
|
replayed: bool = False
|
||||||
|
slots: list[SchedulingPublicCandidateSlotResponse] = Field(default_factory=list)
|
||||||
|
|
||||||
|
|
||||||
class SchedulingPollOptionResultResponse(BaseModel):
|
class SchedulingPollOptionResultResponse(BaseModel):
|
||||||
option_id: str
|
option_id: str
|
||||||
option_key: str
|
option_key: str
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import base64
|
|||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import os
|
import os
|
||||||
|
import secrets
|
||||||
|
|
||||||
|
|
||||||
_ALGORITHM = "pbkdf2_sha256"
|
_ALGORITHM = "pbkdf2_sha256"
|
||||||
@@ -11,6 +12,22 @@ _DEFAULT_ITERATIONS = 260_000
|
|||||||
_SALT_BYTES = 16
|
_SALT_BYTES = 16
|
||||||
|
|
||||||
|
|
||||||
|
def new_public_credential() -> str:
|
||||||
|
"""Create a URL-safe credential with at least 256 bits of entropy."""
|
||||||
|
|
||||||
|
return secrets.token_urlsafe(32)
|
||||||
|
|
||||||
|
|
||||||
|
def public_credential_hash(value: str) -> str:
|
||||||
|
return hashlib.sha256(value.encode("utf-8")).hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def verify_public_credential(value: str, expected_hash: str | None) -> bool:
|
||||||
|
if not expected_hash:
|
||||||
|
return False
|
||||||
|
return hmac.compare_digest(public_credential_hash(value), expected_hash)
|
||||||
|
|
||||||
|
|
||||||
def hash_participant_password(
|
def hash_participant_password(
|
||||||
password: str,
|
password: str,
|
||||||
*,
|
*,
|
||||||
@@ -58,4 +75,10 @@ def verify_participant_password(password: str, encoded: str | None) -> bool:
|
|||||||
return hmac.compare_digest(actual, expected)
|
return hmac.compare_digest(actual, expected)
|
||||||
|
|
||||||
|
|
||||||
__all__ = ["hash_participant_password", "verify_participant_password"]
|
__all__ = [
|
||||||
|
"hash_participant_password",
|
||||||
|
"new_public_credential",
|
||||||
|
"public_credential_hash",
|
||||||
|
"verify_participant_password",
|
||||||
|
"verify_public_credential",
|
||||||
|
]
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,580 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
from datetime import datetime, timedelta, timezone
|
||||||
|
|
||||||
|
from sqlalchemy import create_engine
|
||||||
|
from sqlalchemy.orm import sessionmaker
|
||||||
|
|
||||||
|
from govoplan_access.backend.db.models import Account, Group, User
|
||||||
|
from govoplan_core.core.change_sequence import ChangeSequenceEntry
|
||||||
|
from govoplan_core.core.dsar import DsarProvider, DsarSubjectRef
|
||||||
|
from govoplan_core.db.base import Base
|
||||||
|
from govoplan_core.privacy.dsar_workflow import (
|
||||||
|
DataSubjectRequest,
|
||||||
|
create_data_subject_request,
|
||||||
|
execute_data_subject_erasure,
|
||||||
|
plan_data_subject_erasure,
|
||||||
|
search_data_subject_request,
|
||||||
|
)
|
||||||
|
from govoplan_scheduling.backend.db.models import (
|
||||||
|
SchedulingCandidateSlot,
|
||||||
|
SchedulingNotification,
|
||||||
|
SchedulingParticipant,
|
||||||
|
SchedulingPublicEnrollmentLink,
|
||||||
|
SchedulingRequest,
|
||||||
|
)
|
||||||
|
from govoplan_scheduling.backend.dsar_provider import (
|
||||||
|
SCHEDULING_DSAR_CAPABILITY,
|
||||||
|
SchedulingDsarProvider,
|
||||||
|
)
|
||||||
|
from govoplan_scheduling.backend.manifest import manifest
|
||||||
|
|
||||||
|
|
||||||
|
class _Registry:
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
provider: SchedulingDsarProvider,
|
||||||
|
*,
|
||||||
|
scheduling_active: bool = True,
|
||||||
|
) -> None:
|
||||||
|
self.provider = provider
|
||||||
|
self.scheduling_active = scheduling_active
|
||||||
|
|
||||||
|
def capability_names(self):
|
||||||
|
return (SCHEDULING_DSAR_CAPABILITY,)
|
||||||
|
|
||||||
|
def capability_owner(self, name):
|
||||||
|
self._assert_capability(name)
|
||||||
|
return "scheduling"
|
||||||
|
|
||||||
|
def tenant_entitlement_resolver(self):
|
||||||
|
scheduling_active = self.scheduling_active
|
||||||
|
|
||||||
|
class _Resolver:
|
||||||
|
@staticmethod
|
||||||
|
def resolve(session, tenant_id):
|
||||||
|
del session, tenant_id
|
||||||
|
return type(
|
||||||
|
"State",
|
||||||
|
(),
|
||||||
|
{
|
||||||
|
"effective_modules": (
|
||||||
|
("scheduling",) if scheduling_active else ()
|
||||||
|
)
|
||||||
|
},
|
||||||
|
)()
|
||||||
|
|
||||||
|
return _Resolver()
|
||||||
|
|
||||||
|
def require_tenant_capability(self, name, session, **kwargs):
|
||||||
|
del session, kwargs
|
||||||
|
self._assert_capability(name)
|
||||||
|
return self.provider
|
||||||
|
|
||||||
|
def manifests(self):
|
||||||
|
return (type("Manifest", (), {"id": "scheduling"})(),)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _assert_capability(name: str) -> None:
|
||||||
|
if name != SCHEDULING_DSAR_CAPABILITY:
|
||||||
|
raise KeyError(name)
|
||||||
|
|
||||||
|
|
||||||
|
class SchedulingDsarProviderTests(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.engine = create_engine("sqlite:///:memory:", future=True)
|
||||||
|
Base.metadata.create_all(
|
||||||
|
bind=self.engine,
|
||||||
|
tables=[
|
||||||
|
Account.__table__,
|
||||||
|
User.__table__,
|
||||||
|
Group.__table__,
|
||||||
|
ChangeSequenceEntry.__table__,
|
||||||
|
DataSubjectRequest.__table__,
|
||||||
|
SchedulingRequest.__table__,
|
||||||
|
SchedulingPublicEnrollmentLink.__table__,
|
||||||
|
SchedulingCandidateSlot.__table__,
|
||||||
|
SchedulingParticipant.__table__,
|
||||||
|
SchedulingNotification.__table__,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.session = sessionmaker(bind=self.engine, future=True)()
|
||||||
|
now = datetime.now(timezone.utc)
|
||||||
|
account = Account(
|
||||||
|
id="account-1",
|
||||||
|
email="subject@example.test",
|
||||||
|
normalized_email="subject@example.test",
|
||||||
|
display_name="Subject",
|
||||||
|
)
|
||||||
|
other_account = Account(
|
||||||
|
id="account-2",
|
||||||
|
email="other@example.test",
|
||||||
|
normalized_email="other@example.test",
|
||||||
|
display_name="Other",
|
||||||
|
)
|
||||||
|
self.user = User(
|
||||||
|
id="membership-1",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
account_id=account.id,
|
||||||
|
email="subject@example.test",
|
||||||
|
display_name="Subject",
|
||||||
|
)
|
||||||
|
other_user = User(
|
||||||
|
id="membership-2",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
account_id=other_account.id,
|
||||||
|
email="other@example.test",
|
||||||
|
display_name="Other",
|
||||||
|
)
|
||||||
|
self.request = SchedulingRequest(
|
||||||
|
id="request-active",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
title="Choose an appointment",
|
||||||
|
description="Scheduling context visible to the participant",
|
||||||
|
location="Town hall",
|
||||||
|
status="collecting",
|
||||||
|
poll_id="poll-id-do-not-export",
|
||||||
|
organizer_user_id=other_user.id,
|
||||||
|
deadline_at=now + timedelta(days=3),
|
||||||
|
anonymous_password_protection_enabled=True,
|
||||||
|
anonymous_password_hash="password-hash-do-not-export",
|
||||||
|
calendar_integration_enabled=True,
|
||||||
|
calendar_id="calendar-id-do-not-export",
|
||||||
|
calendar_hold_enabled=True,
|
||||||
|
calendar_event_id="calendar-event-id-do-not-export",
|
||||||
|
metadata_={"secret": "request-metadata-do-not-export"},
|
||||||
|
)
|
||||||
|
slot = SchedulingCandidateSlot(
|
||||||
|
id="slot-subject",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=self.request.id,
|
||||||
|
poll_option_id="poll-option-id-do-not-export",
|
||||||
|
label="Tuesday morning",
|
||||||
|
description="First option",
|
||||||
|
start_at=now + timedelta(days=1),
|
||||||
|
end_at=now + timedelta(days=1, hours=1),
|
||||||
|
timezone="Europe/Berlin",
|
||||||
|
location="Town hall",
|
||||||
|
position=0,
|
||||||
|
freebusy_checked_at=now,
|
||||||
|
freebusy_status="busy",
|
||||||
|
freebusy_conflicts=[{"person": "Unrelated conflict person do not export"}],
|
||||||
|
tentative_hold_event_id="hold-event-id-do-not-export",
|
||||||
|
metadata_={"secret": "slot-metadata-do-not-export"},
|
||||||
|
)
|
||||||
|
self.engaged = SchedulingParticipant(
|
||||||
|
id="participant-engaged",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=self.request.id,
|
||||||
|
respondent_id=self.user.id,
|
||||||
|
display_name="Subject Person",
|
||||||
|
email="Subject@Example.Test",
|
||||||
|
participant_type="internal",
|
||||||
|
required=True,
|
||||||
|
status="responded",
|
||||||
|
poll_invitation_id="poll-invitation-id-do-not-export",
|
||||||
|
participation_gateway="public-gateway-do-not-export",
|
||||||
|
self_enrollment_proof_hash="proof-hash-do-not-export",
|
||||||
|
bound_account_id=account.id,
|
||||||
|
account_bound_at=now,
|
||||||
|
last_invited_at=now,
|
||||||
|
responded_at=now,
|
||||||
|
response_comment="Subject response comment",
|
||||||
|
metadata_={"secret": "participant-metadata-do-not-export"},
|
||||||
|
)
|
||||||
|
self.unengaged = SchedulingParticipant(
|
||||||
|
id="participant-unengaged",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=self.request.id,
|
||||||
|
respondent_id=self.user.id,
|
||||||
|
display_name="Subject duplicate draft",
|
||||||
|
email=None,
|
||||||
|
participant_type="external",
|
||||||
|
required=False,
|
||||||
|
status="draft",
|
||||||
|
metadata_={"directory": "internal-directory-data-do-not-export"},
|
||||||
|
)
|
||||||
|
unrelated = SchedulingParticipant(
|
||||||
|
id="participant-other",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=self.request.id,
|
||||||
|
respondent_id=other_user.id,
|
||||||
|
display_name="Unrelated Person",
|
||||||
|
email="other@example.test",
|
||||||
|
status="responded",
|
||||||
|
poll_invitation_id="other-invitation-do-not-export",
|
||||||
|
responded_at=now,
|
||||||
|
response_comment="Unrelated response do not export",
|
||||||
|
)
|
||||||
|
notification = SchedulingNotification(
|
||||||
|
id="notification-subject",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=self.request.id,
|
||||||
|
participant_id=self.engaged.id,
|
||||||
|
event_kind="invitation",
|
||||||
|
channel="mail",
|
||||||
|
recipient="subject@example.test",
|
||||||
|
status="sent",
|
||||||
|
payload={
|
||||||
|
"private": "notification-payload-do-not-export",
|
||||||
|
"token": "notification-token-do-not-export",
|
||||||
|
},
|
||||||
|
error="notification-error-do-not-export",
|
||||||
|
sent_at=now,
|
||||||
|
metadata_={"secret": "notification-metadata-do-not-export"},
|
||||||
|
)
|
||||||
|
unrelated_notification = SchedulingNotification(
|
||||||
|
id="notification-other",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=self.request.id,
|
||||||
|
participant_id=unrelated.id,
|
||||||
|
event_kind="decision",
|
||||||
|
channel="mail",
|
||||||
|
recipient="other@example.test",
|
||||||
|
status="sent",
|
||||||
|
payload={"private": "other-notification-do-not-export"},
|
||||||
|
sent_at=now,
|
||||||
|
)
|
||||||
|
organizer_request = SchedulingRequest(
|
||||||
|
id="request-organized",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
title="Subject organized meeting",
|
||||||
|
status="draft",
|
||||||
|
poll_id="organizer-poll-do-not-export",
|
||||||
|
organizer_user_id=self.user.id,
|
||||||
|
)
|
||||||
|
organizer_slot = SchedulingCandidateSlot(
|
||||||
|
id="slot-organized",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=organizer_request.id,
|
||||||
|
label="Organizer option",
|
||||||
|
start_at=now + timedelta(days=2),
|
||||||
|
end_at=now + timedelta(days=2, hours=1),
|
||||||
|
)
|
||||||
|
organizer_other_participant = SchedulingParticipant(
|
||||||
|
id="participant-organizer-other",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=organizer_request.id,
|
||||||
|
display_name="Organizer unrelated invitee do not export",
|
||||||
|
email="organizer-other@example.test",
|
||||||
|
status="draft",
|
||||||
|
)
|
||||||
|
unrelated_request = SchedulingRequest(
|
||||||
|
id="request-other",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
title="Unrelated request do not export",
|
||||||
|
status="collecting",
|
||||||
|
poll_id="unrelated-poll-do-not-export",
|
||||||
|
organizer_user_id=other_user.id,
|
||||||
|
)
|
||||||
|
tenant_two_request = SchedulingRequest(
|
||||||
|
id="request-tenant-2",
|
||||||
|
tenant_id="tenant-2",
|
||||||
|
title="Tenant two request do not export",
|
||||||
|
status="collecting",
|
||||||
|
poll_id="tenant-two-poll-do-not-export",
|
||||||
|
)
|
||||||
|
tenant_two_participant = SchedulingParticipant(
|
||||||
|
id="participant-tenant-2",
|
||||||
|
tenant_id="tenant-2",
|
||||||
|
request_id=tenant_two_request.id,
|
||||||
|
display_name="Tenant two subject",
|
||||||
|
email="subject@example.test",
|
||||||
|
status="draft",
|
||||||
|
)
|
||||||
|
self.session.add_all(
|
||||||
|
[
|
||||||
|
account,
|
||||||
|
other_account,
|
||||||
|
self.user,
|
||||||
|
other_user,
|
||||||
|
self.request,
|
||||||
|
slot,
|
||||||
|
self.engaged,
|
||||||
|
self.unengaged,
|
||||||
|
unrelated,
|
||||||
|
notification,
|
||||||
|
unrelated_notification,
|
||||||
|
organizer_request,
|
||||||
|
organizer_slot,
|
||||||
|
organizer_other_participant,
|
||||||
|
unrelated_request,
|
||||||
|
tenant_two_request,
|
||||||
|
tenant_two_participant,
|
||||||
|
]
|
||||||
|
)
|
||||||
|
self.session.commit()
|
||||||
|
self.provider = SchedulingDsarProvider()
|
||||||
|
self.subject = DsarSubjectRef(
|
||||||
|
account_id=account.id,
|
||||||
|
membership_id=self.user.id,
|
||||||
|
email="subject@example.test",
|
||||||
|
)
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.session.close()
|
||||||
|
self.engine.dispose()
|
||||||
|
|
||||||
|
def test_manifest_publishes_protocol_conforming_provider(self) -> None:
|
||||||
|
provided_names = {item.name for item in manifest.provides_interfaces}
|
||||||
|
self.assertIn(SCHEDULING_DSAR_CAPABILITY, provided_names)
|
||||||
|
provider = manifest.capability_factories[SCHEDULING_DSAR_CAPABILITY](None)
|
||||||
|
self.assertIsInstance(provider, DsarProvider)
|
||||||
|
self.assertIn(
|
||||||
|
"scheduling.privacy.data-subject-requests",
|
||||||
|
{topic.id for topic in manifest.documentation},
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_search_is_tenant_scoped_minimized_and_participant_specific(self) -> None:
|
||||||
|
records = self._records()
|
||||||
|
resource_types = {record.resource_type for record in records}
|
||||||
|
self.assertTrue(
|
||||||
|
{
|
||||||
|
"scheduling_request",
|
||||||
|
"scheduling_candidate_slot",
|
||||||
|
"scheduling_participant",
|
||||||
|
"scheduling_notification",
|
||||||
|
}.issubset(resource_types)
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
{"participant-engaged", "participant-unengaged"},
|
||||||
|
{
|
||||||
|
record.resource_id
|
||||||
|
for record in records
|
||||||
|
if record.resource_type == "scheduling_participant"
|
||||||
|
},
|
||||||
|
)
|
||||||
|
engaged = next(
|
||||||
|
record for record in records if record.resource_id == "participant-engaged"
|
||||||
|
)
|
||||||
|
self.assertEqual("Subject response comment", engaged.data["response_comment"])
|
||||||
|
|
||||||
|
serialized = repr([record.to_dict() for record in records])
|
||||||
|
for hidden in (
|
||||||
|
"participant-other",
|
||||||
|
"Unrelated Person",
|
||||||
|
"other@example.test",
|
||||||
|
"Unrelated response do not export",
|
||||||
|
"notification-other",
|
||||||
|
"other-notification-do-not-export",
|
||||||
|
"participant-organizer-other",
|
||||||
|
"Organizer unrelated invitee do not export",
|
||||||
|
"request-other",
|
||||||
|
"Unrelated request do not export",
|
||||||
|
"request-tenant-2",
|
||||||
|
"Tenant two request do not export",
|
||||||
|
"participant-tenant-2",
|
||||||
|
"poll-id-do-not-export",
|
||||||
|
"password-hash-do-not-export",
|
||||||
|
"calendar-id-do-not-export",
|
||||||
|
"calendar-event-id-do-not-export",
|
||||||
|
"request-metadata-do-not-export",
|
||||||
|
"poll-option-id-do-not-export",
|
||||||
|
"Unrelated conflict person do not export",
|
||||||
|
"hold-event-id-do-not-export",
|
||||||
|
"slot-metadata-do-not-export",
|
||||||
|
"poll-invitation-id-do-not-export",
|
||||||
|
"public-gateway-do-not-export",
|
||||||
|
"proof-hash-do-not-export",
|
||||||
|
"participant-metadata-do-not-export",
|
||||||
|
"internal-directory-data-do-not-export",
|
||||||
|
"notification-payload-do-not-export",
|
||||||
|
"notification-token-do-not-export",
|
||||||
|
"notification-error-do-not-export",
|
||||||
|
"notification-metadata-do-not-export",
|
||||||
|
"organizer-poll-do-not-export",
|
||||||
|
):
|
||||||
|
self.assertNotIn(hidden, serialized)
|
||||||
|
|
||||||
|
def test_conflicting_email_references_fail_closed_for_participant_data(
|
||||||
|
self,
|
||||||
|
) -> None:
|
||||||
|
records = self.provider.search_subject(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
subject=DsarSubjectRef(
|
||||||
|
email="subject@example.test",
|
||||||
|
external_references={"scheduling.email": "other@example.test"},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual((), records)
|
||||||
|
|
||||||
|
def test_plan_retains_evidence_and_only_anonymizes_unengaged_participant(
|
||||||
|
self,
|
||||||
|
) -> None:
|
||||||
|
actions = self.provider.plan_erasure(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
subject=self.subject,
|
||||||
|
records=self._records(),
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertTrue({"retain", "manual_review"}.issubset({a.kind for a in actions}))
|
||||||
|
self.assertTrue(
|
||||||
|
any(
|
||||||
|
action.action_id
|
||||||
|
== "scheduling:retain:scheduling_participant:participant-engaged"
|
||||||
|
for action in actions
|
||||||
|
)
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
{"scheduling:anonymize:scheduling_participant:participant-unengaged"},
|
||||||
|
{action.action_id for action in actions if action.executable},
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_execution_is_revalidated_tenant_bound_and_idempotent(self) -> None:
|
||||||
|
action = self._anonymize_action()
|
||||||
|
wrong_tenant = self.provider.execute_erasure(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-2",
|
||||||
|
subject=self.subject,
|
||||||
|
actions=(action,),
|
||||||
|
request_id="dsar-wrong-tenant",
|
||||||
|
)
|
||||||
|
self.assertEqual("blocked", wrong_tenant[0].status)
|
||||||
|
|
||||||
|
first = self.provider.execute_erasure(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
subject=self.subject,
|
||||||
|
actions=(action,),
|
||||||
|
request_id="dsar-scheduling-1",
|
||||||
|
)
|
||||||
|
self.assertEqual("executed", first[0].status)
|
||||||
|
self.session.flush()
|
||||||
|
self.assertEqual("removed", self.unengaged.status)
|
||||||
|
self.assertIsNotNone(self.unengaged.deleted_at)
|
||||||
|
self.assertIsNone(self.unengaged.display_name)
|
||||||
|
self.assertIsNone(self.unengaged.email)
|
||||||
|
self.assertIsNone(self.unengaged.respondent_id)
|
||||||
|
self.assertIsNone(self.unengaged.metadata_)
|
||||||
|
|
||||||
|
repeated = self.provider.execute_erasure(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
subject=self.subject,
|
||||||
|
actions=(action,),
|
||||||
|
request_id="dsar-scheduling-1",
|
||||||
|
)
|
||||||
|
self.assertEqual("unchanged", repeated[0].status)
|
||||||
|
|
||||||
|
def test_execution_blocks_when_evidence_appears_after_planning(self) -> None:
|
||||||
|
action = self._anonymize_action()
|
||||||
|
self.session.add(
|
||||||
|
SchedulingNotification(
|
||||||
|
id="notification-late",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=self.request.id,
|
||||||
|
participant_id=self.unengaged.id,
|
||||||
|
event_kind="invitation",
|
||||||
|
recipient=self.unengaged.email,
|
||||||
|
status="pending",
|
||||||
|
payload={},
|
||||||
|
)
|
||||||
|
)
|
||||||
|
self.session.flush()
|
||||||
|
|
||||||
|
result = self.provider.execute_erasure(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
subject=self.subject,
|
||||||
|
actions=(action,),
|
||||||
|
request_id="dsar-stale",
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual("blocked", result[0].status)
|
||||||
|
self.assertIsNone(self.unengaged.deleted_at)
|
||||||
|
|
||||||
|
def test_core_workflow_discovers_active_provider_and_skips_it_when_disabled(
|
||||||
|
self,
|
||||||
|
) -> None:
|
||||||
|
request = create_data_subject_request(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
reference="DSAR-SCHEDULING-1",
|
||||||
|
request_kind="access_and_erasure",
|
||||||
|
subject=self.subject,
|
||||||
|
purpose="Respond to an authorized privacy request.",
|
||||||
|
legal_basis="Article 15 and 17 GDPR",
|
||||||
|
due_at=None,
|
||||||
|
requested_by_account_id="privacy-officer",
|
||||||
|
)
|
||||||
|
self.session.commit()
|
||||||
|
registry = _Registry(self.provider)
|
||||||
|
|
||||||
|
search_data_subject_request(
|
||||||
|
self.session,
|
||||||
|
registry=registry,
|
||||||
|
row=request,
|
||||||
|
expected_revision=1,
|
||||||
|
)
|
||||||
|
self.assertEqual("searched", request.status)
|
||||||
|
self.assertEqual(["scheduling"], request.coverage["covered_modules"])
|
||||||
|
plan_data_subject_erasure(
|
||||||
|
self.session,
|
||||||
|
registry=registry,
|
||||||
|
row=request,
|
||||||
|
expected_revision=2,
|
||||||
|
)
|
||||||
|
executable_ids = [
|
||||||
|
action["action_id"]
|
||||||
|
for action in request.erasure_plan["actions"]
|
||||||
|
if action["executable"]
|
||||||
|
]
|
||||||
|
execute_data_subject_erasure(
|
||||||
|
self.session,
|
||||||
|
registry=registry,
|
||||||
|
row=request,
|
||||||
|
expected_revision=3,
|
||||||
|
action_ids=executable_ids,
|
||||||
|
)
|
||||||
|
self.assertEqual("completed", request.status)
|
||||||
|
|
||||||
|
disabled = create_data_subject_request(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
reference="DSAR-SCHEDULING-DISABLED",
|
||||||
|
request_kind="access",
|
||||||
|
subject=self.subject,
|
||||||
|
purpose="Verify disabled-module coverage.",
|
||||||
|
legal_basis="Article 15 GDPR",
|
||||||
|
due_at=None,
|
||||||
|
requested_by_account_id="privacy-officer",
|
||||||
|
)
|
||||||
|
search_data_subject_request(
|
||||||
|
self.session,
|
||||||
|
registry=_Registry(self.provider, scheduling_active=False),
|
||||||
|
row=disabled,
|
||||||
|
expected_revision=1,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(0, disabled.search_result["record_count"])
|
||||||
|
self.assertEqual(
|
||||||
|
[SCHEDULING_DSAR_CAPABILITY],
|
||||||
|
disabled.coverage["inactive_provider_capabilities"],
|
||||||
|
)
|
||||||
|
|
||||||
|
def _records(self):
|
||||||
|
return self.provider.search_subject(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
subject=self.subject,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _anonymize_action(self):
|
||||||
|
return next(
|
||||||
|
action
|
||||||
|
for action in self.provider.plan_erasure(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
subject=self.subject,
|
||||||
|
records=self._records(),
|
||||||
|
)
|
||||||
|
if action.executable
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
+75
-11
@@ -7,6 +7,19 @@ from govoplan_scheduling.backend.manifest import get_manifest
|
|||||||
|
|
||||||
|
|
||||||
class SchedulingManifestTests(unittest.TestCase):
|
class SchedulingManifestTests(unittest.TestCase):
|
||||||
|
def test_all_static_topics_have_complete_german_content(self) -> None:
|
||||||
|
manifest = get_manifest()
|
||||||
|
for topic in manifest.documentation:
|
||||||
|
german = (topic.translations or {}).get("de", {})
|
||||||
|
self.assertEqual(
|
||||||
|
{"title", "summary", "body"},
|
||||||
|
set(german),
|
||||||
|
topic.id,
|
||||||
|
)
|
||||||
|
self.assertTrue(
|
||||||
|
all(str(value).strip() for value in german.values()), topic.id
|
||||||
|
)
|
||||||
|
|
||||||
def test_manifest_contract(self) -> None:
|
def test_manifest_contract(self) -> None:
|
||||||
manifest = get_manifest()
|
manifest = get_manifest()
|
||||||
|
|
||||||
@@ -24,26 +37,58 @@ class SchedulingManifestTests(unittest.TestCase):
|
|||||||
self.assertIn("auth.principalResolver", manifest.optional_capabilities)
|
self.assertIn("auth.principalResolver", manifest.optional_capabilities)
|
||||||
self.assertIn("poll.scheduling", manifest.required_capabilities)
|
self.assertIn("poll.scheduling", manifest.required_capabilities)
|
||||||
self.assertIn("calendar.scheduling", manifest.optional_capabilities)
|
self.assertIn("calendar.scheduling", manifest.optional_capabilities)
|
||||||
self.assertIn("policy.schedulingParticipantPrivacy", manifest.optional_capabilities)
|
self.assertIn(
|
||||||
|
"policy.schedulingParticipantPrivacy", manifest.optional_capabilities
|
||||||
|
)
|
||||||
self.assertIn("access.people_search", manifest.optional_capabilities)
|
self.assertIn("access.people_search", manifest.optional_capabilities)
|
||||||
self.assertIn("addresses.people_search", manifest.optional_capabilities)
|
self.assertIn("addresses.people_search", manifest.optional_capabilities)
|
||||||
self.assertIn("evaluation", manifest.optional_dependencies)
|
self.assertIn("evaluation", manifest.optional_dependencies)
|
||||||
self.assertIsNotNone(manifest.route_factory)
|
self.assertIsNotNone(manifest.route_factory)
|
||||||
|
self.assertIsNotNone(manifest.public_tenant_resolver)
|
||||||
self.assertIsNotNone(manifest.migration_spec)
|
self.assertIsNotNone(manifest.migration_spec)
|
||||||
self.assertIsNotNone(manifest.frontend)
|
self.assertIsNotNone(manifest.frontend)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
["/scheduling/public/:requestId/:token"],
|
[
|
||||||
|
"/scheduling/public/:requestId/:token",
|
||||||
|
"/scheduling/enrol/:requestId/:token",
|
||||||
|
],
|
||||||
[route.path for route in manifest.frontend.public_routes],
|
[route.path for route in manifest.frontend.public_routes],
|
||||||
)
|
)
|
||||||
self.assertIn("poll.availability_matrix", {interface.name for interface in manifest.requires_interfaces})
|
self.assertIn(
|
||||||
self.assertIn("poll.response_collection", {interface.name for interface in manifest.requires_interfaces})
|
"poll.availability_matrix",
|
||||||
self.assertIn("poll.workflow_context", {interface.name for interface in manifest.requires_interfaces})
|
{interface.name for interface in manifest.requires_interfaces},
|
||||||
self.assertIn("poll.governed_participation", {interface.name for interface in manifest.requires_interfaces})
|
)
|
||||||
self.assertIn("notifications.dispatch", {interface.name for interface in manifest.requires_interfaces})
|
self.assertIn(
|
||||||
self.assertIn("access.people_search", {interface.name for interface in manifest.requires_interfaces})
|
"poll.response_collection",
|
||||||
self.assertIn("addresses.people_search", {interface.name for interface in manifest.requires_interfaces})
|
{interface.name for interface in manifest.requires_interfaces},
|
||||||
self.assertIn("calendar.scheduling", {interface.name for interface in manifest.requires_interfaces})
|
)
|
||||||
required_interfaces = {interface.name: interface for interface in manifest.requires_interfaces}
|
self.assertIn(
|
||||||
|
"poll.workflow_context",
|
||||||
|
{interface.name for interface in manifest.requires_interfaces},
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
"poll.governed_participation",
|
||||||
|
{interface.name for interface in manifest.requires_interfaces},
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
"notifications.dispatch",
|
||||||
|
{interface.name for interface in manifest.requires_interfaces},
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
"access.people_search",
|
||||||
|
{interface.name for interface in manifest.requires_interfaces},
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
"addresses.people_search",
|
||||||
|
{interface.name for interface in manifest.requires_interfaces},
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
"calendar.scheduling",
|
||||||
|
{interface.name for interface in manifest.requires_interfaces},
|
||||||
|
)
|
||||||
|
required_interfaces = {
|
||||||
|
interface.name: interface for interface in manifest.requires_interfaces
|
||||||
|
}
|
||||||
for interface_name in (
|
for interface_name in (
|
||||||
"poll.availability_matrix",
|
"poll.availability_matrix",
|
||||||
"poll.response_collection",
|
"poll.response_collection",
|
||||||
@@ -52,6 +97,25 @@ class SchedulingManifestTests(unittest.TestCase):
|
|||||||
):
|
):
|
||||||
self.assertEqual("0.1.11", required_interfaces[interface_name].version_min)
|
self.assertEqual("0.1.11", required_interfaces[interface_name].version_min)
|
||||||
|
|
||||||
|
documentation = {topic.id: topic for topic in manifest.documentation}
|
||||||
|
workflow = documentation["scheduling.find-and-decide-meeting-time"]
|
||||||
|
self.assertEqual("workflow", workflow.metadata["kind"])
|
||||||
|
self.assertEqual("/scheduling", workflow.metadata["route"])
|
||||||
|
self.assertIn("scheduling.request", workflow.metadata["help_contexts"])
|
||||||
|
self.assertIn(
|
||||||
|
"scheduling.public-participation", workflow.metadata["help_contexts"]
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
"scheduling.calendar-coordination",
|
||||||
|
documentation["scheduling.calendar-coordination"].metadata["help_contexts"],
|
||||||
|
)
|
||||||
|
self.assertIn(
|
||||||
|
"scheduling.public-self-enrollment",
|
||||||
|
documentation["scheduling.public-self-enrollment"].metadata[
|
||||||
|
"help_contexts"
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ from govoplan_scheduling.backend.db.models import (
|
|||||||
from govoplan_scheduling.backend.manifest import get_manifest as get_scheduling_manifest
|
from govoplan_scheduling.backend.manifest import get_manifest as get_scheduling_manifest
|
||||||
|
|
||||||
|
|
||||||
_SCHEDULING_HEAD = "c9d4e7f1a2b3"
|
_SCHEDULING_HEAD = "d7a4c1e8f205"
|
||||||
_SCHEDULING_RESPONSE_SETTINGS_REVISION = "ad7e3c9b2f10"
|
_SCHEDULING_RESPONSE_SETTINGS_REVISION = "ad7e3c9b2f10"
|
||||||
_ENABLED_MODULES = ("poll", "scheduling")
|
_ENABLED_MODULES = ("poll", "scheduling")
|
||||||
_MANIFEST_FACTORIES = (get_poll_manifest, get_scheduling_manifest)
|
_MANIFEST_FACTORIES = (get_poll_manifest, get_scheduling_manifest)
|
||||||
@@ -150,6 +150,14 @@ class SchedulingMigrationTests(unittest.TestCase):
|
|||||||
self.assertIn("max_participants_per_option", columns)
|
self.assertIn("max_participants_per_option", columns)
|
||||||
self.assertIn("response_comment", participant_columns)
|
self.assertIn("response_comment", participant_columns)
|
||||||
self.assertIn("participation_gateway", participant_columns)
|
self.assertIn("participation_gateway", participant_columns)
|
||||||
|
self.assertIn("self_enrollment_link_id", participant_columns)
|
||||||
|
self.assertIn("self_enrollment_proof_hash", participant_columns)
|
||||||
|
self.assertIn("bound_account_id", participant_columns)
|
||||||
|
self.assertIn("account_bound_at", participant_columns)
|
||||||
|
self.assertIn(
|
||||||
|
"scheduling_public_enrollment_links",
|
||||||
|
inspect(engine).get_table_names(),
|
||||||
|
)
|
||||||
self.assertEqual(visibility, "aggregates_only")
|
self.assertEqual(visibility, "aggregates_only")
|
||||||
self.assertEqual(tuple(response_defaults), (1, 0, None, 1, 0, 0, 0, None))
|
self.assertEqual(tuple(response_defaults), (1, 0, None, 1, 0, 0, 0, None))
|
||||||
self.assertEqual(set(counts.values()), {1})
|
self.assertEqual(set(counts.values()), {1})
|
||||||
|
|||||||
@@ -0,0 +1,283 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from datetime import datetime, timedelta, timezone
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from govoplan_scheduling.backend.db.models import (
|
||||||
|
SchedulingCandidateSlot,
|
||||||
|
SchedulingParticipant,
|
||||||
|
SchedulingRequest,
|
||||||
|
)
|
||||||
|
from govoplan_scheduling.backend.schemas import (
|
||||||
|
SchedulingCandidateSlotReconcileInput,
|
||||||
|
SchedulingParticipantReconcileInput,
|
||||||
|
SchedulingRequestUpdateRequest,
|
||||||
|
)
|
||||||
|
from govoplan_scheduling.backend.service import (
|
||||||
|
SchedulingError,
|
||||||
|
_plan_scheduling_participant_reconciliation,
|
||||||
|
_plan_scheduling_request_update,
|
||||||
|
_plan_scheduling_slot_reconciliation,
|
||||||
|
scheduling_participant_revision,
|
||||||
|
scheduling_slot_revision,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
NOW = datetime(2026, 7, 29, 9, tzinfo=timezone.utc)
|
||||||
|
|
||||||
|
|
||||||
|
def _request() -> SchedulingRequest:
|
||||||
|
return SchedulingRequest(
|
||||||
|
id="request-1",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
title="Steering group",
|
||||||
|
timezone="Europe/Berlin",
|
||||||
|
status="collecting",
|
||||||
|
poll_id="poll-1",
|
||||||
|
allow_external_participants=True,
|
||||||
|
allow_participant_updates=True,
|
||||||
|
result_visibility="after_close",
|
||||||
|
participant_visibility="aggregates_only",
|
||||||
|
notify_on_answers=True,
|
||||||
|
single_choice=False,
|
||||||
|
max_participants_per_option=None,
|
||||||
|
allow_maybe=True,
|
||||||
|
allow_comments=False,
|
||||||
|
participant_email_required=False,
|
||||||
|
anonymous_password_protection_enabled=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _slot(
|
||||||
|
request: SchedulingRequest,
|
||||||
|
*,
|
||||||
|
slot_id: str,
|
||||||
|
position: int,
|
||||||
|
start_offset: int,
|
||||||
|
) -> SchedulingCandidateSlot:
|
||||||
|
slot = SchedulingCandidateSlot(
|
||||||
|
id=slot_id,
|
||||||
|
tenant_id=request.tenant_id,
|
||||||
|
request=request,
|
||||||
|
poll_option_id=f"option-{slot_id}",
|
||||||
|
label=f"Slot {position + 1}",
|
||||||
|
start_at=NOW + timedelta(hours=start_offset),
|
||||||
|
end_at=NOW + timedelta(hours=start_offset + 1),
|
||||||
|
timezone=request.timezone,
|
||||||
|
position=position,
|
||||||
|
freebusy_conflicts=[],
|
||||||
|
metadata_={},
|
||||||
|
)
|
||||||
|
return slot
|
||||||
|
|
||||||
|
|
||||||
|
def _slot_input(
|
||||||
|
slot: SchedulingCandidateSlot,
|
||||||
|
*,
|
||||||
|
label: str | None = None,
|
||||||
|
) -> SchedulingCandidateSlotReconcileInput:
|
||||||
|
return SchedulingCandidateSlotReconcileInput(
|
||||||
|
id=slot.id,
|
||||||
|
revision=scheduling_slot_revision(slot),
|
||||||
|
label=label or slot.label,
|
||||||
|
start_at=slot.start_at,
|
||||||
|
end_at=slot.end_at,
|
||||||
|
timezone=slot.timezone,
|
||||||
|
location=slot.location,
|
||||||
|
metadata=slot.metadata_ or {},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _participant(
|
||||||
|
request: SchedulingRequest,
|
||||||
|
*,
|
||||||
|
participant_id: str,
|
||||||
|
respondent_id: str,
|
||||||
|
email: str,
|
||||||
|
required: bool,
|
||||||
|
status: str = "invited",
|
||||||
|
invitation_id: str | None = None,
|
||||||
|
) -> SchedulingParticipant:
|
||||||
|
return SchedulingParticipant(
|
||||||
|
id=participant_id,
|
||||||
|
tenant_id=request.tenant_id,
|
||||||
|
request=request,
|
||||||
|
respondent_id=respondent_id,
|
||||||
|
display_name=participant_id.title(),
|
||||||
|
email=email,
|
||||||
|
participant_type="internal",
|
||||||
|
required=required,
|
||||||
|
status=status,
|
||||||
|
poll_invitation_id=invitation_id,
|
||||||
|
participation_gateway="scheduling" if invitation_id else None,
|
||||||
|
metadata_={},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _participant_input(
|
||||||
|
participant: SchedulingParticipant,
|
||||||
|
**changes: object,
|
||||||
|
) -> SchedulingParticipantReconcileInput:
|
||||||
|
values = {
|
||||||
|
"id": participant.id,
|
||||||
|
"revision": scheduling_participant_revision(participant),
|
||||||
|
"respondent_id": participant.respondent_id,
|
||||||
|
"display_name": participant.display_name,
|
||||||
|
"email": participant.email,
|
||||||
|
"participant_type": participant.participant_type,
|
||||||
|
"required": participant.required,
|
||||||
|
"metadata": participant.metadata_ or {},
|
||||||
|
}
|
||||||
|
values.update(changes)
|
||||||
|
return SchedulingParticipantReconcileInput.model_validate(values)
|
||||||
|
|
||||||
|
|
||||||
|
def test_slot_plan_is_inspectable_and_does_not_mutate_models() -> None:
|
||||||
|
request = _request()
|
||||||
|
first = _slot(request, slot_id="slot-1", position=0, start_offset=1)
|
||||||
|
second = _slot(request, slot_id="slot-2", position=1, start_offset=3)
|
||||||
|
supplied = [
|
||||||
|
_slot_input(first, label="Updated first slot"),
|
||||||
|
SchedulingCandidateSlotReconcileInput(
|
||||||
|
label="New slot",
|
||||||
|
start_at=NOW + timedelta(hours=5),
|
||||||
|
end_at=NOW + timedelta(hours=6),
|
||||||
|
timezone=request.timezone,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
plan = _plan_scheduling_slot_reconciliation(
|
||||||
|
request=request,
|
||||||
|
supplied_slots=supplied,
|
||||||
|
option_mutation_available=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert [update.slot_id for update in plan.updates] == ["slot-1"]
|
||||||
|
assert plan.updates[0].changes.label == "Updated first slot"
|
||||||
|
assert len(plan.additions) == 1
|
||||||
|
assert plan.removals == ("slot-2",)
|
||||||
|
assert plan.changed is True
|
||||||
|
assert first.label == "Slot 1"
|
||||||
|
assert second.deleted_at is None
|
||||||
|
assert len(request.slots) == 2
|
||||||
|
|
||||||
|
|
||||||
|
def test_exact_slot_replay_produces_a_noop_plan() -> None:
|
||||||
|
request = _request()
|
||||||
|
first = _slot(request, slot_id="slot-1", position=0, start_offset=1)
|
||||||
|
|
||||||
|
plan = _plan_scheduling_slot_reconciliation(
|
||||||
|
request=request,
|
||||||
|
supplied_slots=[_slot_input(first)],
|
||||||
|
option_mutation_available=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert plan.changed is False
|
||||||
|
assert plan.updates == ()
|
||||||
|
assert plan.additions == ()
|
||||||
|
assert plan.removals == ()
|
||||||
|
|
||||||
|
|
||||||
|
def test_slot_plan_rejects_removal_of_a_tentative_calendar_hold() -> None:
|
||||||
|
request = _request()
|
||||||
|
held = _slot(request, slot_id="slot-held", position=0, start_offset=1)
|
||||||
|
held.tentative_hold_event_id = "event-1"
|
||||||
|
|
||||||
|
with pytest.raises(SchedulingError, match="tentative calendar hold"):
|
||||||
|
_plan_scheduling_slot_reconciliation(
|
||||||
|
request=request,
|
||||||
|
supplied_slots=[],
|
||||||
|
option_mutation_available=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_participant_plan_distinguishes_updates_additions_and_retirements() -> None:
|
||||||
|
request = _request()
|
||||||
|
alice = _participant(
|
||||||
|
request,
|
||||||
|
participant_id="alice",
|
||||||
|
respondent_id="user-alice",
|
||||||
|
email="alice@example.test",
|
||||||
|
required=True,
|
||||||
|
invitation_id="invitation-alice",
|
||||||
|
)
|
||||||
|
bob = _participant(
|
||||||
|
request,
|
||||||
|
participant_id="bob",
|
||||||
|
respondent_id="user-bob",
|
||||||
|
email="bob@example.test",
|
||||||
|
required=False,
|
||||||
|
status="responded",
|
||||||
|
)
|
||||||
|
supplied = [
|
||||||
|
_participant_input(alice, email="alice.new@example.test", required=False),
|
||||||
|
SchedulingParticipantReconcileInput(
|
||||||
|
respondent_id="user-charlie",
|
||||||
|
display_name="Charlie",
|
||||||
|
email="charlie@example.test",
|
||||||
|
participant_type="internal",
|
||||||
|
required=True,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
plan = _plan_scheduling_participant_reconciliation(
|
||||||
|
request=request,
|
||||||
|
supplied_participants=supplied,
|
||||||
|
participation_available=True,
|
||||||
|
retirement_available=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert len(plan.updates) == 1
|
||||||
|
assert plan.updates[0].participant_id == "alice"
|
||||||
|
assert plan.updates[0].revoke_invitation is True
|
||||||
|
assert set(plan.updates[0].changed_fields) == {"email", "required"}
|
||||||
|
assert plan.creations[0].replaces_participant_id is None
|
||||||
|
assert plan.creations[0].supplied.required is True
|
||||||
|
assert plan.retirements == ("bob",)
|
||||||
|
assert alice.email == "alice@example.test"
|
||||||
|
assert alice.required is True
|
||||||
|
assert bob.status == "responded"
|
||||||
|
|
||||||
|
|
||||||
|
def test_request_plan_records_invitation_expiry_work_without_tokens() -> None:
|
||||||
|
request = _request()
|
||||||
|
participant = _participant(
|
||||||
|
request,
|
||||||
|
participant_id="alice",
|
||||||
|
respondent_id="user-alice",
|
||||||
|
email="alice@example.test",
|
||||||
|
required=True,
|
||||||
|
invitation_id="invitation-alice",
|
||||||
|
)
|
||||||
|
deadline = NOW + timedelta(days=2)
|
||||||
|
|
||||||
|
plan = _plan_scheduling_request_update(
|
||||||
|
request=request,
|
||||||
|
payload=SchedulingRequestUpdateRequest(deadline_at=deadline),
|
||||||
|
participation_available=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert plan.deadline_changed is True
|
||||||
|
assert plan.retained_invitation_ids == ((participant.id, "invitation-alice"),)
|
||||||
|
assert "token" not in repr(plan).casefold()
|
||||||
|
assert request.deadline_at is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_request_plan_rejects_policy_change_after_link_issuance() -> None:
|
||||||
|
request = _request()
|
||||||
|
_participant(
|
||||||
|
request,
|
||||||
|
participant_id="alice",
|
||||||
|
respondent_id="user-alice",
|
||||||
|
email="alice@example.test",
|
||||||
|
required=True,
|
||||||
|
invitation_id="invitation-alice",
|
||||||
|
)
|
||||||
|
|
||||||
|
with pytest.raises(SchedulingError, match="cannot change"):
|
||||||
|
_plan_scheduling_request_update(
|
||||||
|
request=request,
|
||||||
|
payload=SchedulingRequestUpdateRequest(single_choice=True),
|
||||||
|
participation_available=True,
|
||||||
|
)
|
||||||
@@ -33,7 +33,12 @@ from govoplan_scheduling.backend.db.models import (
|
|||||||
SchedulingParticipant,
|
SchedulingParticipant,
|
||||||
SchedulingRequest,
|
SchedulingRequest,
|
||||||
)
|
)
|
||||||
from govoplan_scheduling.backend.manifest import ADMIN_SCOPE, RESPOND_SCOPE, WRITE_SCOPE
|
from govoplan_scheduling.backend.manifest import (
|
||||||
|
ADMIN_SCOPE,
|
||||||
|
RESPOND_SCOPE,
|
||||||
|
WRITE_SCOPE,
|
||||||
|
get_manifest as get_scheduling_manifest,
|
||||||
|
)
|
||||||
from govoplan_scheduling.backend.router import (
|
from govoplan_scheduling.backend.router import (
|
||||||
api_get_my_scheduling_availability,
|
api_get_my_scheduling_availability,
|
||||||
api_submit_scheduling_availability,
|
api_submit_scheduling_availability,
|
||||||
@@ -78,6 +83,7 @@ class SchedulingResponseEditingTests(unittest.TestCase):
|
|||||||
registry.register(get_poll_manifest())
|
registry.register(get_poll_manifest())
|
||||||
registry.configure_capability_context(ModuleContext(registry=registry, settings=object()))
|
registry.configure_capability_context(ModuleContext(registry=registry, settings=object()))
|
||||||
configure_runtime(registry=registry)
|
configure_runtime(registry=registry)
|
||||||
|
self.registry = registry
|
||||||
self.engine = create_engine("sqlite:///:memory:")
|
self.engine = create_engine("sqlite:///:memory:")
|
||||||
Base.metadata.create_all(
|
Base.metadata.create_all(
|
||||||
self.engine,
|
self.engine,
|
||||||
@@ -512,6 +518,26 @@ class SchedulingResponseEditingTests(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
self.assertEqual(tokens, {})
|
self.assertEqual(tokens, {})
|
||||||
token = self._issue_copy(public_request, public_request.participants[0])
|
token = self._issue_copy(public_request, public_request.participants[0])
|
||||||
|
resolver = get_scheduling_manifest().public_tenant_resolver
|
||||||
|
self.assertIsNotNone(resolver)
|
||||||
|
public_http_request = SimpleNamespace(
|
||||||
|
app=SimpleNamespace(
|
||||||
|
state=SimpleNamespace(govoplan_registry=self.registry)
|
||||||
|
),
|
||||||
|
path_params={
|
||||||
|
"request_id": public_request.id,
|
||||||
|
"token": token,
|
||||||
|
},
|
||||||
|
url=SimpleNamespace(
|
||||||
|
path=(
|
||||||
|
f"/api/v1/scheduling/public/{public_request.id}/{token}"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
"tenant-1",
|
||||||
|
resolver(public_http_request, self.session),
|
||||||
|
)
|
||||||
invitation = self.session.query(PollInvitation).filter(
|
invitation = self.session.query(PollInvitation).filter(
|
||||||
PollInvitation.id == public_request.participants[0].poll_invitation_id
|
PollInvitation.id == public_request.participants[0].poll_invitation_id
|
||||||
).one()
|
).one()
|
||||||
@@ -1708,10 +1734,20 @@ class SchedulingResponseEditingTests(unittest.TestCase):
|
|||||||
notice_until,
|
notice_until,
|
||||||
)
|
)
|
||||||
|
|
||||||
with patch.object(
|
with (
|
||||||
scheduling_service,
|
patch.object(
|
||||||
"_now",
|
scheduling_service,
|
||||||
return_value=cancelled_at + timedelta(days=1),
|
"_now",
|
||||||
|
return_value=cancelled_at + timedelta(days=1),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"govoplan_poll.backend.service._now",
|
||||||
|
return_value=cancelled_at + timedelta(days=1),
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"govoplan_poll.backend.participation_service._now",
|
||||||
|
return_value=cancelled_at + timedelta(days=1),
|
||||||
|
),
|
||||||
):
|
):
|
||||||
notice = get_public_scheduling_participation(
|
notice = get_public_scheduling_participation(
|
||||||
self.session,
|
self.session,
|
||||||
|
|||||||
@@ -0,0 +1,328 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
from datetime import datetime, timedelta, timezone
|
||||||
|
from types import SimpleNamespace
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from sqlalchemy import create_engine
|
||||||
|
from sqlalchemy.orm import Session, sessionmaker
|
||||||
|
from pydantic import SecretStr
|
||||||
|
|
||||||
|
from govoplan_core.core.modules import ModuleContext
|
||||||
|
from govoplan_core.core.registry import PlatformRegistry
|
||||||
|
from govoplan_core.db.base import Base
|
||||||
|
from govoplan_poll.backend.db.models import (
|
||||||
|
Poll,
|
||||||
|
PollInvitation,
|
||||||
|
PollLifecycleTransition,
|
||||||
|
PollOption,
|
||||||
|
PollParticipationSubmission,
|
||||||
|
PollResponse,
|
||||||
|
)
|
||||||
|
from govoplan_poll.backend.manifest import get_manifest as get_poll_manifest
|
||||||
|
from govoplan_scheduling.backend.db.models import (
|
||||||
|
SchedulingCandidateSlot,
|
||||||
|
SchedulingNotification,
|
||||||
|
SchedulingParticipant,
|
||||||
|
SchedulingPublicEnrollmentLink,
|
||||||
|
SchedulingRequest,
|
||||||
|
)
|
||||||
|
from govoplan_scheduling.backend.schemas import (
|
||||||
|
SchedulingAuthenticatedEnrollmentSubmitRequest,
|
||||||
|
SchedulingAvailabilityAnswerInput,
|
||||||
|
SchedulingCandidateSlotInput,
|
||||||
|
SchedulingEnrollmentLinkCreateRequest,
|
||||||
|
SchedulingPublicEnrollmentAccessRequest,
|
||||||
|
SchedulingPublicEnrollmentSubmitRequest,
|
||||||
|
SchedulingRequestCreateRequest,
|
||||||
|
)
|
||||||
|
from govoplan_scheduling.backend.runtime import configure_runtime
|
||||||
|
from govoplan_scheduling.backend.service import (
|
||||||
|
SchedulingConflictError,
|
||||||
|
SchedulingPublicParticipationError,
|
||||||
|
create_scheduling_enrollment_link,
|
||||||
|
create_scheduling_request,
|
||||||
|
get_public_scheduling_enrollment,
|
||||||
|
revoke_scheduling_enrollment_link,
|
||||||
|
scheduling_request_is_visible,
|
||||||
|
scheduling_slot_revision,
|
||||||
|
submit_authenticated_scheduling_enrollment,
|
||||||
|
submit_public_scheduling_enrollment,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SchedulingSelfEnrollmentTests(unittest.TestCase):
|
||||||
|
def setUp(self) -> None:
|
||||||
|
self.now = datetime(2026, 8, 20, 10, tzinfo=timezone.utc)
|
||||||
|
self.patches = (
|
||||||
|
patch("govoplan_scheduling.backend.service._now", return_value=self.now),
|
||||||
|
patch("govoplan_poll.backend.service._now", return_value=self.now),
|
||||||
|
patch("govoplan_poll.backend.participation_service._now", return_value=self.now),
|
||||||
|
)
|
||||||
|
for item in self.patches:
|
||||||
|
item.start()
|
||||||
|
registry = PlatformRegistry()
|
||||||
|
registry.register(get_poll_manifest())
|
||||||
|
settings = SimpleNamespace(
|
||||||
|
redis_url=None,
|
||||||
|
scheduling_public_self_enrollment_enabled=True,
|
||||||
|
scheduling_public_self_enrollment_max_capacity=100,
|
||||||
|
)
|
||||||
|
registry.configure_capability_context(
|
||||||
|
ModuleContext(registry=registry, settings=settings)
|
||||||
|
)
|
||||||
|
configure_runtime(registry=registry, settings=settings)
|
||||||
|
self.engine = create_engine("sqlite:///:memory:")
|
||||||
|
Base.metadata.create_all(
|
||||||
|
self.engine,
|
||||||
|
tables=[
|
||||||
|
Poll.__table__,
|
||||||
|
PollOption.__table__,
|
||||||
|
PollResponse.__table__,
|
||||||
|
PollInvitation.__table__,
|
||||||
|
PollParticipationSubmission.__table__,
|
||||||
|
PollLifecycleTransition.__table__,
|
||||||
|
SchedulingRequest.__table__,
|
||||||
|
SchedulingPublicEnrollmentLink.__table__,
|
||||||
|
SchedulingCandidateSlot.__table__,
|
||||||
|
SchedulingParticipant.__table__,
|
||||||
|
SchedulingNotification.__table__,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
self.Session = sessionmaker(bind=self.engine)
|
||||||
|
self.session: Session = self.Session()
|
||||||
|
|
||||||
|
def tearDown(self) -> None:
|
||||||
|
self.session.close()
|
||||||
|
Base.metadata.drop_all(self.engine)
|
||||||
|
self.engine.dispose()
|
||||||
|
for item in reversed(self.patches):
|
||||||
|
item.stop()
|
||||||
|
|
||||||
|
def _request(self, *, email_required: bool = False) -> SchedulingRequest:
|
||||||
|
start = self.now + timedelta(days=1)
|
||||||
|
request, _tokens = create_scheduling_request(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
user_id="organizer-1",
|
||||||
|
payload=SchedulingRequestCreateRequest(
|
||||||
|
title="Public planning",
|
||||||
|
status="collecting",
|
||||||
|
deadline_at=self.now + timedelta(days=4),
|
||||||
|
participant_email_required=email_required,
|
||||||
|
slots=[
|
||||||
|
SchedulingCandidateSlotInput(
|
||||||
|
label="First option",
|
||||||
|
start_at=start,
|
||||||
|
end_at=start + timedelta(hours=1),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
return request
|
||||||
|
|
||||||
|
def _link(
|
||||||
|
self,
|
||||||
|
request: SchedulingRequest,
|
||||||
|
*,
|
||||||
|
capacity: int = 2,
|
||||||
|
) -> tuple[SchedulingPublicEnrollmentLink, str]:
|
||||||
|
return create_scheduling_enrollment_link(
|
||||||
|
self.session,
|
||||||
|
tenant_id=request.tenant_id,
|
||||||
|
request_id=request.id,
|
||||||
|
created_by="organizer-1",
|
||||||
|
payload=SchedulingEnrollmentLinkCreateRequest(
|
||||||
|
expires_at=self.now + timedelta(days=2),
|
||||||
|
max_enrollments=capacity,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _answer(request: SchedulingRequest) -> SchedulingAvailabilityAnswerInput:
|
||||||
|
slot = request.slots[0]
|
||||||
|
return SchedulingAvailabilityAnswerInput(
|
||||||
|
slot_id=slot.id,
|
||||||
|
value="available",
|
||||||
|
option_revision=scheduling_slot_revision(slot),
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_anonymous_enrollment_requires_proof_for_updates_and_is_idempotent(self) -> None:
|
||||||
|
request = self._request(email_required=True)
|
||||||
|
link, token = self._link(request)
|
||||||
|
|
||||||
|
opened = get_public_scheduling_enrollment(
|
||||||
|
self.session,
|
||||||
|
request_id=request.id,
|
||||||
|
token=token,
|
||||||
|
payload=SchedulingPublicEnrollmentAccessRequest(),
|
||||||
|
client_address="192.0.2.1",
|
||||||
|
)
|
||||||
|
self.assertTrue(opened["participant_email_required"])
|
||||||
|
self.assertEqual(opened["enrollment_remaining"], 2)
|
||||||
|
|
||||||
|
payload = SchedulingPublicEnrollmentSubmitRequest(
|
||||||
|
display_name="Ada Example",
|
||||||
|
email="ADA@example.test",
|
||||||
|
participant_proof="proof-" + "a" * 40,
|
||||||
|
idempotency_key="enrollment-submit-1",
|
||||||
|
answers=[self._answer(request)],
|
||||||
|
)
|
||||||
|
created = submit_public_scheduling_enrollment(
|
||||||
|
self.session,
|
||||||
|
request_id=request.id,
|
||||||
|
token=token,
|
||||||
|
payload=payload,
|
||||||
|
client_address="192.0.2.1",
|
||||||
|
)
|
||||||
|
replayed = submit_public_scheduling_enrollment(
|
||||||
|
self.session,
|
||||||
|
request_id=request.id,
|
||||||
|
token=token,
|
||||||
|
payload=payload,
|
||||||
|
client_address="192.0.2.1",
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertTrue(created["enrolled"])
|
||||||
|
self.assertTrue(created["has_response"])
|
||||||
|
self.assertTrue(replayed["replayed"])
|
||||||
|
self.assertEqual(self.session.query(SchedulingParticipant).count(), 1)
|
||||||
|
participant = self.session.query(SchedulingParticipant).one()
|
||||||
|
self.assertEqual(participant.email, "ada@example.test")
|
||||||
|
self.assertNotEqual(participant.self_enrollment_proof_hash, payload.participant_proof.get_secret_value())
|
||||||
|
self.assertNotIn(token, repr(participant.metadata_))
|
||||||
|
|
||||||
|
with self.assertRaises(SchedulingPublicParticipationError):
|
||||||
|
submit_public_scheduling_enrollment(
|
||||||
|
self.session,
|
||||||
|
request_id=request.id,
|
||||||
|
token=token,
|
||||||
|
payload=payload.model_copy(
|
||||||
|
update={
|
||||||
|
"participant_proof": SecretStr("proof-" + "b" * 40),
|
||||||
|
"idempotency_key": "enrollment-submit-2",
|
||||||
|
}
|
||||||
|
),
|
||||||
|
client_address="192.0.2.2",
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_capacity_is_serialized_but_existing_proof_can_update(self) -> None:
|
||||||
|
request = self._request()
|
||||||
|
_link, token = self._link(request, capacity=1)
|
||||||
|
first = SchedulingPublicEnrollmentSubmitRequest(
|
||||||
|
display_name="Ada",
|
||||||
|
participant_proof="proof-" + "a" * 40,
|
||||||
|
idempotency_key="first",
|
||||||
|
answers=[self._answer(request)],
|
||||||
|
)
|
||||||
|
submit_public_scheduling_enrollment(
|
||||||
|
self.session,
|
||||||
|
request_id=request.id,
|
||||||
|
token=token,
|
||||||
|
payload=first,
|
||||||
|
client_address="192.0.2.3",
|
||||||
|
)
|
||||||
|
updated = submit_public_scheduling_enrollment(
|
||||||
|
self.session,
|
||||||
|
request_id=request.id,
|
||||||
|
token=token,
|
||||||
|
payload=first.model_copy(update={"idempotency_key": "update"}),
|
||||||
|
client_address="192.0.2.3",
|
||||||
|
)
|
||||||
|
self.assertTrue(updated["has_response"])
|
||||||
|
with self.assertRaises(SchedulingConflictError):
|
||||||
|
submit_public_scheduling_enrollment(
|
||||||
|
self.session,
|
||||||
|
request_id=request.id,
|
||||||
|
token=token,
|
||||||
|
payload=first.model_copy(
|
||||||
|
update={
|
||||||
|
"display_name": "Grace",
|
||||||
|
"participant_proof": SecretStr("proof-" + "g" * 40),
|
||||||
|
"idempotency_key": "second",
|
||||||
|
}
|
||||||
|
),
|
||||||
|
client_address="192.0.2.4",
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_signed_in_binding_requires_confirmation_and_can_claim_proof(self) -> None:
|
||||||
|
request = self._request()
|
||||||
|
link, token = self._link(request)
|
||||||
|
anonymous = SchedulingPublicEnrollmentSubmitRequest(
|
||||||
|
display_name="Ada",
|
||||||
|
participant_proof="proof-" + "a" * 40,
|
||||||
|
idempotency_key="anonymous",
|
||||||
|
answers=[self._answer(request)],
|
||||||
|
)
|
||||||
|
submit_public_scheduling_enrollment(
|
||||||
|
self.session,
|
||||||
|
request_id=request.id,
|
||||||
|
token=token,
|
||||||
|
payload=anonymous,
|
||||||
|
client_address="192.0.2.5",
|
||||||
|
)
|
||||||
|
authenticated = SchedulingAuthenticatedEnrollmentSubmitRequest(
|
||||||
|
display_name="Ada",
|
||||||
|
bind_account_confirmed=True,
|
||||||
|
participant_proof=anonymous.participant_proof,
|
||||||
|
idempotency_key="bound",
|
||||||
|
answers=[self._answer(request)],
|
||||||
|
)
|
||||||
|
bound = submit_authenticated_scheduling_enrollment(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=request.id,
|
||||||
|
token=token,
|
||||||
|
account_id="account-ada",
|
||||||
|
account_email="ada@example.test",
|
||||||
|
payload=authenticated,
|
||||||
|
client_address="192.0.2.5",
|
||||||
|
)
|
||||||
|
participant = self.session.query(SchedulingParticipant).one()
|
||||||
|
self.assertTrue(bound["account_bound"])
|
||||||
|
self.assertEqual(participant.bound_account_id, "account-ada")
|
||||||
|
self.assertEqual(participant.self_enrollment_link_id, link.id)
|
||||||
|
self.assertTrue(
|
||||||
|
scheduling_request_is_visible(
|
||||||
|
request,
|
||||||
|
actor_ids=("account-ada",),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
with self.assertRaisesRegex(ValueError, "Account binding must be confirmed"):
|
||||||
|
submit_authenticated_scheduling_enrollment(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=request.id,
|
||||||
|
token=token,
|
||||||
|
account_id="other-account",
|
||||||
|
account_email=None,
|
||||||
|
payload=authenticated.model_copy(update={"bind_account_confirmed": False}),
|
||||||
|
client_address="192.0.2.6",
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_revocation_invalidates_link_without_storing_raw_token(self) -> None:
|
||||||
|
request = self._request()
|
||||||
|
link, token = self._link(request)
|
||||||
|
self.assertNotEqual(link.token_hash, token)
|
||||||
|
revoked, replayed = revoke_scheduling_enrollment_link(
|
||||||
|
self.session,
|
||||||
|
tenant_id=request.tenant_id,
|
||||||
|
request_id=request.id,
|
||||||
|
link_id=link.id,
|
||||||
|
)
|
||||||
|
self.assertFalse(replayed)
|
||||||
|
self.assertIsNotNone(revoked.revoked_at)
|
||||||
|
with self.assertRaises(SchedulingPublicParticipationError):
|
||||||
|
get_public_scheduling_enrollment(
|
||||||
|
self.session,
|
||||||
|
request_id=request.id,
|
||||||
|
token=token,
|
||||||
|
payload=SchedulingPublicEnrollmentAccessRequest(),
|
||||||
|
client_address="192.0.2.7",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
+208
-3
@@ -11,14 +11,21 @@ from sqlalchemy.orm import Session, sessionmaker
|
|||||||
|
|
||||||
from govoplan_core.auth import ApiPrincipal
|
from govoplan_core.auth import ApiPrincipal
|
||||||
from govoplan_core.core.access import PrincipalRef
|
from govoplan_core.core.access import PrincipalRef
|
||||||
from govoplan_core.core.calendar import CALENDAR_AVAILABILITY_READ_SCOPE, CALENDAR_EVENT_WRITE_SCOPE
|
from govoplan_core.core.calendar import CalendarCapabilityError, CALENDAR_AVAILABILITY_READ_SCOPE, CALENDAR_EVENT_WRITE_SCOPE
|
||||||
from govoplan_core.db.base import Base
|
from govoplan_core.db.base import Base
|
||||||
from govoplan_core.core.change_sequence import ChangeSequenceEntry
|
from govoplan_core.core.change_sequence import ChangeSequenceEntry
|
||||||
from govoplan_core.core.modules import ModuleContext
|
from govoplan_core.core.modules import ModuleContext
|
||||||
from govoplan_core.core.registry import PlatformRegistry
|
from govoplan_core.core.registry import PlatformRegistry
|
||||||
from govoplan_access.backend.db.models import Account, User
|
from govoplan_access.backend.db.models import Account, User
|
||||||
from govoplan_calendar.backend.db.models import CalendarCollection, CalendarEvent, CalendarOutboxOperation, CalendarSyncSource
|
from govoplan_calendar.backend.db.models import (
|
||||||
|
CalendarCollection,
|
||||||
|
CalendarEvent,
|
||||||
|
CalendarMigrationBatch,
|
||||||
|
CalendarOutboxOperation,
|
||||||
|
CalendarSyncSource,
|
||||||
|
)
|
||||||
from govoplan_calendar.backend.manifest import get_manifest as get_calendar_manifest
|
from govoplan_calendar.backend.manifest import get_manifest as get_calendar_manifest
|
||||||
|
from govoplan_calendar.backend.capabilities import SqlCalendarSchedulingProvider
|
||||||
from govoplan_poll.backend.db.models import (
|
from govoplan_poll.backend.db.models import (
|
||||||
Poll,
|
Poll,
|
||||||
PollInvitation,
|
PollInvitation,
|
||||||
@@ -93,6 +100,23 @@ from govoplan_scheduling.backend.runtime import configure_runtime
|
|||||||
|
|
||||||
class SchedulingServiceTests(unittest.TestCase):
|
class SchedulingServiceTests(unittest.TestCase):
|
||||||
def setUp(self) -> None:
|
def setUp(self) -> None:
|
||||||
|
fixed_now = datetime(2026, 7, 19, 12, tzinfo=timezone.utc)
|
||||||
|
self.now_patches = (
|
||||||
|
patch(
|
||||||
|
"govoplan_scheduling.backend.service._now",
|
||||||
|
return_value=fixed_now,
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"govoplan_poll.backend.service._now",
|
||||||
|
return_value=fixed_now,
|
||||||
|
),
|
||||||
|
patch(
|
||||||
|
"govoplan_poll.backend.participation_service._now",
|
||||||
|
return_value=fixed_now,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
for now_patch in self.now_patches:
|
||||||
|
now_patch.start()
|
||||||
registry = PlatformRegistry()
|
registry = PlatformRegistry()
|
||||||
registry.register(get_poll_manifest())
|
registry.register(get_poll_manifest())
|
||||||
registry.register(get_calendar_manifest())
|
registry.register(get_calendar_manifest())
|
||||||
@@ -112,6 +136,7 @@ class SchedulingServiceTests(unittest.TestCase):
|
|||||||
CalendarEvent.__table__,
|
CalendarEvent.__table__,
|
||||||
CalendarSyncSource.__table__,
|
CalendarSyncSource.__table__,
|
||||||
CalendarOutboxOperation.__table__,
|
CalendarOutboxOperation.__table__,
|
||||||
|
CalendarMigrationBatch.__table__,
|
||||||
ChangeSequenceEntry.__table__,
|
ChangeSequenceEntry.__table__,
|
||||||
Account.__table__,
|
Account.__table__,
|
||||||
User.__table__,
|
User.__table__,
|
||||||
@@ -125,6 +150,8 @@ class SchedulingServiceTests(unittest.TestCase):
|
|||||||
self.session: Session = self.Session()
|
self.session: Session = self.Session()
|
||||||
|
|
||||||
def tearDown(self) -> None:
|
def tearDown(self) -> None:
|
||||||
|
for now_patch in reversed(self.now_patches):
|
||||||
|
now_patch.stop()
|
||||||
self.session.close()
|
self.session.close()
|
||||||
Base.metadata.drop_all(
|
Base.metadata.drop_all(
|
||||||
self.engine,
|
self.engine,
|
||||||
@@ -136,6 +163,7 @@ class SchedulingServiceTests(unittest.TestCase):
|
|||||||
User.__table__,
|
User.__table__,
|
||||||
Account.__table__,
|
Account.__table__,
|
||||||
ChangeSequenceEntry.__table__,
|
ChangeSequenceEntry.__table__,
|
||||||
|
CalendarMigrationBatch.__table__,
|
||||||
CalendarOutboxOperation.__table__,
|
CalendarOutboxOperation.__table__,
|
||||||
CalendarSyncSource.__table__,
|
CalendarSyncSource.__table__,
|
||||||
CalendarEvent.__table__,
|
CalendarEvent.__table__,
|
||||||
@@ -506,6 +534,7 @@ class SchedulingServiceTests(unittest.TestCase):
|
|||||||
request_id=request.id,
|
request_id=request.id,
|
||||||
payload=SchedulingDecisionRequest(slot_id=request.slots[1].id, handoff_to_calendar=False),
|
payload=SchedulingDecisionRequest(slot_id=request.slots[1].id, handoff_to_calendar=False),
|
||||||
user_id="user-1",
|
user_id="user-1",
|
||||||
|
allow_calendar_handoff=True,
|
||||||
)
|
)
|
||||||
with self.assertRaisesRegex(SchedulingError, "only available before a scheduling decision"):
|
with self.assertRaisesRegex(SchedulingError, "only available before a scheduling decision"):
|
||||||
evaluate_calendar_freebusy(
|
evaluate_calendar_freebusy(
|
||||||
@@ -552,12 +581,17 @@ class SchedulingServiceTests(unittest.TestCase):
|
|||||||
user_id="user-1",
|
user_id="user-1",
|
||||||
request_id=decided.id,
|
request_id=decided.id,
|
||||||
)
|
)
|
||||||
|
self.assertTrue(all(slot.tentative_hold_event_id is None for slot in request.slots))
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
all(
|
all(
|
||||||
slot.metadata_["calendar_hold"]["last_known_external_state"] == "queued"
|
set(slot.metadata_["calendar_hold"]) == {
|
||||||
|
"last_known_external_state",
|
||||||
|
"outbox_operation_id",
|
||||||
|
}
|
||||||
for slot in request.slots
|
for slot in request.slots
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
self.assertEqual(request.metadata_["calendar_cleanup"]["status"], "accepted")
|
||||||
generated_events = (
|
generated_events = (
|
||||||
self.session.query(CalendarEvent)
|
self.session.query(CalendarEvent)
|
||||||
.filter(CalendarEvent.metadata_["scheduling_request_id"].as_string() == request.id)
|
.filter(CalendarEvent.metadata_["scheduling_request_id"].as_string() == request.id)
|
||||||
@@ -605,6 +639,177 @@ class SchedulingServiceTests(unittest.TestCase):
|
|||||||
user_id="user-1",
|
user_id="user-1",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_decision_promotes_selected_hold_and_releases_the_rest(self) -> None:
|
||||||
|
self._calendar()
|
||||||
|
self.session.add(
|
||||||
|
CalendarSyncSource(
|
||||||
|
id="source-decision-cleanup",
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
calendar_id="calendar-1",
|
||||||
|
source_kind="caldav",
|
||||||
|
collection_url="https://dav.example.test/cal/",
|
||||||
|
auth_type="none",
|
||||||
|
sync_enabled=True,
|
||||||
|
sync_interval_seconds=900,
|
||||||
|
sync_direction="two_way",
|
||||||
|
conflict_policy="etag",
|
||||||
|
metadata_={},
|
||||||
|
)
|
||||||
|
)
|
||||||
|
request, _tokens = create_scheduling_request(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
user_id="user-1",
|
||||||
|
payload=self._payload(),
|
||||||
|
)
|
||||||
|
request, hold_ids, warnings = create_tentative_calendar_holds(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
user_id="user-1",
|
||||||
|
request_id=request.id,
|
||||||
|
)
|
||||||
|
selected_slot = request.slots[0]
|
||||||
|
released_slot = request.slots[1]
|
||||||
|
selected_hold_id = selected_slot.tentative_hold_event_id
|
||||||
|
released_hold_id = released_slot.tentative_hold_event_id
|
||||||
|
self.assertEqual(len(hold_ids), 2)
|
||||||
|
self.assertEqual(warnings, [])
|
||||||
|
|
||||||
|
close_scheduling_request(self.session, tenant_id="tenant-1", request_id=request.id)
|
||||||
|
decided = decide_scheduling_request(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=request.id,
|
||||||
|
payload=SchedulingDecisionRequest(slot_id=selected_slot.id, handoff_to_calendar=True),
|
||||||
|
user_id="user-1",
|
||||||
|
allow_calendar_handoff=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(decided.status, "handed_off")
|
||||||
|
self.assertEqual(decided.calendar_event_id, selected_hold_id)
|
||||||
|
self.assertEqual(decided.metadata_["calendar_cleanup"]["status"], "accepted")
|
||||||
|
self.assertIsNone(selected_slot.tentative_hold_event_id)
|
||||||
|
self.assertIsNone(released_slot.tentative_hold_event_id)
|
||||||
|
self.assertEqual(
|
||||||
|
set(selected_slot.metadata_["calendar_hold"]),
|
||||||
|
{"last_known_external_state", "outbox_operation_id"},
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
set(released_slot.metadata_["calendar_hold"]),
|
||||||
|
{"last_known_external_state", "outbox_operation_id"},
|
||||||
|
)
|
||||||
|
self.assertIsNotNone(selected_slot.metadata_["calendar_hold"]["outbox_operation_id"])
|
||||||
|
self.assertIsNotNone(released_slot.metadata_["calendar_hold"]["outbox_operation_id"])
|
||||||
|
promoted = self.session.get(CalendarEvent, selected_hold_id)
|
||||||
|
released = self.session.get(CalendarEvent, released_hold_id)
|
||||||
|
self.assertEqual(promoted.status, "CONFIRMED")
|
||||||
|
self.assertIsNone(promoted.deleted_at)
|
||||||
|
self.assertIsNotNone(released.deleted_at)
|
||||||
|
|
||||||
|
replayed = decide_scheduling_request(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=request.id,
|
||||||
|
payload=SchedulingDecisionRequest(slot_id=selected_slot.id, handoff_to_calendar=True),
|
||||||
|
user_id="user-1",
|
||||||
|
allow_calendar_handoff=True,
|
||||||
|
)
|
||||||
|
self.assertEqual(replayed.calendar_event_id, selected_hold_id)
|
||||||
|
self.assertEqual(
|
||||||
|
self.session.query(CalendarEvent)
|
||||||
|
.filter(CalendarEvent.metadata_["scheduling_request_id"].as_string() == request.id)
|
||||||
|
.count(),
|
||||||
|
2,
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_cancellation_keeps_partial_calendar_cleanup_retryable(self) -> None:
|
||||||
|
self._calendar()
|
||||||
|
request, _tokens = create_scheduling_request(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
user_id="user-1",
|
||||||
|
payload=self._payload(),
|
||||||
|
)
|
||||||
|
request, _hold_ids, _warnings = create_tentative_calendar_holds(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
user_id="user-1",
|
||||||
|
request_id=request.id,
|
||||||
|
)
|
||||||
|
failed_event_id = request.slots[1].tentative_hold_event_id
|
||||||
|
original_release = SqlCalendarSchedulingProvider.release_event
|
||||||
|
|
||||||
|
def flaky_release(provider, session, *, tenant_id, user_id, event_id):
|
||||||
|
if event_id == failed_event_id:
|
||||||
|
raise CalendarCapabilityError("temporary Calendar failure")
|
||||||
|
return original_release(
|
||||||
|
provider,
|
||||||
|
session,
|
||||||
|
tenant_id=tenant_id,
|
||||||
|
user_id=user_id,
|
||||||
|
event_id=event_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
with patch.object(SqlCalendarSchedulingProvider, "release_event", new=flaky_release):
|
||||||
|
pending = cancel_scheduling_request(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=request.id,
|
||||||
|
user_id="user-1",
|
||||||
|
allow_calendar_cleanup=True,
|
||||||
|
)
|
||||||
|
self.assertEqual(pending.status, "collecting")
|
||||||
|
self.assertEqual(pending.metadata_["calendar_cleanup"]["status"], "retry_required")
|
||||||
|
self.assertEqual(
|
||||||
|
[slot.tentative_hold_event_id for slot in request.slots],
|
||||||
|
[None, failed_event_id],
|
||||||
|
)
|
||||||
|
|
||||||
|
cancelled = cancel_scheduling_request(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=request.id,
|
||||||
|
user_id="user-1",
|
||||||
|
allow_calendar_cleanup=True,
|
||||||
|
)
|
||||||
|
self.assertEqual(cancelled.status, "cancelled")
|
||||||
|
self.assertEqual(cancelled.metadata_["calendar_cleanup"]["status"], "accepted")
|
||||||
|
self.assertTrue(all(slot.tentative_hold_event_id is None for slot in request.slots))
|
||||||
|
|
||||||
|
def test_cancellation_waits_when_calendar_capability_is_unavailable(self) -> None:
|
||||||
|
self._calendar()
|
||||||
|
request, _tokens = create_scheduling_request(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
user_id="user-1",
|
||||||
|
payload=self._payload(),
|
||||||
|
)
|
||||||
|
request, hold_ids, _warnings = create_tentative_calendar_holds(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
user_id="user-1",
|
||||||
|
request_id=request.id,
|
||||||
|
)
|
||||||
|
|
||||||
|
with patch(
|
||||||
|
"govoplan_scheduling.backend.service._calendar_provider",
|
||||||
|
side_effect=SchedulingError("Calendar scheduling capability is unavailable"),
|
||||||
|
):
|
||||||
|
pending = cancel_scheduling_request(
|
||||||
|
self.session,
|
||||||
|
tenant_id="tenant-1",
|
||||||
|
request_id=request.id,
|
||||||
|
user_id="user-1",
|
||||||
|
allow_calendar_cleanup=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(pending.status, "collecting")
|
||||||
|
self.assertEqual(pending.metadata_["calendar_cleanup"]["status"], "retry_required")
|
||||||
|
self.assertEqual(
|
||||||
|
[slot.tentative_hold_event_id for slot in request.slots],
|
||||||
|
hold_ids,
|
||||||
|
)
|
||||||
|
|
||||||
def test_notification_outbox_jobs_are_created_and_listed(self) -> None:
|
def test_notification_outbox_jobs_are_created_and_listed(self) -> None:
|
||||||
request, _tokens = create_scheduling_request(
|
request, _tokens = create_scheduling_request(
|
||||||
self.session,
|
self.session,
|
||||||
|
|||||||
+7
-7
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@govoplan/scheduling-webui",
|
"name": "@govoplan/scheduling-webui",
|
||||||
"version": "0.1.11",
|
"version": "0.1.21",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
@@ -18,14 +18,14 @@
|
|||||||
"test:ui-structure": "node scripts/test-scheduling-page-structure.mjs"
|
"test:ui-structure": "node scripts/test-scheduling-page-structure.mjs"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@govoplan/core-webui": "^0.1.11",
|
"@govoplan/core-webui": "^0.1.18",
|
||||||
"lucide-react": "^1.23.0",
|
"lucide-react": "^1.23.0",
|
||||||
"react": "^19.0.0",
|
"react": ">=19.2.7 <20",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": ">=19.2.7 <20",
|
||||||
"react-router-dom": "^7.1.1",
|
"react-router": ">=8.3.0 <9",
|
||||||
"@vitejs/plugin-react": "^4.3.4",
|
"@vitejs/plugin-react": "^5.2.0",
|
||||||
"typescript": "^5.7.2",
|
"typescript": "^5.7.2",
|
||||||
"vite": "^6.0.6"
|
"vite": "^7.3.6"
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependenciesMeta": {
|
||||||
"@govoplan/core-webui": {
|
"@govoplan/core-webui": {
|
||||||
|
|||||||
@@ -4,12 +4,16 @@ import { fileURLToPath } from "node:url";
|
|||||||
|
|
||||||
const pagePath = fileURLToPath(new URL("../src/features/scheduling/SchedulingPage.tsx", import.meta.url));
|
const pagePath = fileURLToPath(new URL("../src/features/scheduling/SchedulingPage.tsx", import.meta.url));
|
||||||
const publicPagePath = fileURLToPath(new URL("../src/features/scheduling/SchedulingPublicPage.tsx", import.meta.url));
|
const publicPagePath = fileURLToPath(new URL("../src/features/scheduling/SchedulingPublicPage.tsx", import.meta.url));
|
||||||
|
const enrollmentPagePath = fileURLToPath(new URL("../src/features/scheduling/SchedulingEnrollmentPage.tsx", import.meta.url));
|
||||||
const apiPath = fileURLToPath(new URL("../src/api/scheduling.ts", import.meta.url));
|
const apiPath = fileURLToPath(new URL("../src/api/scheduling.ts", import.meta.url));
|
||||||
const modulePath = fileURLToPath(new URL("../src/module.ts", import.meta.url));
|
const modulePath = fileURLToPath(new URL("../src/module.ts", import.meta.url));
|
||||||
|
const widgetPath = fileURLToPath(new URL("../src/features/scheduling/SchedulingRequestsWidget.tsx", import.meta.url));
|
||||||
const page = readFileSync(pagePath, "utf8");
|
const page = readFileSync(pagePath, "utf8");
|
||||||
const publicPage = readFileSync(publicPagePath, "utf8");
|
const publicPage = readFileSync(publicPagePath, "utf8");
|
||||||
|
const enrollmentPage = readFileSync(enrollmentPagePath, "utf8");
|
||||||
const api = readFileSync(apiPath, "utf8");
|
const api = readFileSync(apiPath, "utf8");
|
||||||
const moduleSource = readFileSync(modulePath, "utf8");
|
const moduleSource = readFileSync(modulePath, "utf8");
|
||||||
|
const widget = readFileSync(widgetPath, "utf8");
|
||||||
|
|
||||||
assert.match(page, /usePlatformUiCapability<CalendarPickerUiCapability>\("calendar\.picker"\)/);
|
assert.match(page, /usePlatformUiCapability<CalendarPickerUiCapability>\("calendar\.picker"\)/);
|
||||||
assert.match(page, /hasScope\(auth, "calendar:calendar:read"\)/);
|
assert.match(page, /hasScope\(auth, "calendar:calendar:read"\)/);
|
||||||
@@ -17,6 +21,7 @@ assert.match(page, /Boolean\(calendarPickerCapability\) && canReadCalendars && c
|
|||||||
assert.doesNotMatch(page, /@govoplan\/calendar-webui|govoplan-calendar\/webui/);
|
assert.doesNotMatch(page, /@govoplan\/calendar-webui|govoplan-calendar\/webui/);
|
||||||
assert.match(page, /Card,[\s\S]*DataGrid,[\s\S]*DataGridRowActions,[\s\S]*FormField,[\s\S]*MetricCard,[\s\S]*PasswordField,[\s\S]*PeoplePicker,[\s\S]*SelectionList,[\s\S]*ToggleSwitch,[\s\S]*from "@govoplan\/core-webui"/);
|
assert.match(page, /Card,[\s\S]*DataGrid,[\s\S]*DataGridRowActions,[\s\S]*FormField,[\s\S]*MetricCard,[\s\S]*PasswordField,[\s\S]*PeoplePicker,[\s\S]*SelectionList,[\s\S]*ToggleSwitch,[\s\S]*from "@govoplan\/core-webui"/);
|
||||||
assert.doesNotMatch(page, /@govoplan\/core-webui\/src\//);
|
assert.doesNotMatch(page, /@govoplan\/core-webui\/src\//);
|
||||||
|
assert.match(page, /ActionBlockerHint,[\s\S]*DocumentationHelpLink,[\s\S]*StageRail,[\s\S]*from "@govoplan\/core-webui"/);
|
||||||
|
|
||||||
assert.match(page, /className="scheduling-workspace-layout"/);
|
assert.match(page, /className="scheduling-workspace-layout"/);
|
||||||
assert.match(page, /<aside className="scheduling-request-sidebar">/);
|
assert.match(page, /<aside className="scheduling-request-sidebar">/);
|
||||||
@@ -36,17 +41,28 @@ const editorStart = page.indexOf('<div className="scheduling-editor-surface">');
|
|||||||
const editorEnd = page.indexOf('</form>', editorStart);
|
const editorEnd = page.indexOf('</form>', editorStart);
|
||||||
const editor = page.slice(editorStart, editorEnd);
|
const editor = page.slice(editorStart, editorEnd);
|
||||||
assert.ok(editor.indexOf("I18N.discard") < editor.indexOf("I18N.save"));
|
assert.ok(editor.indexOf("I18N.discard") < editor.indexOf("I18N.save"));
|
||||||
assert.match(editor, /form="scheduling-editor-form"/);
|
assert.match(editor, /form:\s*"scheduling-editor-form"/);
|
||||||
assert.match(editor, /<Card title=\{I18N\.basicInformation\}>/);
|
assert.match(editor, /<Card title=\{I18N\.basicInformation\}>/);
|
||||||
assert.match(editor, /<Card title=\{I18N\.calendarIntegration\}>/);
|
assert.match(editor, /<Card title=\{I18N\.calendarIntegration\}>/);
|
||||||
assert.match(page, /<Card title=\{I18N\.candidateSlots\}>/);
|
assert.match(page, /<Card title=\{I18N\.candidateSlots\}>/);
|
||||||
assert.match(page, /<Card title=\{I18N\.participants\}>/);
|
assert.match(page, /<Card title=\{I18N\.participants\}>/);
|
||||||
|
assert.match(page, /<StageRail[\s\S]*schedulingLifecycleStages\(selected\.status\)/);
|
||||||
|
assert.match(page, /topicId: "scheduling\.find-and-decide-meeting-time"/);
|
||||||
|
assert.match(page, /topicId: "scheduling\.calendar-coordination"/);
|
||||||
|
assert.match(page, /topicId: "scheduling\.participation-governance"/);
|
||||||
|
assert.match(page, /topicId: "scheduling\.public-self-enrollment"/);
|
||||||
|
assert.match(page, /function SelfEnrollmentLinksCard/);
|
||||||
|
assert.match(page, /createSchedulingEnrollmentLink/);
|
||||||
|
assert.match(page, /revokeSchedulingEnrollmentLink/);
|
||||||
|
assert.match(page, /title=\{I18N\.selfEnrollmentRevokeTitle\}[\s\S]*tone="danger"/);
|
||||||
|
assert.match(page, /public_participation_policy_enforcement_available === false[\s\S]*<ActionBlockerHint/);
|
||||||
assert.match(page, /<Card title=\{I18N\.generalSettings\}>/);
|
assert.match(page, /<Card title=\{I18N\.generalSettings\}>/);
|
||||||
assert.match(page, /<Card title=\{I18N\.participantPrivacy\}>/);
|
assert.match(page, /<Card title=\{I18N\.participantPrivacy\}>/);
|
||||||
assert.match(editor, /<FormField label=\{I18N\.title\}>/);
|
assert.match(editor, /<FormField label=\{I18N\.title\}>/);
|
||||||
assert.match(page, /useUnsavedDraftGuard\(/);
|
assert.match(page, /useUnsavedDraftGuard\(/);
|
||||||
assert.match(page, /requestDiscard\(exitEditor\)/);
|
assert.match(page, /requestDiscard\(exitEditor\)/);
|
||||||
assert.match(page, /dirty: responseDirty,[\s\S]*onSave: persistAvailability,[\s\S]*onDiscard: resetResponseDraft/);
|
assert.match(page, /dirty: responseDirty,[\s\S]*onSave: persistAvailability,[\s\S]*onDiscard: resetResponseDraft/);
|
||||||
|
assert.match(page, /calendarCleanup\?\.status === "retry_required"[\s\S]*I18N\.calendarCleanupRetryTitle/);
|
||||||
assert.doesNotMatch(page, /window\.(?:alert|confirm)\(/);
|
assert.doesNotMatch(page, /window\.(?:alert|confirm)\(/);
|
||||||
|
|
||||||
for (const setting of [
|
for (const setting of [
|
||||||
@@ -84,7 +100,7 @@ assert.match(page, /search=\{participantSearch\}/);
|
|||||||
assert.doesNotMatch(page, /<table|scheduling-table|scheduling-card(?:\s|"|`)/);
|
assert.doesNotMatch(page, /<table|scheduling-table|scheduling-card(?:\s|"|`)/);
|
||||||
assert.match(page, /<TableActionGroup[\s\S]*disabled: saving \|\| !decisionEnabled/);
|
assert.match(page, /<TableActionGroup[\s\S]*disabled: saving \|\| !decisionEnabled/);
|
||||||
assert.match(page, /showDecisionAction=\{canManageSelected\}/);
|
assert.match(page, /showDecisionAction=\{canManageSelected\}/);
|
||||||
assert.match(page, /<IconButton[\s\S]*label=\{I18N\.refresh\}/);
|
assert.match(page, /<WorkspaceActionBar[\s\S]*refreshable[\s\S]*reloadAction=\{\{[\s\S]*label: I18N\.refresh/);
|
||||||
assert.doesNotMatch(page, /AdminIconButton/);
|
assert.doesNotMatch(page, /AdminIconButton/);
|
||||||
|
|
||||||
const participantGridStart = page.indexOf("function ParticipantsGrid(");
|
const participantGridStart = page.indexOf("function ParticipantsGrid(");
|
||||||
@@ -95,10 +111,18 @@ assert.match(participantGrid, /minimumSlots=\{3\}/);
|
|||||||
assert.ok(participantGrid.indexOf('id: "copy-invitation"') < participantGrid.indexOf('id: "send-invitation"'));
|
assert.ok(participantGrid.indexOf('id: "copy-invitation"') < participantGrid.indexOf('id: "send-invitation"'));
|
||||||
assert.ok(participantGrid.indexOf('id: "send-invitation"') < participantGrid.indexOf('id: "revoke-invitation"'));
|
assert.ok(participantGrid.indexOf('id: "send-invitation"') < participantGrid.indexOf('id: "revoke-invitation"'));
|
||||||
assert.match(participantGrid, /schedulingInvitationActionBlocks\(request, participant, now\)/);
|
assert.match(participantGrid, /schedulingInvitationActionBlocks\(request, participant, now\)/);
|
||||||
assert.match(participantGrid, /disabledReason: copyDisabledReason/);
|
assert.match(participantGrid, /disabledReason: saving \? I18N\.saving : copyDisabledReason/);
|
||||||
assert.match(participantGrid, /disabledReason: deliveryDisabledReason/);
|
assert.match(participantGrid, /disabledReason: saving \? I18N\.saving : deliveryDisabledReason/);
|
||||||
assert.match(participantGrid, /disabledReason: revokeDisabledReason/);
|
assert.match(participantGrid, /disabledReason: saving \? I18N\.saving : revokeDisabledReason/);
|
||||||
assert.match(page, /<ConfirmDialog[\s\S]*title=\{I18N\.revokeInvitationLabel\}[\s\S]*tone="danger"/);
|
assert.match(page, /<ConfirmDialog[\s\S]*title=\{I18N\.revokeInvitationLabel\}[\s\S]*tone="danger"/);
|
||||||
|
assert.match(page, /setConsequentialAction\(\{ kind: "close"/);
|
||||||
|
assert.match(page, /setConsequentialAction\(\{ kind: "reminder"/);
|
||||||
|
assert.match(page, /setConsequentialAction\(\{ kind: "holds"/);
|
||||||
|
assert.match(page, /setConsequentialAction\(\{ kind: "final-event"/);
|
||||||
|
assert.match(page, /setDecisionTarget\(\{ requestId: selected\.id, slot \}\)/);
|
||||||
|
assert.match(page, /open=\{Boolean\(consequentialAction && consequentialActionCopy\)\}/);
|
||||||
|
assert.match(page, /open=\{Boolean\(decisionTarget\)\}/);
|
||||||
|
assert.match(page, /disabledReason=\{saving \? I18N\.saving/);
|
||||||
assert.match(page, /navigator\.clipboard\.writeText\(value\)/);
|
assert.match(page, /navigator\.clipboard\.writeText\(value\)/);
|
||||||
assert.match(page, /navigator\.clipboard\.write\(\[new ClipboardItem/);
|
assert.match(page, /navigator\.clipboard\.write\(\[new ClipboardItem/);
|
||||||
assert.match(page, /schedulingPublicInvitationUrl\(response\.action_url, window\.location\.origin\)/);
|
assert.match(page, /schedulingPublicInvitationUrl\(response\.action_url, window\.location\.origin\)/);
|
||||||
@@ -144,12 +168,19 @@ assert.match(api, /issueSchedulingParticipantInvitation\([\s\S]*json\(\{ action,
|
|||||||
assert.match(api, /revokeSchedulingParticipantInvitation\([\s\S]*method: "DELETE"[\s\S]*participant_revision: participantRevision/);
|
assert.match(api, /revokeSchedulingParticipantInvitation\([\s\S]*method: "DELETE"[\s\S]*participant_revision: participantRevision/);
|
||||||
assert.match(api, /participants\/\$\{encodeURIComponent\(participantId\)\}\/invitation/);
|
assert.match(api, /participants\/\$\{encodeURIComponent\(participantId\)\}\/invitation/);
|
||||||
assert.match(api, /\/api\/v1\/scheduling\/public\/\$\{encodeURIComponent\(requestId\)\}\/\$\{encodeURIComponent\(token\)\}/);
|
assert.match(api, /\/api\/v1\/scheduling\/public\/\$\{encodeURIComponent\(requestId\)\}\/\$\{encodeURIComponent\(token\)\}/);
|
||||||
|
assert.match(api, /\/api\/v1\/scheduling\/public-enrollment\/\$\{encodeURIComponent\(requestId\)\}\/\$\{encodeURIComponent\(token\)\}/);
|
||||||
assert.match(page, /useSearchParams\(\)/);
|
assert.match(page, /useSearchParams\(\)/);
|
||||||
assert.match(page, /Promise\.allSettled/);
|
assert.match(page, /Promise\.allSettled/);
|
||||||
|
|
||||||
assert.match(moduleSource, /publicRoutes:[\s\S]*path: "\/scheduling\/public\/:requestId\/:token"/);
|
assert.match(moduleSource, /publicRoutes:[\s\S]*path: "\/scheduling\/public\/:requestId\/:token"/);
|
||||||
assert.match(moduleSource, /SchedulingPublicPage/);
|
assert.match(moduleSource, /SchedulingPublicPage/);
|
||||||
assert.match(publicPage, /Card,[\s\S]*DismissibleAlert,[\s\S]*FormField,[\s\S]*LoadingFrame,[\s\S]*from "@govoplan\/core-webui"/);
|
assert.match(moduleSource, /path: "\/scheduling\/enrol\/:requestId\/:token"/);
|
||||||
|
assert.match(moduleSource, /SchedulingEnrollmentPage/);
|
||||||
|
assert.match(publicPage, /Card,[\s\S]*DismissibleAlert,[\s\S]*DocumentationHelpLink,[\s\S]*FormField,[\s\S]*LoadingFrame,[\s\S]*PasswordField,[\s\S]*from "@govoplan\/core-webui"/);
|
||||||
|
assert.match(publicPage, /<PasswordField[\s\S]*autoComplete="current-password"/);
|
||||||
|
assert.doesNotMatch(publicPage, /<input[\s\S]{0,120}type="password"/);
|
||||||
|
assert.match(publicPage, /topicId: "scheduling\.find-and-decide-meeting-time"/);
|
||||||
|
assert.match(publicPage, /disabledReason=\{saving \? I18N\.saving/);
|
||||||
assert.match(publicPage, /getPublicSchedulingParticipation\(settings, requestId, token, \{\}\)/);
|
assert.match(publicPage, /getPublicSchedulingParticipation\(settings, requestId, token, \{\}\)/);
|
||||||
assert.match(publicPage, /applySchedulingAvailabilityChoice\(/);
|
assert.match(publicPage, /applySchedulingAvailabilityChoice\(/);
|
||||||
assert.match(publicPage, /option_revision: slot\.revision/);
|
assert.match(publicPage, /option_revision: slot\.revision/);
|
||||||
@@ -157,4 +188,17 @@ assert.match(publicPage, /idempotency_key: newIdempotencyKey\(\)/);
|
|||||||
assert.doesNotMatch(publicPage, /window\.(?:alert|confirm)\(/);
|
assert.doesNotMatch(publicPage, /window\.(?:alert|confirm)\(/);
|
||||||
assert.doesNotMatch(publicPage, /(?:localStorage|sessionStorage).*token|token.*(?:localStorage|sessionStorage)/);
|
assert.doesNotMatch(publicPage, /(?:localStorage|sessionStorage).*token|token.*(?:localStorage|sessionStorage)/);
|
||||||
|
|
||||||
|
assert.match(enrollmentPage, /submitAuthenticatedSchedulingEnrollment/);
|
||||||
|
assert.match(enrollmentPage, /submitPublicSchedulingEnrollment/);
|
||||||
|
assert.match(enrollmentPage, /bind_account_confirmed: true/);
|
||||||
|
assert.match(enrollmentPage, /participant_proof:/);
|
||||||
|
assert.match(enrollmentPage, /topicId: "scheduling\.public-self-enrollment"/);
|
||||||
|
assert.doesNotMatch(enrollmentPage, /window\.(?:alert|confirm)\(/);
|
||||||
|
assert.doesNotMatch(enrollmentPage, /(?:localStorage|sessionStorage).*(?:token|proof)|(?:token|proof).*(?:localStorage|sessionStorage)/);
|
||||||
|
|
||||||
|
assert.match(widget, /DocumentationHelpLink/);
|
||||||
|
assert.match(widget, /to: `\/scheduling\?request_id=\$\{encodeURIComponent\(request\.id\)\}`/);
|
||||||
|
assert.match(widget, /label=\{request\.status === "collecting" \? I18N\.open : I18N\.draft\}/);
|
||||||
|
assert.doesNotMatch(widget, /Loading scheduling requests|Open scheduling|No scheduling requests are awaiting responses/);
|
||||||
|
|
||||||
console.log("Scheduling pages satisfy the two-pane editor, public response, and policy contracts.");
|
console.log("Scheduling pages satisfy the two-pane editor, public response, and policy contracts.");
|
||||||
|
|||||||
@@ -264,6 +264,82 @@ export type SchedulingPublicParticipationSubmitPayload = SchedulingPublicPartici
|
|||||||
idempotency_key?: string;
|
idempotency_key?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type SchedulingEnrollmentLink = {
|
||||||
|
id: string;
|
||||||
|
request_id: string;
|
||||||
|
status: "active" | "expired" | "revoked" | "exhausted";
|
||||||
|
expires_at: string;
|
||||||
|
max_enrollments: number;
|
||||||
|
enrollment_count: number;
|
||||||
|
allow_anonymous: boolean;
|
||||||
|
allow_authenticated: boolean;
|
||||||
|
created_at: string;
|
||||||
|
revoked_at?: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SchedulingEnrollmentLinkListResponse = { links: SchedulingEnrollmentLink[] };
|
||||||
|
|
||||||
|
export type SchedulingEnrollmentLinkActionResponse = {
|
||||||
|
link: SchedulingEnrollmentLink;
|
||||||
|
action_url?: string | null;
|
||||||
|
replayed: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SchedulingEnrollmentLinkCreatePayload = {
|
||||||
|
expires_at: string;
|
||||||
|
max_enrollments: number;
|
||||||
|
allow_anonymous: boolean;
|
||||||
|
allow_authenticated: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SchedulingPublicEnrollmentResponse = {
|
||||||
|
request_id: string;
|
||||||
|
link_id: string;
|
||||||
|
title: string;
|
||||||
|
description?: string | null;
|
||||||
|
location?: string | null;
|
||||||
|
timezone: string;
|
||||||
|
status: SchedulingStatus;
|
||||||
|
deadline_at?: string | null;
|
||||||
|
enrollment_expires_at: string;
|
||||||
|
enrollment_remaining: number;
|
||||||
|
display_name_required: boolean;
|
||||||
|
participant_email_required: boolean;
|
||||||
|
anonymous_allowed: boolean;
|
||||||
|
authenticated_allowed: boolean;
|
||||||
|
anonymous_password_required: boolean;
|
||||||
|
single_choice: boolean;
|
||||||
|
max_participants_per_option: number | null;
|
||||||
|
allow_maybe: boolean;
|
||||||
|
allow_comments: boolean;
|
||||||
|
allow_participant_updates: boolean;
|
||||||
|
enrolled: boolean;
|
||||||
|
account_bound: boolean;
|
||||||
|
has_response: boolean;
|
||||||
|
submitted_at?: string | null;
|
||||||
|
answers: Array<{ slot_id: string; value: SchedulingAvailabilityValue }>;
|
||||||
|
comment?: string | null;
|
||||||
|
replayed: boolean;
|
||||||
|
slots: SchedulingPublicCandidateSlot[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SchedulingPublicEnrollmentSubmitPayload = SchedulingAvailabilityPayload & {
|
||||||
|
display_name: string;
|
||||||
|
email?: string | null;
|
||||||
|
password?: string | null;
|
||||||
|
participant_proof: string;
|
||||||
|
idempotency_key: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SchedulingAuthenticatedEnrollmentSubmitPayload = SchedulingAvailabilityPayload & {
|
||||||
|
display_name: string;
|
||||||
|
email?: string | null;
|
||||||
|
password?: string | null;
|
||||||
|
bind_account_confirmed: boolean;
|
||||||
|
participant_proof?: string | null;
|
||||||
|
idempotency_key: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type SchedulingCalendarActionResponse = {
|
export type SchedulingCalendarActionResponse = {
|
||||||
request: SchedulingRequest;
|
request: SchedulingRequest;
|
||||||
created_event_ids: string[];
|
created_event_ids: string[];
|
||||||
@@ -423,6 +499,79 @@ export function submitPublicSchedulingParticipation(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function listSchedulingEnrollmentLinks(
|
||||||
|
settings: ApiSettings,
|
||||||
|
requestId: string
|
||||||
|
): Promise<SchedulingEnrollmentLinkListResponse> {
|
||||||
|
return apiFetch<SchedulingEnrollmentLinkListResponse>(
|
||||||
|
settings,
|
||||||
|
`/api/v1/scheduling/requests/${requestId}/enrollment-links`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createSchedulingEnrollmentLink(
|
||||||
|
settings: ApiSettings,
|
||||||
|
requestId: string,
|
||||||
|
payload: SchedulingEnrollmentLinkCreatePayload
|
||||||
|
): Promise<SchedulingEnrollmentLinkActionResponse> {
|
||||||
|
return apiFetch<SchedulingEnrollmentLinkActionResponse>(
|
||||||
|
settings,
|
||||||
|
`/api/v1/scheduling/requests/${requestId}/enrollment-links`,
|
||||||
|
json(payload)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function revokeSchedulingEnrollmentLink(
|
||||||
|
settings: ApiSettings,
|
||||||
|
requestId: string,
|
||||||
|
linkId: string
|
||||||
|
): Promise<SchedulingEnrollmentLinkActionResponse> {
|
||||||
|
return apiFetch<SchedulingEnrollmentLinkActionResponse>(
|
||||||
|
settings,
|
||||||
|
`/api/v1/scheduling/requests/${requestId}/enrollment-links/${linkId}`,
|
||||||
|
{ method: "DELETE" }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPublicSchedulingEnrollment(
|
||||||
|
settings: ApiSettings,
|
||||||
|
requestId: string,
|
||||||
|
token: string,
|
||||||
|
password?: string
|
||||||
|
): Promise<SchedulingPublicEnrollmentResponse> {
|
||||||
|
return apiFetch<SchedulingPublicEnrollmentResponse>(
|
||||||
|
settings,
|
||||||
|
`/api/v1/scheduling/public-enrollment/${encodeURIComponent(requestId)}/${encodeURIComponent(token)}`,
|
||||||
|
json({ password: password || null })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function submitPublicSchedulingEnrollment(
|
||||||
|
settings: ApiSettings,
|
||||||
|
requestId: string,
|
||||||
|
token: string,
|
||||||
|
payload: SchedulingPublicEnrollmentSubmitPayload
|
||||||
|
): Promise<SchedulingPublicEnrollmentResponse> {
|
||||||
|
return apiFetch<SchedulingPublicEnrollmentResponse>(
|
||||||
|
settings,
|
||||||
|
`/api/v1/scheduling/public-enrollment/${encodeURIComponent(requestId)}/${encodeURIComponent(token)}/responses`,
|
||||||
|
json(payload)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function submitAuthenticatedSchedulingEnrollment(
|
||||||
|
settings: ApiSettings,
|
||||||
|
requestId: string,
|
||||||
|
token: string,
|
||||||
|
payload: SchedulingAuthenticatedEnrollmentSubmitPayload
|
||||||
|
): Promise<SchedulingPublicEnrollmentResponse> {
|
||||||
|
return apiFetch<SchedulingPublicEnrollmentResponse>(
|
||||||
|
settings,
|
||||||
|
`/api/v1/scheduling/public-enrollment/${encodeURIComponent(requestId)}/${encodeURIComponent(token)}/authenticated-responses`,
|
||||||
|
json(payload)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function openSchedulingRequest(settings: ApiSettings, requestId: string): Promise<SchedulingStatusResponse> {
|
export function openSchedulingRequest(settings: ApiSettings, requestId: string): Promise<SchedulingStatusResponse> {
|
||||||
return apiFetch<SchedulingStatusResponse>(settings, `/api/v1/scheduling/requests/${requestId}/open`, json({}));
|
return apiFetch<SchedulingStatusResponse>(settings, `/api/v1/scheduling/requests/${requestId}/open`, json({}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,301 @@
|
|||||||
|
import { useEffect, useMemo, useState, type FormEvent } from "react";
|
||||||
|
import { Link, useParams } from "react-router";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Card,
|
||||||
|
DismissibleAlert,
|
||||||
|
DocumentationHelpLink,
|
||||||
|
FormField,
|
||||||
|
FormGrid,
|
||||||
|
LoadingFrame,
|
||||||
|
PasswordField,
|
||||||
|
formatDateTime,
|
||||||
|
type ApiSettings,
|
||||||
|
type AuthInfo
|
||||||
|
} from "@govoplan/core-webui";
|
||||||
|
import {
|
||||||
|
getPublicSchedulingEnrollment,
|
||||||
|
submitAuthenticatedSchedulingEnrollment,
|
||||||
|
submitPublicSchedulingEnrollment,
|
||||||
|
type SchedulingAvailabilityValue,
|
||||||
|
type SchedulingPublicEnrollmentResponse
|
||||||
|
} from "../../api/scheduling";
|
||||||
|
import { applySchedulingAvailabilityChoice } from "./schedulingViewModel";
|
||||||
|
|
||||||
|
type SchedulingEnrollmentPageProps = {
|
||||||
|
settings: ApiSettings;
|
||||||
|
auth: AuthInfo | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
const I18N = {
|
||||||
|
access: "i18n:govoplan-scheduling.self_enrollment.access",
|
||||||
|
answerRequired: "i18n:govoplan-scheduling.choose_availability_for_at_least_one_candidate_slot.28d2111f",
|
||||||
|
available: "i18n:govoplan-scheduling.available.7c62a142",
|
||||||
|
back: "i18n:govoplan-scheduling.open_in_scheduling.48df1541",
|
||||||
|
bindAccount: "i18n:govoplan-scheduling.self_enrollment.bind_account",
|
||||||
|
bindHelp: "i18n:govoplan-scheduling.self_enrollment.bind_help",
|
||||||
|
claimAnonymous: "i18n:govoplan-scheduling.self_enrollment.claim_anonymous",
|
||||||
|
comment: "i18n:govoplan-scheduling.comment.d03495b1",
|
||||||
|
deadline: "i18n:govoplan-scheduling.response_deadline.7fd9e3aa",
|
||||||
|
displayName: "i18n:govoplan-scheduling.name.709a2322",
|
||||||
|
email: "i18n:govoplan-scheduling.participant_email.2cadfd9e",
|
||||||
|
expires: "i18n:govoplan-scheduling.self_enrollment.expires",
|
||||||
|
invalid: "i18n:govoplan-scheduling.self_enrollment.invalid",
|
||||||
|
loading: "i18n:govoplan-scheduling.loading_scheduling_request.43c39c1b",
|
||||||
|
maybe: "i18n:govoplan-scheduling.maybe.56dd8d0b",
|
||||||
|
participantDetails: "i18n:govoplan-scheduling.self_enrollment.participant_details",
|
||||||
|
password: "i18n:govoplan-scheduling.guest_password.94545e82",
|
||||||
|
proof: "i18n:govoplan-scheduling.self_enrollment.proof",
|
||||||
|
proofHelp: "i18n:govoplan-scheduling.self_enrollment.proof_help",
|
||||||
|
remaining: "i18n:govoplan-scheduling.self_enrollment.remaining",
|
||||||
|
response: "i18n:govoplan-scheduling.your_availability.f86c8215",
|
||||||
|
saved: "i18n:govoplan-scheduling.self_enrollment.saved",
|
||||||
|
saving: "i18n:govoplan-scheduling.saving.56a2285c",
|
||||||
|
submit: "i18n:govoplan-scheduling.self_enrollment.submit",
|
||||||
|
unavailable: "i18n:govoplan-scheduling.unavailable.2c9c1f79"
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
function newSecret(prefix: string): string {
|
||||||
|
if (typeof crypto !== "undefined" && "randomUUID" in crypto) {
|
||||||
|
return `${prefix}-${crypto.randomUUID()}`;
|
||||||
|
}
|
||||||
|
return `${prefix}-${Date.now()}-${Math.random().toString(16).slice(2)}-${Math.random().toString(16).slice(2)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function initialAvailability(response: SchedulingPublicEnrollmentResponse) {
|
||||||
|
const previous = new Map(response.answers.map((answer) => [answer.slot_id, answer.value]));
|
||||||
|
return Object.fromEntries(response.slots.map((slot) => [slot.id, previous.get(slot.id) ?? ""])) as Record<
|
||||||
|
string,
|
||||||
|
SchedulingAvailabilityValue | ""
|
||||||
|
>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function SchedulingEnrollmentPage({ settings, auth }: SchedulingEnrollmentPageProps) {
|
||||||
|
const { requestId = "", token = "" } = useParams();
|
||||||
|
const [enrollment, setEnrollment] = useState<SchedulingPublicEnrollmentResponse | null>(null);
|
||||||
|
const [displayName, setDisplayName] = useState(auth?.user.display_name ?? "");
|
||||||
|
const [email, setEmail] = useState(auth?.user.email ?? "");
|
||||||
|
const [password, setPassword] = useState("");
|
||||||
|
const [proof, setProof] = useState(() => newSecret("scheduling-proof"));
|
||||||
|
const [bindAccount, setBindAccount] = useState(Boolean(auth));
|
||||||
|
const [claimAnonymous, setClaimAnonymous] = useState(false);
|
||||||
|
const [availability, setAvailability] = useState<Record<string, SchedulingAvailabilityValue | "">>({});
|
||||||
|
const [comment, setComment] = useState("");
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [saving, setSaving] = useState(false);
|
||||||
|
const [needsAccess, setNeedsAccess] = useState(false);
|
||||||
|
const [error, setError] = useState("");
|
||||||
|
const [success, setSuccess] = useState("");
|
||||||
|
|
||||||
|
const slotIds = useMemo(() => enrollment?.slots.map((slot) => slot.id) ?? [], [enrollment]);
|
||||||
|
|
||||||
|
function applyResponse(next: SchedulingPublicEnrollmentResponse) {
|
||||||
|
setEnrollment(next);
|
||||||
|
setAvailability(initialAvailability(next));
|
||||||
|
setComment(next.comment ?? "");
|
||||||
|
setNeedsAccess(false);
|
||||||
|
setError("");
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let cancelled = false;
|
||||||
|
setLoading(true);
|
||||||
|
void getPublicSchedulingEnrollment(settings, requestId, token)
|
||||||
|
.then((next) => {
|
||||||
|
if (!cancelled) applyResponse(next);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
if (!cancelled) setNeedsAccess(true);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
if (!cancelled) setLoading(false);
|
||||||
|
});
|
||||||
|
return () => {
|
||||||
|
cancelled = true;
|
||||||
|
};
|
||||||
|
}, [requestId, settings.apiBaseUrl, settings.apiKey, token]);
|
||||||
|
|
||||||
|
async function openEnrollment(event: FormEvent) {
|
||||||
|
event.preventDefault();
|
||||||
|
setLoading(true);
|
||||||
|
setError("");
|
||||||
|
try {
|
||||||
|
applyResponse(await getPublicSchedulingEnrollment(settings, requestId, token, password));
|
||||||
|
} catch {
|
||||||
|
setError(I18N.invalid);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submit(event: FormEvent) {
|
||||||
|
event.preventDefault();
|
||||||
|
if (!enrollment || !enrollment.slots.some((slot) => availability[slot.id])) {
|
||||||
|
setError(I18N.answerRequired);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setSaving(true);
|
||||||
|
setError("");
|
||||||
|
setSuccess("");
|
||||||
|
const common = {
|
||||||
|
display_name: displayName.trim(),
|
||||||
|
email: email.trim() || null,
|
||||||
|
password: password || null,
|
||||||
|
answers: enrollment.slots
|
||||||
|
.filter((slot) => availability[slot.id])
|
||||||
|
.map((slot) => ({
|
||||||
|
slot_id: slot.id,
|
||||||
|
value: availability[slot.id] as SchedulingAvailabilityValue,
|
||||||
|
option_revision: slot.revision
|
||||||
|
})),
|
||||||
|
comment: enrollment.allow_comments ? comment.trim() || null : null,
|
||||||
|
idempotency_key: newSecret("scheduling-enrollment")
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const next = auth && bindAccount
|
||||||
|
? await submitAuthenticatedSchedulingEnrollment(settings, requestId, token, {
|
||||||
|
...common,
|
||||||
|
bind_account_confirmed: true,
|
||||||
|
participant_proof: claimAnonymous || (enrollment.enrolled && !enrollment.account_bound) ? proof : null
|
||||||
|
})
|
||||||
|
: await submitPublicSchedulingEnrollment(settings, requestId, token, {
|
||||||
|
...common,
|
||||||
|
participant_proof: proof
|
||||||
|
});
|
||||||
|
applyResponse(next);
|
||||||
|
setSuccess(I18N.saved);
|
||||||
|
} catch {
|
||||||
|
setError(I18N.invalid);
|
||||||
|
} finally {
|
||||||
|
setSaving(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<main className="scheduling-public-page">
|
||||||
|
<LoadingFrame loading={loading} label={I18N.loading}>
|
||||||
|
{auth ? (
|
||||||
|
<div className="scheduling-public-deep-link">
|
||||||
|
<Link className="btn btn-secondary" to={`/scheduling?request_id=${encodeURIComponent(requestId)}`}>
|
||||||
|
{I18N.back}
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{needsAccess && !enrollment ? (
|
||||||
|
<Card title={I18N.access}>
|
||||||
|
<form className="scheduling-public-access-form" onSubmit={openEnrollment}>
|
||||||
|
{error ? <DismissibleAlert tone="danger">{error}</DismissibleAlert> : null}
|
||||||
|
<FormField label={I18N.password}>
|
||||||
|
<PasswordField
|
||||||
|
autoComplete="current-password"
|
||||||
|
value={password}
|
||||||
|
onValueChange={setPassword} />
|
||||||
|
</FormField>
|
||||||
|
<div className="scheduling-public-actions">
|
||||||
|
<Button type="submit" variant="primary" disabled={loading}>{I18N.access}</Button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</Card>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{enrollment ? (
|
||||||
|
<form className="scheduling-public-content" onSubmit={submit}>
|
||||||
|
<Card
|
||||||
|
title={enrollment.title}
|
||||||
|
actions={<DocumentationHelpLink reference={{
|
||||||
|
topicId: "scheduling.public-self-enrollment",
|
||||||
|
documentationType: "user"
|
||||||
|
}} />}>
|
||||||
|
{enrollment.description ? <p>{enrollment.description}</p> : null}
|
||||||
|
<dl className="scheduling-public-summary">
|
||||||
|
{enrollment.deadline_at ? <><dt>{I18N.deadline}</dt><dd>{formatDateTime(enrollment.deadline_at)}</dd></> : null}
|
||||||
|
<dt>{I18N.expires}</dt><dd>{formatDateTime(enrollment.enrollment_expires_at)}</dd>
|
||||||
|
<dt>{I18N.remaining}</dt><dd>{enrollment.enrollment_remaining}</dd>
|
||||||
|
</dl>
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
{error ? <DismissibleAlert tone="danger">{error}</DismissibleAlert> : null}
|
||||||
|
{success ? <DismissibleAlert tone="success">{success}</DismissibleAlert> : null}
|
||||||
|
|
||||||
|
<Card title={I18N.participantDetails}>
|
||||||
|
<FormGrid columns={2} collapseAt="standard" className="">
|
||||||
|
<FormField label={I18N.displayName}>
|
||||||
|
<input required maxLength={500} value={displayName} onChange={(event) => setDisplayName(event.target.value)} />
|
||||||
|
</FormField>
|
||||||
|
<FormField label={I18N.email}>
|
||||||
|
<input type="email" required={enrollment.participant_email_required} maxLength={320} value={email} onChange={(event) => setEmail(event.target.value)} />
|
||||||
|
</FormField>
|
||||||
|
</FormGrid>
|
||||||
|
{auth && enrollment.authenticated_allowed ? (
|
||||||
|
<>
|
||||||
|
<label className="scheduling-enrollment-confirmation">
|
||||||
|
<input type="checkbox" checked={bindAccount} onChange={(event) => setBindAccount(event.target.checked)} />
|
||||||
|
<span><strong>{I18N.bindAccount}</strong><small>{I18N.bindHelp}</small></span>
|
||||||
|
</label>
|
||||||
|
{bindAccount ? (
|
||||||
|
<label className="scheduling-enrollment-confirmation">
|
||||||
|
<input type="checkbox" checked={claimAnonymous} onChange={(event) => setClaimAnonymous(event.target.checked)} />
|
||||||
|
<span>{I18N.claimAnonymous}</span>
|
||||||
|
</label>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
|
{((!auth || !bindAccount) && enrollment.anonymous_allowed) || claimAnonymous ? (
|
||||||
|
<FormField label={I18N.proof} help={I18N.proofHelp}>
|
||||||
|
<PasswordField
|
||||||
|
autoComplete="off"
|
||||||
|
value={proof}
|
||||||
|
onValueChange={setProof} />
|
||||||
|
</FormField>
|
||||||
|
) : null}
|
||||||
|
</Card>
|
||||||
|
|
||||||
|
<Card title={I18N.response}>
|
||||||
|
<div className="scheduling-public-slots">
|
||||||
|
{enrollment.slots.map((slot) => (
|
||||||
|
<fieldset className="scheduling-public-slot" key={slot.id} disabled={saving}>
|
||||||
|
<legend>{slot.label}</legend>
|
||||||
|
<p>{formatDateTime(slot.start_at)} – {formatDateTime(slot.end_at)}</p>
|
||||||
|
<div className="scheduling-public-choice-group">
|
||||||
|
{([
|
||||||
|
["available", I18N.available],
|
||||||
|
...(enrollment.allow_maybe ? [["maybe", I18N.maybe] as const] : []),
|
||||||
|
["unavailable", I18N.unavailable]
|
||||||
|
] as Array<[SchedulingAvailabilityValue, string]>).map(([value, label]) => (
|
||||||
|
<label key={value}>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name={`slot-${slot.id}`}
|
||||||
|
checked={availability[slot.id] === value}
|
||||||
|
onChange={() => setAvailability((current) => applySchedulingAvailabilityChoice(
|
||||||
|
slotIds,
|
||||||
|
current,
|
||||||
|
slot.id,
|
||||||
|
value,
|
||||||
|
enrollment.single_choice
|
||||||
|
))} />
|
||||||
|
<span>{label}</span>
|
||||||
|
</label>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
{enrollment.allow_comments ? (
|
||||||
|
<FormField label={I18N.comment}>
|
||||||
|
<textarea rows={4} maxLength={4000} value={comment} onChange={(event) => setComment(event.target.value)} />
|
||||||
|
</FormField>
|
||||||
|
) : null}
|
||||||
|
<div className="scheduling-public-actions">
|
||||||
|
<Button type="submit" variant="primary" disabled={saving || !displayName.trim()}>
|
||||||
|
{saving ? I18N.saving : I18N.submit}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
</form>
|
||||||
|
) : null}
|
||||||
|
</LoadingFrame>
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import { MetricGrid } from "@govoplan/core-webui";
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState, type FormEvent } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState, type FormEvent } from "react";
|
||||||
import { useSearchParams } from "react-router-dom";
|
import { useSearchParams } from "react-router";
|
||||||
import {
|
import {
|
||||||
Bell,
|
Bell,
|
||||||
CalendarCheck,
|
CalendarCheck,
|
||||||
@@ -14,7 +15,8 @@ import {
|
|||||||
Send,
|
Send,
|
||||||
XCircle
|
XCircle
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import {
|
import { ContentGrid, FormGrid,
|
||||||
|
ActionBlockerHint,
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
ConfirmDialog,
|
ConfirmDialog,
|
||||||
@@ -22,9 +24,9 @@ import {
|
|||||||
DataGridRowActions,
|
DataGridRowActions,
|
||||||
DateTimeField,
|
DateTimeField,
|
||||||
DismissibleAlert,
|
DismissibleAlert,
|
||||||
|
DocumentationHelpLink,
|
||||||
FormField,
|
FormField,
|
||||||
MetricCard,
|
MetricCard,
|
||||||
IconButton,
|
|
||||||
PageTitle,
|
PageTitle,
|
||||||
PasswordField,
|
PasswordField,
|
||||||
PeoplePicker,
|
PeoplePicker,
|
||||||
@@ -34,6 +36,9 @@ import {
|
|||||||
TableActionGroup,
|
TableActionGroup,
|
||||||
ToggleSwitch,
|
ToggleSwitch,
|
||||||
StatusBadge,
|
StatusBadge,
|
||||||
|
StageRail,
|
||||||
|
WorkspaceActionBar,
|
||||||
|
WorkspaceFrame,
|
||||||
hasScope,
|
hasScope,
|
||||||
i18nMessage,
|
i18nMessage,
|
||||||
isApiError,
|
isApiError,
|
||||||
@@ -53,6 +58,7 @@ import {
|
|||||||
closeSchedulingRequest,
|
closeSchedulingRequest,
|
||||||
createSchedulingCalendarEvent,
|
createSchedulingCalendarEvent,
|
||||||
createSchedulingHolds,
|
createSchedulingHolds,
|
||||||
|
createSchedulingEnrollmentLink,
|
||||||
createSchedulingNotifications,
|
createSchedulingNotifications,
|
||||||
createSchedulingRequest,
|
createSchedulingRequest,
|
||||||
decideSchedulingRequest,
|
decideSchedulingRequest,
|
||||||
@@ -60,9 +66,11 @@ import {
|
|||||||
getSchedulingAvailabilityResponse,
|
getSchedulingAvailabilityResponse,
|
||||||
issueSchedulingParticipantInvitation,
|
issueSchedulingParticipantInvitation,
|
||||||
listSchedulingNotifications,
|
listSchedulingNotifications,
|
||||||
|
listSchedulingEnrollmentLinks,
|
||||||
listSchedulingRequests,
|
listSchedulingRequests,
|
||||||
openSchedulingRequest,
|
openSchedulingRequest,
|
||||||
revokeSchedulingParticipantInvitation,
|
revokeSchedulingParticipantInvitation,
|
||||||
|
revokeSchedulingEnrollmentLink,
|
||||||
searchSchedulingPeople,
|
searchSchedulingPeople,
|
||||||
schedulingSummary,
|
schedulingSummary,
|
||||||
submitSchedulingAvailability,
|
submitSchedulingAvailability,
|
||||||
@@ -70,6 +78,7 @@ import {
|
|||||||
type SchedulingCandidateSlot,
|
type SchedulingCandidateSlot,
|
||||||
type SchedulingAvailabilityValue,
|
type SchedulingAvailabilityValue,
|
||||||
type SchedulingInvitationActionResponse,
|
type SchedulingInvitationActionResponse,
|
||||||
|
type SchedulingEnrollmentLink,
|
||||||
type SchedulingNotification,
|
type SchedulingNotification,
|
||||||
type SchedulingParticipant,
|
type SchedulingParticipant,
|
||||||
type SchedulingPollOptionResult,
|
type SchedulingPollOptionResult,
|
||||||
@@ -84,12 +93,14 @@ import {
|
|||||||
participantDraftsFromPicker,
|
participantDraftsFromPicker,
|
||||||
participantPayload,
|
participantPayload,
|
||||||
schedulingInvitationActionBlocks,
|
schedulingInvitationActionBlocks,
|
||||||
|
schedulingLifecycleStages,
|
||||||
schedulingPublicInvitationUrl,
|
schedulingPublicInvitationUrl,
|
||||||
schedulingRelevantTimestamp,
|
schedulingRelevantTimestamp,
|
||||||
schedulingRequestIsOwned,
|
schedulingRequestIsOwned,
|
||||||
schedulingSortPhase,
|
schedulingSortPhase,
|
||||||
type SchedulingActor,
|
type SchedulingActor,
|
||||||
type SchedulingInvitationActionBlock,
|
type SchedulingInvitationActionBlock,
|
||||||
|
type SchedulingLifecycleStageState,
|
||||||
type SchedulingParticipantDraft,
|
type SchedulingParticipantDraft,
|
||||||
type SchedulingRequestGroups
|
type SchedulingRequestGroups
|
||||||
} from "./schedulingViewModel";
|
} from "./schedulingViewModel";
|
||||||
@@ -111,6 +122,19 @@ type InvitationRevokeTarget = {
|
|||||||
requestId: string;
|
requestId: string;
|
||||||
participant: SchedulingParticipant;
|
participant: SchedulingParticipant;
|
||||||
};
|
};
|
||||||
|
type ConsequentialAction = {
|
||||||
|
kind: "close" | "reminder" | "holds" | "final-event";
|
||||||
|
requestId: string;
|
||||||
|
};
|
||||||
|
type DecisionTarget = {
|
||||||
|
requestId: string;
|
||||||
|
slot: SchedulingCandidateSlot;
|
||||||
|
};
|
||||||
|
type SchedulingCalendarCleanup = {
|
||||||
|
status: "accepted" | "retry_required";
|
||||||
|
targetState: string | null;
|
||||||
|
pendingCount: number;
|
||||||
|
};
|
||||||
|
|
||||||
const I18N = {
|
const I18N = {
|
||||||
actions: "i18n:govoplan-core.actions.c3cd636a",
|
actions: "i18n:govoplan-core.actions.c3cd636a",
|
||||||
@@ -128,8 +152,12 @@ const I18N = {
|
|||||||
configuredCalendar: "i18n:govoplan-scheduling.configured_calendar.e2e8ebd5",
|
configuredCalendar: "i18n:govoplan-scheduling.configured_calendar.e2e8ebd5",
|
||||||
calendarDescription: "i18n:govoplan-scheduling.use_a_calendar_for_availability_checks_tentative_holds_a.20ccc1fa",
|
calendarDescription: "i18n:govoplan-scheduling.use_a_calendar_for_availability_checks_tentative_holds_a.20ccc1fa",
|
||||||
finalEventLabel: "i18n:govoplan-scheduling.create_calendar_event.0b87cfcf",
|
finalEventLabel: "i18n:govoplan-scheduling.create_calendar_event.0b87cfcf",
|
||||||
|
finalEventEffect: "i18n:govoplan-scheduling.the_final_event_is_created_only_for_the_selected_slot.e3621252",
|
||||||
calendarIntegration: "i18n:govoplan-scheduling.calendar_integration.181ad18b",
|
calendarIntegration: "i18n:govoplan-scheduling.calendar_integration.181ad18b",
|
||||||
calendarUnavailable: "i18n:govoplan-scheduling.calendar_integration_requires_the_calendar_module_plus_c.f892cb1e",
|
calendarUnavailable: "i18n:govoplan-scheduling.calendar_integration_requires_the_calendar_module_plus_c.f892cb1e",
|
||||||
|
calendarRequiredAction: "i18n:govoplan-scheduling.enable_calendar_and_grant_calendar_availability_and_event_access.f1a20106",
|
||||||
|
calendarCleanupRetryTitle: "i18n:govoplan-scheduling.calendar_cleanup_retry_title",
|
||||||
|
calendarCleanupRetryMessage: "i18n:govoplan-scheduling.calendar_cleanup_retry_message",
|
||||||
candidateAvailability: "i18n:govoplan-scheduling.candidate_availability.9541c4b5",
|
candidateAvailability: "i18n:govoplan-scheduling.candidate_availability.9541c4b5",
|
||||||
candidateSlots: "i18n:govoplan-scheduling.candidate_slots.c414946b",
|
candidateSlots: "i18n:govoplan-scheduling.candidate_slots.c414946b",
|
||||||
cancellationNoticeExpired: "i18n:govoplan-scheduling.the_cancellation_notice_has_expired_a_new_link_cannot_be_issued.9c6ccc7c",
|
cancellationNoticeExpired: "i18n:govoplan-scheduling.the_cancellation_notice_has_expired_a_new_link_cannot_be_issued.9c6ccc7c",
|
||||||
@@ -137,11 +165,14 @@ const I18N = {
|
|||||||
chooseAvailability: "i18n:govoplan-scheduling.choose_availability.ac95b8f6",
|
chooseAvailability: "i18n:govoplan-scheduling.choose_availability.ac95b8f6",
|
||||||
clipboardUnavailable: "i18n:govoplan-scheduling.the_invitation_link_could_not_be_copied_check_browser_clipboard_permissions_and_try_again.a8b17cbc",
|
clipboardUnavailable: "i18n:govoplan-scheduling.the_invitation_link_could_not_be_copied_check_browser_clipboard_permissions_and_try_again.a8b17cbc",
|
||||||
closePoll: "i18n:govoplan-scheduling.close_poll.a6a18916",
|
closePoll: "i18n:govoplan-scheduling.close_poll.a6a18916",
|
||||||
|
closePollEffect: "i18n:govoplan-scheduling.close_stops_accepting_new_availability_responses.a1d57519",
|
||||||
closed: "i18n:govoplan-scheduling.closed.88d86b77",
|
closed: "i18n:govoplan-scheduling.closed.88d86b77",
|
||||||
copyInvitationLink: "i18n:govoplan-scheduling.copy_a_fresh_invitation_link_for_value0.e3799c79",
|
copyInvitationLink: "i18n:govoplan-scheduling.copy_a_fresh_invitation_link_for_value0.e3799c79",
|
||||||
description: "i18n:govoplan-scheduling.description.55f8ebc8",
|
description: "i18n:govoplan-scheduling.description.55f8ebc8",
|
||||||
determined: "i18n:govoplan-scheduling.determined.9f23293d",
|
determined: "i18n:govoplan-scheduling.determined.9f23293d",
|
||||||
decideUnavailable: "i18n:govoplan-scheduling.a_slot_can_be_selected_after_the_request_is_closed.f91ec02d",
|
decideUnavailable: "i18n:govoplan-scheduling.a_slot_can_be_selected_after_the_request_is_closed.f91ec02d",
|
||||||
|
decision: "i18n:govoplan-scheduling.decision.7f59a1f1",
|
||||||
|
decideOn: "i18n:govoplan-scheduling.decide_on_value.196409cd",
|
||||||
discard: "i18n:govoplan-scheduling.discard.36fff63c",
|
discard: "i18n:govoplan-scheduling.discard.36fff63c",
|
||||||
discardConfirm: "i18n:govoplan-scheduling.discard_this_unsaved_scheduling_request.4a956be2",
|
discardConfirm: "i18n:govoplan-scheduling.discard_this_unsaved_scheduling_request.4a956be2",
|
||||||
edit: "i18n:govoplan-scheduling.edit_scheduling_request.7e749c19",
|
edit: "i18n:govoplan-scheduling.edit_scheduling_request.7e749c19",
|
||||||
@@ -150,6 +181,7 @@ const I18N = {
|
|||||||
generalSettings: "i18n:govoplan-scheduling.participation_settings.8dc6f62c",
|
generalSettings: "i18n:govoplan-scheduling.participation_settings.8dc6f62c",
|
||||||
free: "i18n:govoplan-scheduling.free.75f52718",
|
free: "i18n:govoplan-scheduling.free.75f52718",
|
||||||
holds: "i18n:govoplan-scheduling.create_tentative_holds.51c4744e",
|
holds: "i18n:govoplan-scheduling.create_tentative_holds.51c4744e",
|
||||||
|
holdsEffect: "i18n:govoplan-scheduling.tentative_holds_create_one_provisional_calendar_event_pe.ff3f1884",
|
||||||
invitationDeliveryUnavailable: "i18n:govoplan-scheduling.automatic_invitation_delivery_is_unavailable_copy_the_link_instead.4e39d0b3",
|
invitationDeliveryUnavailable: "i18n:govoplan-scheduling.automatic_invitation_delivery_is_unavailable_copy_the_link_instead.4e39d0b3",
|
||||||
invitationDeliveryFailed: "i18n:govoplan-scheduling.invitation_delivery_failed_the_link_was_created_but_was_not_delivered.8db0c306",
|
invitationDeliveryFailed: "i18n:govoplan-scheduling.invitation_delivery_failed_the_link_was_created_but_was_not_delivered.8db0c306",
|
||||||
invitationDeliveryRequested: "i18n:govoplan-scheduling.invitation_delivery_requested.1aaa78ba",
|
invitationDeliveryRequested: "i18n:govoplan-scheduling.invitation_delivery_requested.1aaa78ba",
|
||||||
@@ -209,18 +241,44 @@ const I18N = {
|
|||||||
refresh: "i18n:govoplan-scheduling.refresh_requests.0a3ed7a1",
|
refresh: "i18n:govoplan-scheduling.refresh_requests.0a3ed7a1",
|
||||||
reloadInvitation: "i18n:govoplan-scheduling.reload_the_request_before_changing_this_invitation.9e685df4",
|
reloadInvitation: "i18n:govoplan-scheduling.reload_the_request_before_changing_this_invitation.9e685df4",
|
||||||
reminder: "i18n:govoplan-scheduling.send_reminder.cf5eb3bf",
|
reminder: "i18n:govoplan-scheduling.send_reminder.cf5eb3bf",
|
||||||
|
reminderEffect: "i18n:govoplan-scheduling.reminder_creates_a_notification_job_for_every_active_par.7ec68797",
|
||||||
revokeInvitation: "i18n:govoplan-scheduling.revoke_the_invitation_link_for_value0.15a9c9fa",
|
revokeInvitation: "i18n:govoplan-scheduling.revoke_the_invitation_link_for_value0.15a9c9fa",
|
||||||
revokeInvitationConfirm: "i18n:govoplan-scheduling.revoke_the_current_invitation_link_for_value0_it_will_stop_working_immediately.3cdc5817",
|
revokeInvitationConfirm: "i18n:govoplan-scheduling.revoke_the_current_invitation_link_for_value0_it_will_stop_working_immediately.3cdc5817",
|
||||||
revokeInvitationLabel: "i18n:govoplan-scheduling.revoke_invitation_link.87bf89cf",
|
revokeInvitationLabel: "i18n:govoplan-scheduling.revoke_invitation_link.87bf89cf",
|
||||||
revokeLink: "i18n:govoplan-scheduling.revoke_link.da371ee1",
|
revokeLink: "i18n:govoplan-scheduling.revoke_link.da371ee1",
|
||||||
requestFailed: "i18n:govoplan-scheduling.request_failed.9fcda32c",
|
requestFailed: "i18n:govoplan-scheduling.request_failed.9fcda32c",
|
||||||
publicPolicyUnavailable: "i18n:govoplan-scheduling.guest_links_are_not_issued_while_the_configured_participation.0794ebf0",
|
publicPolicyUnavailable: "i18n:govoplan-scheduling.guest_links_are_not_issued_while_the_configured_participation.0794ebf0",
|
||||||
|
publicPolicyRequiredAction: "i18n:govoplan-scheduling.enable_enforceable_public_participation_controls_or_keep_participation_signed_in.f1a20105",
|
||||||
policyLocked: "i18n:govoplan-scheduling.participation_controls_are_locked_after_invitation_links_are_issued.66f5a740",
|
policyLocked: "i18n:govoplan-scheduling.participation_controls_are_locked_after_invitation_links_are_issued.66f5a740",
|
||||||
requests: "i18n:govoplan-scheduling.scheduling_requests.b3c12f4d",
|
requests: "i18n:govoplan-scheduling.scheduling_requests.b3c12f4d",
|
||||||
requiresAvailabilityRead: "i18n:govoplan-scheduling.requires_calendar_availability_read_access.b48ed91b",
|
requiresAvailabilityRead: "i18n:govoplan-scheduling.requires_calendar_availability_read_access.b48ed91b",
|
||||||
requiresEventWrite: "i18n:govoplan-scheduling.requires_calendar_event_write_access.887b0763",
|
requiresEventWrite: "i18n:govoplan-scheduling.requires_calendar_event_write_access.887b0763",
|
||||||
responseRecorded: "i18n:govoplan-scheduling.your_response_has_been_recorded.b855088d",
|
responseRecorded: "i18n:govoplan-scheduling.your_response_has_been_recorded.b855088d",
|
||||||
responseReplace: "i18n:govoplan-scheduling.the_response_replaces_your_previous_availability_choices.74c16d53",
|
responseReplace: "i18n:govoplan-scheduling.the_response_replaces_your_previous_availability_choices.74c16d53",
|
||||||
|
selfEnrollmentAllowAnonymous: "i18n:govoplan-scheduling.self_enrollment.allow_anonymous",
|
||||||
|
selfEnrollmentAllowAuthenticated: "i18n:govoplan-scheduling.self_enrollment.allow_authenticated",
|
||||||
|
selfEnrollmentClipboardFailed: "i18n:govoplan-scheduling.self_enrollment.clipboard_failed",
|
||||||
|
selfEnrollmentCopied: "i18n:govoplan-scheduling.self_enrollment.copied",
|
||||||
|
selfEnrollmentExpiresAt: "i18n:govoplan-scheduling.self_enrollment.expires_at",
|
||||||
|
selfEnrollmentIssueCopy: "i18n:govoplan-scheduling.self_enrollment.issue_copy",
|
||||||
|
selfEnrollmentIssueFailed: "i18n:govoplan-scheduling.self_enrollment.issue_failed",
|
||||||
|
selfEnrollmentLinks: "i18n:govoplan-scheduling.self_enrollment.links",
|
||||||
|
selfEnrollmentLinksHelp: "i18n:govoplan-scheduling.self_enrollment.links_help",
|
||||||
|
selfEnrollmentLoadingLinks: "i18n:govoplan-scheduling.self_enrollment.loading_links",
|
||||||
|
selfEnrollmentLoadFailed: "i18n:govoplan-scheduling.self_enrollment.load_failed",
|
||||||
|
selfEnrollmentMaximum: "i18n:govoplan-scheduling.self_enrollment.maximum",
|
||||||
|
selfEnrollmentModeAnonymous: "i18n:govoplan-scheduling.self_enrollment.mode_anonymous",
|
||||||
|
selfEnrollmentModeAuthenticated: "i18n:govoplan-scheduling.self_enrollment.mode_authenticated",
|
||||||
|
selfEnrollmentNoLinks: "i18n:govoplan-scheduling.self_enrollment.no_links",
|
||||||
|
selfEnrollmentOpenFirst: "i18n:govoplan-scheduling.self_enrollment.open_first",
|
||||||
|
selfEnrollmentRevokeFailed: "i18n:govoplan-scheduling.self_enrollment.revoke_failed",
|
||||||
|
selfEnrollmentRevoked: "i18n:govoplan-scheduling.self_enrollment.revoked",
|
||||||
|
selfEnrollmentRevokeMessage: "i18n:govoplan-scheduling.self_enrollment.revoke_message",
|
||||||
|
selfEnrollmentRevokeTitle: "i18n:govoplan-scheduling.self_enrollment.revoke_title",
|
||||||
|
selfEnrollmentStatusActive: "i18n:govoplan-scheduling.self_enrollment.status_active",
|
||||||
|
selfEnrollmentStatusExpired: "i18n:govoplan-scheduling.self_enrollment.status_expired",
|
||||||
|
selfEnrollmentStatusExhausted: "i18n:govoplan-scheduling.self_enrollment.status_exhausted",
|
||||||
|
selfEnrollmentStatusRevoked: "i18n:govoplan-scheduling.self_enrollment.status_revoked",
|
||||||
resultsUnavailable: "i18n:govoplan-scheduling.response_results_are_not_available_for_this_view.1e82db18",
|
resultsUnavailable: "i18n:govoplan-scheduling.response_results_are_not_available_for_this_view.1e82db18",
|
||||||
invitationHelp: "i18n:govoplan-scheduling.you_can_respond_here_or_use_the_invitation_link_you_rece.1a25fd53",
|
invitationHelp: "i18n:govoplan-scheduling.you_can_respond_here_or_use_the_invitation_link_you_rece.1a25fd53",
|
||||||
save: "i18n:govoplan-scheduling.save.efc007a3",
|
save: "i18n:govoplan-scheduling.save.efc007a3",
|
||||||
@@ -236,6 +294,11 @@ const I18N = {
|
|||||||
statusLabel: "i18n:govoplan-scheduling.status.bae7d5be",
|
statusLabel: "i18n:govoplan-scheduling.status.bae7d5be",
|
||||||
title: "i18n:govoplan-scheduling.title.768e0c1c",
|
title: "i18n:govoplan-scheduling.title.768e0c1c",
|
||||||
titleRequired: "i18n:govoplan-scheduling.scheduling_request_title_is_required.a27338be",
|
titleRequired: "i18n:govoplan-scheduling.scheduling_request_title_is_required.a27338be",
|
||||||
|
requiredAction: "i18n:govoplan-scheduling.required_action.f1a20101",
|
||||||
|
responsibleActor: "i18n:govoplan-scheduling.who_can_fix_it.f1a20102",
|
||||||
|
resolutionTarget: "i18n:govoplan-scheduling.where_to_go.f1a20103",
|
||||||
|
systemOrTenantAdministrator: "i18n:govoplan-scheduling.system_or_tenant_administrator.f1a20104",
|
||||||
|
administration: "i18n:govoplan-core.admin.4e7afebc",
|
||||||
unchecked: "i18n:govoplan-scheduling.unchecked.1b927dec",
|
unchecked: "i18n:govoplan-scheduling.unchecked.1b927dec",
|
||||||
unavailable: "i18n:govoplan-scheduling.unavailable.2c9c1f79",
|
unavailable: "i18n:govoplan-scheduling.unavailable.2c9c1f79",
|
||||||
updateResponse: "i18n:govoplan-scheduling.update_response.346233cf",
|
updateResponse: "i18n:govoplan-scheduling.update_response.346233cf",
|
||||||
@@ -288,6 +351,8 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
const [notificationsUnavailable, setNotificationsUnavailable] = useState(false);
|
const [notificationsUnavailable, setNotificationsUnavailable] = useState(false);
|
||||||
const [detailsLoading, setDetailsLoading] = useState(false);
|
const [detailsLoading, setDetailsLoading] = useState(false);
|
||||||
const [revokeInvitationTarget, setRevokeInvitationTarget] = useState<InvitationRevokeTarget | null>(null);
|
const [revokeInvitationTarget, setRevokeInvitationTarget] = useState<InvitationRevokeTarget | null>(null);
|
||||||
|
const [consequentialAction, setConsequentialAction] = useState<ConsequentialAction | null>(null);
|
||||||
|
const [decisionTarget, setDecisionTarget] = useState<DecisionTarget | null>(null);
|
||||||
const [invitationActionClock, setInvitationActionClock] = useState(() => new Date());
|
const [invitationActionClock, setInvitationActionClock] = useState(() => new Date());
|
||||||
const detailLoadSequence = useRef(0);
|
const detailLoadSequence = useRef(0);
|
||||||
|
|
||||||
@@ -311,6 +376,7 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
() => requests.find((item) => item.id === selectedId) ?? firstRequest(groups, canAdminister),
|
() => requests.find((item) => item.id === selectedId) ?? firstRequest(groups, canAdminister),
|
||||||
[canAdminister, groups, requests, selectedId]
|
[canAdminister, groups, requests, selectedId]
|
||||||
);
|
);
|
||||||
|
const calendarCleanup = selected ? schedulingCalendarCleanup(selected) : null;
|
||||||
const selectedParticipant = useMemo(
|
const selectedParticipant = useMemo(
|
||||||
() => selected ? schedulingParticipantForActor(selected, actor) : null,
|
() => selected ? schedulingParticipantForActor(selected, actor) : null,
|
||||||
[actor, selected]
|
[actor, selected]
|
||||||
@@ -337,7 +403,10 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
selectedPhase !== "past" &&
|
selectedPhase !== "past" &&
|
||||||
selected.status === "decided" &&
|
selected.status === "decided" &&
|
||||||
selected.selected_slot_id &&
|
selected.selected_slot_id &&
|
||||||
!selected.calendar_event_id &&
|
(!selected.calendar_event_id || (
|
||||||
|
calendarCleanup?.status === "retry_required"
|
||||||
|
&& calendarCleanup.targetState === "handed_off"
|
||||||
|
)) &&
|
||||||
selected.create_calendar_event_on_decision
|
selected.create_calendar_event_on_decision
|
||||||
);
|
);
|
||||||
const optionResultById = useMemo(() => {
|
const optionResultById = useMemo(() => {
|
||||||
@@ -352,6 +421,9 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
() => availabilityComment !== savedAvailabilityComment || !availabilityValuesEqual(availability, savedAvailability),
|
() => availabilityComment !== savedAvailabilityComment || !availabilityValuesEqual(availability, savedAvailability),
|
||||||
[availability, availabilityComment, savedAvailability, savedAvailabilityComment]
|
[availability, availabilityComment, savedAvailability, savedAvailabilityComment]
|
||||||
);
|
);
|
||||||
|
const consequentialActionCopy = consequentialAction
|
||||||
|
? schedulingActionConfirmation(consequentialAction.kind)
|
||||||
|
: null;
|
||||||
const editorOriginal = editorMode === "edit"
|
const editorOriginal = editorMode === "edit"
|
||||||
? requests.find((request) => request.id === editingRequestId) ?? null
|
? requests.find((request) => request.id === editingRequestId) ?? null
|
||||||
: null;
|
: null;
|
||||||
@@ -785,6 +857,31 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
await runParticipantInvitationAction(target.requestId, target.participant, "revoke");
|
await runParticipantInvitationAction(target.requestId, target.participant, "revoke");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function confirmSchedulingAction() {
|
||||||
|
if (!consequentialAction || selected?.id !== consequentialAction.requestId) return;
|
||||||
|
const action = consequentialAction;
|
||||||
|
setConsequentialAction(null);
|
||||||
|
if (action.kind === "close") {
|
||||||
|
await runAction(() => closeSchedulingRequest(settings, action.requestId));
|
||||||
|
} else if (action.kind === "reminder") {
|
||||||
|
await runAction(() => createSchedulingNotifications(settings, action.requestId, "reminder"));
|
||||||
|
} else if (action.kind === "holds") {
|
||||||
|
await runAction(() => createSchedulingHolds(settings, action.requestId));
|
||||||
|
} else {
|
||||||
|
await runAction(() => createSchedulingCalendarEvent(settings, action.requestId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function confirmSchedulingDecision() {
|
||||||
|
if (!decisionTarget || selected?.id !== decisionTarget.requestId) return;
|
||||||
|
const target = decisionTarget;
|
||||||
|
setDecisionTarget(null);
|
||||||
|
await runAction(() => decideSchedulingRequest(settings, target.requestId, {
|
||||||
|
slot_id: target.slot.id,
|
||||||
|
handoff_to_calendar: selected.create_calendar_event_on_decision
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
async function sendAvailability(event: FormEvent<HTMLFormElement>) {
|
async function sendAvailability(event: FormEvent<HTMLFormElement>) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
await persistAvailability();
|
await persistAvailability();
|
||||||
@@ -834,25 +931,40 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="scheduling-page">
|
<WorkspaceFrame as="main" height="viewport" surface="plain" className="scheduling-page" label="Scheduling workspace">
|
||||||
<section className="scheduling-workspace">
|
<section className="scheduling-workspace">
|
||||||
<div className="scheduling-workspace-layout">
|
<div className="scheduling-workspace-layout">
|
||||||
<aside className="scheduling-request-sidebar">
|
<aside className="scheduling-request-sidebar">
|
||||||
<Card
|
<Card
|
||||||
title={I18N.requests}
|
title={I18N.requests}
|
||||||
actions={(
|
actions={(
|
||||||
<div className="scheduling-sidebar-actions">
|
<WorkspaceActionBar
|
||||||
<IconButton
|
scope="collection-pane"
|
||||||
label={I18N.refresh}
|
variant="collection"
|
||||||
icon={<RefreshCw aria-hidden="true" size={16} />}
|
refreshable
|
||||||
onClick={() => requestNavigation(() => void loadRequests(selected?.id))}
|
reloadAction={{
|
||||||
disabled={loading || saving} />
|
onReload: () => void loadRequests(selected?.id),
|
||||||
{canCreateOrWrite ? (
|
loading: loading || saving,
|
||||||
<Button type="button" variant="primary" onClick={beginCreate} disabled={saving}>
|
disabledReason: saving ? I18N.saving : undefined,
|
||||||
|
label: I18N.refresh
|
||||||
|
}}
|
||||||
|
className="scheduling-sidebar-actions"
|
||||||
|
helpAction={<DocumentationHelpLink
|
||||||
|
reference={{
|
||||||
|
topicId: "scheduling.find-and-decide-meeting-time",
|
||||||
|
documentationType: "user"
|
||||||
|
}} />}
|
||||||
|
createAction={canCreateOrWrite ? (
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="primary"
|
||||||
|
onClick={beginCreate}
|
||||||
|
disabled={saving}
|
||||||
|
disabledReason={saving ? I18N.saving : undefined}>
|
||||||
<Plus aria-hidden="true" size={16} /> {I18N.add}
|
<Plus aria-hidden="true" size={16} /> {I18N.add}
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : undefined}
|
||||||
</div>
|
/>
|
||||||
)}>
|
)}>
|
||||||
{loading ? <p className="scheduling-note" role="status">{I18N.loading}</p> : null}
|
{loading ? <p className="scheduling-note" role="status">{I18N.loading}</p> : null}
|
||||||
<RequestGroup
|
<RequestGroup
|
||||||
@@ -887,21 +999,32 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
|
|
||||||
{editorMode ? (
|
{editorMode ? (
|
||||||
<div className="scheduling-editor-surface">
|
<div className="scheduling-editor-surface">
|
||||||
<header className="scheduling-page-header">
|
<WorkspaceActionBar
|
||||||
<div className="scheduling-page-title">
|
scope="editor-pane"
|
||||||
|
variant="editor"
|
||||||
|
state={saving ? "saving" : draftDirty && !title.trim() ? "invalid" : draftDirty ? "dirty" : "clean"}
|
||||||
|
className="scheduling-page-header"
|
||||||
|
contextActions={<div className="scheduling-page-title">
|
||||||
<CalendarCheck aria-hidden="true" size={20} />
|
<CalendarCheck aria-hidden="true" size={20} />
|
||||||
<div>
|
<div>
|
||||||
<PageTitle>{editorMode === "create" ? I18N.newRequest : I18N.edit}</PageTitle>
|
<PageTitle>{editorMode === "create" ? I18N.newRequest : I18N.edit}</PageTitle>
|
||||||
<p>{editorMode === "create" ? I18N.addRequest : title}</p>
|
<p>{editorMode === "create" ? I18N.addRequest : title}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>}
|
||||||
<div className="scheduling-page-actions">
|
helpAction={<DocumentationHelpLink
|
||||||
<Button type="button" onClick={discardEditor} disabled={saving}>{I18N.discard}</Button>
|
reference={{
|
||||||
<Button type="submit" form="scheduling-editor-form" variant="primary" disabled={saving || !canCreateOrWrite}>
|
topicId: "scheduling.find-and-decide-meeting-time",
|
||||||
<Save aria-hidden="true" size={16} /> {saving ? I18N.saving : I18N.save}
|
documentationType: "user"
|
||||||
</Button>
|
}} />}
|
||||||
</div>
|
discardAction={{ label: I18N.discard, type: "button", onClick: discardEditor }}
|
||||||
</header>
|
saveAction={{
|
||||||
|
label: <><Save aria-hidden="true" size={16} /> {saving ? I18N.saving : I18N.save}</>,
|
||||||
|
type: "submit",
|
||||||
|
form: "scheduling-editor-form",
|
||||||
|
disabled: saving || !canCreateOrWrite,
|
||||||
|
disabledReason: saving ? I18N.saving : !canCreateOrWrite ? I18N.unavailable : undefined
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
<form
|
<form
|
||||||
id="scheduling-editor-form"
|
id="scheduling-editor-form"
|
||||||
@@ -911,7 +1034,7 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
void persistDraft();
|
void persistDraft();
|
||||||
}}>
|
}}>
|
||||||
<Card title={I18N.basicInformation}>
|
<Card title={I18N.basicInformation}>
|
||||||
<div className="form-grid">
|
<FormGrid columns={1} collapseAt="standard" className="">
|
||||||
<FormField label={I18N.title}>
|
<FormField label={I18N.title}>
|
||||||
<input required maxLength={500} value={title} onChange={(event) => changeDraft(setTitle, event.target.value)} />
|
<input required maxLength={500} value={title} onChange={(event) => changeDraft(setTitle, event.target.value)} />
|
||||||
</FormField>
|
</FormField>
|
||||||
@@ -921,7 +1044,7 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
<FormField label={I18N.location}>
|
<FormField label={I18N.location}>
|
||||||
<input maxLength={500} value={location} onChange={(event) => changeDraft(setLocation, event.target.value)} />
|
<input maxLength={500} value={location} onChange={(event) => changeDraft(setLocation, event.target.value)} />
|
||||||
</FormField>
|
</FormField>
|
||||||
</div>
|
</FormGrid>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Card title={I18N.calendarIntegration}>
|
<Card title={I18N.calendarIntegration}>
|
||||||
@@ -935,7 +1058,25 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
if (!checked) setCalendarId("");
|
if (!checked) setCalendarId("");
|
||||||
setDraftDirty(true);
|
setDraftDirty(true);
|
||||||
}} />
|
}} />
|
||||||
{!calendarIntegrationAvailable ? <p className="scheduling-capability-note">{I18N.calendarUnavailable}</p> : null}
|
{!calendarIntegrationAvailable ? (
|
||||||
|
<ActionBlockerHint
|
||||||
|
tone="info"
|
||||||
|
reason={{
|
||||||
|
summary: I18N.calendarUnavailable,
|
||||||
|
requiredAction: I18N.calendarRequiredAction,
|
||||||
|
actor: I18N.systemOrTenantAdministrator,
|
||||||
|
target: I18N.administration
|
||||||
|
}}
|
||||||
|
labels={{
|
||||||
|
requiredAction: I18N.requiredAction,
|
||||||
|
actor: I18N.responsibleActor,
|
||||||
|
target: I18N.resolutionTarget
|
||||||
|
}}
|
||||||
|
documentation={{
|
||||||
|
topicId: "scheduling.calendar-coordination",
|
||||||
|
documentationType: "admin"
|
||||||
|
}} />
|
||||||
|
) : null}
|
||||||
{calendarEnabled && CalendarPicker ? (
|
{calendarEnabled && CalendarPicker ? (
|
||||||
<CalendarPicker
|
<CalendarPicker
|
||||||
settings={settings}
|
settings={settings}
|
||||||
@@ -1030,12 +1171,42 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
</div>
|
</div>
|
||||||
) : selected ? (
|
) : selected ? (
|
||||||
<div className="scheduling-detail">
|
<div className="scheduling-detail">
|
||||||
|
<StageRail
|
||||||
|
className="scheduling-lifecycle-rail"
|
||||||
|
ariaLabel={I18N.requests}
|
||||||
|
items={schedulingLifecycleStages(selected.status).map((stage) => ({
|
||||||
|
id: stage.id,
|
||||||
|
label: stage.id === "prepare"
|
||||||
|
? I18N.basicInformation
|
||||||
|
: stage.id === "participate"
|
||||||
|
? I18N.participation
|
||||||
|
: I18N.decision,
|
||||||
|
icon: stage.id === "prepare"
|
||||||
|
? <Pencil aria-hidden="true" size={15} />
|
||||||
|
: stage.id === "participate"
|
||||||
|
? <Send aria-hidden="true" size={15} />
|
||||||
|
: <Check aria-hidden="true" size={15} />,
|
||||||
|
tone: lifecycleStageTone(stage.state),
|
||||||
|
current: stage.current,
|
||||||
|
locked: stage.locked,
|
||||||
|
lockedLabel: I18N.unavailable,
|
||||||
|
statusLabel: stage.current ? requestStatusLabel(selected, actor) : undefined
|
||||||
|
}))} />
|
||||||
<Card
|
<Card
|
||||||
title={selected.title}
|
title={selected.title}
|
||||||
actions={(
|
actions={(
|
||||||
<div className="scheduling-actions">
|
<div className="scheduling-actions">
|
||||||
|
<DocumentationHelpLink
|
||||||
|
reference={{
|
||||||
|
topicId: "scheduling.find-and-decide-meeting-time",
|
||||||
|
documentationType: "user"
|
||||||
|
}} />
|
||||||
{canEditSelected ? (
|
{canEditSelected ? (
|
||||||
<Button type="button" onClick={() => beginEdit(selected)} disabled={saving}>
|
<Button
|
||||||
|
type="button"
|
||||||
|
onClick={() => beginEdit(selected)}
|
||||||
|
disabled={saving}
|
||||||
|
disabledReason={saving ? I18N.saving : undefined}>
|
||||||
<Pencil aria-hidden="true" size={16} /> {I18N.edit}
|
<Pencil aria-hidden="true" size={16} /> {I18N.edit}
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -1044,8 +1215,8 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
request={selected}
|
request={selected}
|
||||||
saving={saving}
|
saving={saving}
|
||||||
onOpen={() => void runAction(() => openSchedulingRequest(settings, selected.id))}
|
onOpen={() => void runAction(() => openSchedulingRequest(settings, selected.id))}
|
||||||
onClose={() => requestNavigation(() => void runAction(() => closeSchedulingRequest(settings, selected.id)))}
|
onClose={() => requestNavigation(() => setConsequentialAction({ kind: "close", requestId: selected.id }))}
|
||||||
onReminder={() => void runAction(() => createSchedulingNotifications(settings, selected.id, "reminder"))} />
|
onReminder={() => setConsequentialAction({ kind: "reminder", requestId: selected.id })} />
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
)}>
|
)}>
|
||||||
@@ -1070,9 +1241,23 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{selected.public_participation_policy_enforcement_available === false ? (
|
{selected.public_participation_policy_enforcement_available === false ? (
|
||||||
<DismissibleAlert tone="warning" dismissible={false} compact>
|
<ActionBlockerHint
|
||||||
{selected.public_participation_policy_enforcement_reason || I18N.publicPolicyUnavailable}
|
reason={{
|
||||||
</DismissibleAlert>
|
summary: selected.public_participation_policy_enforcement_reason || I18N.publicPolicyUnavailable,
|
||||||
|
details: I18N.publicPolicyUnavailable,
|
||||||
|
requiredAction: I18N.publicPolicyRequiredAction,
|
||||||
|
actor: I18N.systemOrTenantAdministrator,
|
||||||
|
target: I18N.administration
|
||||||
|
}}
|
||||||
|
labels={{
|
||||||
|
requiredAction: I18N.requiredAction,
|
||||||
|
actor: I18N.responsibleActor,
|
||||||
|
target: I18N.resolutionTarget
|
||||||
|
}}
|
||||||
|
documentation={{
|
||||||
|
topicId: "scheduling.participation-governance",
|
||||||
|
documentationType: "admin"
|
||||||
|
}} />
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{selectedParticipant && selected.status === "collecting" ? (
|
{selectedParticipant && selected.status === "collecting" ? (
|
||||||
@@ -1083,7 +1268,16 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
variant="primary"
|
variant="primary"
|
||||||
type="submit"
|
type="submit"
|
||||||
form="scheduling-response-form"
|
form="scheduling-response-form"
|
||||||
disabled={saving || availabilityLoading || !canRespond || (selectedParticipant.status === "responded" && !selected.allow_participant_updates)}>
|
disabled={saving || availabilityLoading || !canRespond || (selectedParticipant.status === "responded" && !selected.allow_participant_updates)}
|
||||||
|
disabledReason={saving
|
||||||
|
? I18N.saving
|
||||||
|
: availabilityLoading
|
||||||
|
? I18N.loading
|
||||||
|
: !canRespond
|
||||||
|
? I18N.unavailable
|
||||||
|
: selectedParticipant.status === "responded" && !selected.allow_participant_updates
|
||||||
|
? I18N.responseRecorded
|
||||||
|
: undefined}>
|
||||||
<Send aria-hidden="true" size={16} />
|
<Send aria-hidden="true" size={16} />
|
||||||
{selectedParticipant.status === "responded" ? I18N.updateResponse : I18N.sendResponse}
|
{selectedParticipant.status === "responded" ? I18N.updateResponse : I18N.sendResponse}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -1139,13 +1333,17 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
saving={saving}
|
saving={saving}
|
||||||
allowMaybe={selected.allow_maybe}
|
allowMaybe={selected.allow_maybe}
|
||||||
maxParticipantsPerOption={selected.max_participants_per_option}
|
maxParticipantsPerOption={selected.max_participants_per_option}
|
||||||
onDecide={(slot) => void runAction(() => decideSchedulingRequest(settings, selected.id, {
|
onDecide={(slot) => setDecisionTarget({ requestId: selected.id, slot })} />
|
||||||
slot_id: slot.id,
|
|
||||||
handoff_to_calendar: selected.create_calendar_event_on_decision
|
|
||||||
}))} />
|
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
{selected.calendar_integration_enabled && canManageSelected && (showPlanningCalendarActions || showFinalCalendarAction || selected.calendar_event_id) ? (
|
{canManageSelected ? (
|
||||||
|
<SelfEnrollmentLinksCard
|
||||||
|
settings={settings}
|
||||||
|
request={selected}
|
||||||
|
disabled={saving} />
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{selected.calendar_integration_enabled && canManageSelected && (showPlanningCalendarActions || showFinalCalendarAction || selected.calendar_event_id || calendarCleanup?.status === "retry_required") ? (
|
||||||
<Card
|
<Card
|
||||||
title={I18N.calendarCoordination}
|
title={I18N.calendarCoordination}
|
||||||
actions={(
|
actions={(
|
||||||
@@ -1154,7 +1352,7 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={saving || !canReadAvailability}
|
disabled={saving || !canReadAvailability}
|
||||||
disabledReason={!canReadAvailability ? I18N.requiresAvailabilityRead : undefined}
|
disabledReason={saving ? I18N.saving : !canReadAvailability ? I18N.requiresAvailabilityRead : undefined}
|
||||||
onClick={() => void runAction(() => evaluateSchedulingFreeBusy(settings, selected.id))}>
|
onClick={() => void runAction(() => evaluateSchedulingFreeBusy(settings, selected.id))}>
|
||||||
<RefreshCw aria-hidden="true" size={16} /> {I18N.checkFreeBusy}
|
<RefreshCw aria-hidden="true" size={16} /> {I18N.checkFreeBusy}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -1163,8 +1361,8 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={saving || !canWriteCalendarEvent}
|
disabled={saving || !canWriteCalendarEvent}
|
||||||
disabledReason={!canWriteCalendarEvent ? I18N.requiresEventWrite : undefined}
|
disabledReason={saving ? I18N.saving : !canWriteCalendarEvent ? I18N.requiresEventWrite : undefined}
|
||||||
onClick={() => void runAction(() => createSchedulingHolds(settings, selected.id))}>
|
onClick={() => setConsequentialAction({ kind: "holds", requestId: selected.id })}>
|
||||||
<Clock aria-hidden="true" size={16} /> {I18N.holds}
|
<Clock aria-hidden="true" size={16} /> {I18N.holds}
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -1172,8 +1370,8 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={saving || !canWriteCalendarEvent}
|
disabled={saving || !canWriteCalendarEvent}
|
||||||
disabledReason={!canWriteCalendarEvent ? I18N.requiresEventWrite : undefined}
|
disabledReason={saving ? I18N.saving : !canWriteCalendarEvent ? I18N.requiresEventWrite : undefined}
|
||||||
onClick={() => void runAction(() => createSchedulingCalendarEvent(settings, selected.id))}>
|
onClick={() => setConsequentialAction({ kind: "final-event", requestId: selected.id })}>
|
||||||
<CalendarCheck aria-hidden="true" size={16} /> {I18N.finalEventLabel}
|
<CalendarCheck aria-hidden="true" size={16} /> {I18N.finalEventLabel}
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -1189,10 +1387,18 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
label={I18N.configuredCalendar}
|
label={I18N.configuredCalendar}
|
||||||
disabled />
|
disabled />
|
||||||
) : <p>{I18N.configuredCalendar}</p>}
|
) : <p>{I18N.configuredCalendar}</p>}
|
||||||
|
{calendarCleanup?.status === "retry_required" ? (
|
||||||
|
<DismissibleAlert tone="warning" dismissible={false} compact>
|
||||||
|
<strong>{I18N.calendarCleanupRetryTitle}</strong>{" "}
|
||||||
|
{i18nMessage(I18N.calendarCleanupRetryMessage, {
|
||||||
|
value0: calendarCleanup.pendingCount
|
||||||
|
})}
|
||||||
|
</DismissibleAlert>
|
||||||
|
) : null}
|
||||||
</Card>
|
</Card>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
<div className="scheduling-columns">
|
<ContentGrid columns={2} gap="small" collapseAt="workspace" align="stretch">
|
||||||
<Card title={I18N.participants}>
|
<Card title={I18N.participants}>
|
||||||
<div className="scheduling-status-row">
|
<div className="scheduling-status-row">
|
||||||
<span>{i18nMessage("i18n:govoplan-scheduling.value_participants.e776b092", { value0: selected.participant_aggregate.total })}</span>
|
<span>{i18nMessage("i18n:govoplan-scheduling.value_participants.e776b092", { value0: selected.participant_aggregate.total })}</span>
|
||||||
@@ -1227,7 +1433,7 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
</div>
|
</div>
|
||||||
)) : <p className="scheduling-note">{I18N.noNotifications}</p>}
|
)) : <p className="scheduling-note">{I18N.noNotifications}</p>}
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</ContentGrid>
|
||||||
|
|
||||||
<Card title={I18N.whatActionsDo} collapsible collapseKey="scheduling-action-help">
|
<Card title={I18N.whatActionsDo} collapsible collapseKey="scheduling-action-help">
|
||||||
<ul className="scheduling-action-help">
|
<ul className="scheduling-action-help">
|
||||||
@@ -1255,7 +1461,26 @@ export default function SchedulingPage({ settings, auth }: { settings: ApiSettin
|
|||||||
busy={saving}
|
busy={saving}
|
||||||
onCancel={() => setRevokeInvitationTarget(null)}
|
onCancel={() => setRevokeInvitationTarget(null)}
|
||||||
onConfirm={() => void confirmRevokeInvitation()} />
|
onConfirm={() => void confirmRevokeInvitation()} />
|
||||||
</main>
|
<ConfirmDialog
|
||||||
|
open={Boolean(consequentialAction && consequentialActionCopy)}
|
||||||
|
title={consequentialActionCopy?.title ?? I18N.unavailable}
|
||||||
|
message={consequentialActionCopy?.message ?? I18N.unavailable}
|
||||||
|
confirmLabel={consequentialActionCopy?.confirmLabel}
|
||||||
|
tone={consequentialAction?.kind === "close" ? "danger" : "default"}
|
||||||
|
busy={saving}
|
||||||
|
onCancel={() => setConsequentialAction(null)}
|
||||||
|
onConfirm={() => void confirmSchedulingAction()} />
|
||||||
|
<ConfirmDialog
|
||||||
|
open={Boolean(decisionTarget)}
|
||||||
|
title={I18N.decision}
|
||||||
|
message={i18nMessage(I18N.decideOn, { value0: decisionTarget?.slot.label ?? "" })}
|
||||||
|
confirmLabel={decisionTarget
|
||||||
|
? i18nMessage(I18N.decideOn, { value0: decisionTarget.slot.label })
|
||||||
|
: I18N.decision}
|
||||||
|
busy={saving}
|
||||||
|
onCancel={() => setDecisionTarget(null)}
|
||||||
|
onConfirm={() => void confirmSchedulingDecision()} />
|
||||||
|
</WorkspaceFrame>
|
||||||
);
|
);
|
||||||
|
|
||||||
function changeDraft(setter: (value: string) => void, value: string) {
|
function changeDraft(setter: (value: string) => void, value: string) {
|
||||||
@@ -1439,7 +1664,7 @@ function SchedulingSettings({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<Card title={I18N.generalSettings}>
|
<Card title={I18N.generalSettings}>
|
||||||
<div className="settings-grid">
|
<ContentGrid columns={2} collapseAt="workspace" className="">
|
||||||
<ToggleSwitch
|
<ToggleSwitch
|
||||||
label={I18N.notifyOnAnswers}
|
label={I18N.notifyOnAnswers}
|
||||||
help={I18N.notifyOnAnswersHelp}
|
help={I18N.notifyOnAnswersHelp}
|
||||||
@@ -1507,7 +1732,7 @@ function SchedulingSettings({
|
|||||||
onValueChange={(value) => onChange("anonymousPassword", value)} />
|
onValueChange={(value) => onChange("anonymousPassword", value)} />
|
||||||
</FormField>
|
</FormField>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</ContentGrid>
|
||||||
{policyLocked ? (
|
{policyLocked ? (
|
||||||
<DismissibleAlert tone="info" dismissible={false} compact>
|
<DismissibleAlert tone="info" dismissible={false} compact>
|
||||||
{I18N.policyLocked}
|
{I18N.policyLocked}
|
||||||
@@ -1532,16 +1757,47 @@ function ParticipationStats({
|
|||||||
const rate = responseCount === null ? null : total ? Math.round((knownResponseCount / total) * 100) : 0;
|
const rate = responseCount === null ? null : total ? Math.round((knownResponseCount / total) * 100) : 0;
|
||||||
return (
|
return (
|
||||||
<Card title={I18N.participation}>
|
<Card title={I18N.participation}>
|
||||||
<div className="metric-grid inside">
|
<MetricGrid spacing="inset">
|
||||||
<MetricCard label={I18N.participants} value={total} />
|
<MetricCard label={I18N.participants} value={total} />
|
||||||
<MetricCard label={I18N.responses} value={loading ? "…" : responseCount ?? "—"} tone="good" />
|
<MetricCard label={I18N.responses} value={loading ? "…" : responseCount ?? "—"} tone="good" />
|
||||||
<MetricCard label={I18N.awaiting} value={loading ? "…" : awaiting ?? "—"} tone={awaiting ? "warning" : "neutral"} />
|
<MetricCard label={I18N.awaiting} value={loading ? "…" : awaiting ?? "—"} tone={awaiting ? "warning" : "neutral"} />
|
||||||
<MetricCard label={I18N.participationRate} value={loading ? "…" : rate === null ? "—" : `${rate}%`} tone="info" />
|
<MetricCard label={I18N.participationRate} value={loading ? "…" : rate === null ? "—" : `${rate}%`} tone="info" />
|
||||||
</div>
|
</MetricGrid>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function schedulingCalendarCleanup(request: SchedulingRequest): SchedulingCalendarCleanup | null {
|
||||||
|
const value = request.metadata?.calendar_cleanup;
|
||||||
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
||||||
|
const record = value as Record<string, unknown>;
|
||||||
|
const status = record.status === "retry_required" ? "retry_required" : record.status === "accepted" ? "accepted" : null;
|
||||||
|
if (!status) return null;
|
||||||
|
const pending = Array.isArray(record.pending_slot_ids) ? record.pending_slot_ids : [];
|
||||||
|
return {
|
||||||
|
status,
|
||||||
|
targetState: typeof record.target_state === "string" ? record.target_state : null,
|
||||||
|
pendingCount: pending.length
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function schedulingActionConfirmation(kind: ConsequentialAction["kind"]): {
|
||||||
|
title: string;
|
||||||
|
message: string;
|
||||||
|
confirmLabel: string;
|
||||||
|
} {
|
||||||
|
if (kind === "close") {
|
||||||
|
return { title: I18N.closePoll, message: I18N.closePollEffect, confirmLabel: I18N.closePoll };
|
||||||
|
}
|
||||||
|
if (kind === "reminder") {
|
||||||
|
return { title: I18N.reminder, message: I18N.reminderEffect, confirmLabel: I18N.reminder };
|
||||||
|
}
|
||||||
|
if (kind === "holds") {
|
||||||
|
return { title: I18N.holds, message: I18N.holdsEffect, confirmLabel: I18N.holds };
|
||||||
|
}
|
||||||
|
return { title: I18N.finalEventLabel, message: I18N.finalEventEffect, confirmLabel: I18N.finalEventLabel };
|
||||||
|
}
|
||||||
|
|
||||||
function LifecycleActions({
|
function LifecycleActions({
|
||||||
request,
|
request,
|
||||||
saving,
|
saving,
|
||||||
@@ -1556,13 +1812,13 @@ function LifecycleActions({
|
|||||||
onReminder: () => void;
|
onReminder: () => void;
|
||||||
}) {
|
}) {
|
||||||
if (request.status === "draft") {
|
if (request.status === "draft") {
|
||||||
return <Button type="button" variant="primary" disabled={saving} onClick={onOpen}><Send aria-hidden="true" size={16} /> {I18N.openPoll}</Button>;
|
return <Button type="button" variant="primary" disabled={saving} disabledReason={saving ? I18N.saving : undefined} onClick={onOpen}><Send aria-hidden="true" size={16} /> {I18N.openPoll}</Button>;
|
||||||
}
|
}
|
||||||
if (request.status === "collecting") {
|
if (request.status === "collecting") {
|
||||||
return (
|
return (
|
||||||
<div className="scheduling-actions">
|
<div className="scheduling-actions">
|
||||||
<Button type="button" disabled={saving} onClick={onReminder}><Bell aria-hidden="true" size={16} /> {I18N.reminder}</Button>
|
<Button type="button" disabled={saving} disabledReason={saving ? I18N.saving : undefined} onClick={onReminder}><Bell aria-hidden="true" size={16} /> {I18N.reminder}</Button>
|
||||||
<Button type="button" variant="primary" disabled={saving} onClick={onClose}><XCircle aria-hidden="true" size={16} /> {I18N.closePoll}</Button>
|
<Button type="button" variant="primary" disabled={saving} disabledReason={saving ? I18N.saving : undefined} onClick={onClose}><XCircle aria-hidden="true" size={16} /> {I18N.closePoll}</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1788,7 +2044,7 @@ function CandidateSlotsGrid({
|
|||||||
label: i18nMessage("i18n:govoplan-scheduling.decide_on_value.196409cd", { value0: slot.label }),
|
label: i18nMessage("i18n:govoplan-scheduling.decide_on_value.196409cd", { value0: slot.label }),
|
||||||
icon: <Check aria-hidden="true" size={16} />,
|
icon: <Check aria-hidden="true" size={16} />,
|
||||||
disabled: saving || !decisionEnabled,
|
disabled: saving || !decisionEnabled,
|
||||||
disabledReason: !decisionEnabled ? I18N.decideUnavailable : undefined,
|
disabledReason: saving ? I18N.saving : !decisionEnabled ? I18N.decideUnavailable : undefined,
|
||||||
onClick: () => onDecide(slot)
|
onClick: () => onDecide(slot)
|
||||||
}]} />
|
}]} />
|
||||||
} satisfies DataGridColumn<SchedulingCandidateSlot>] : [])
|
} satisfies DataGridColumn<SchedulingCandidateSlot>] : [])
|
||||||
@@ -1854,7 +2110,7 @@ function ParticipantsGrid({
|
|||||||
label: i18nMessage(I18N.copyInvitationLink, { value0: label }),
|
label: i18nMessage(I18N.copyInvitationLink, { value0: label }),
|
||||||
icon: <Copy aria-hidden="true" size={16} />,
|
icon: <Copy aria-hidden="true" size={16} />,
|
||||||
disabled: saving || Boolean(copyDisabledReason),
|
disabled: saving || Boolean(copyDisabledReason),
|
||||||
disabledReason: copyDisabledReason,
|
disabledReason: saving ? I18N.saving : copyDisabledReason,
|
||||||
onClick: () => onCopy(participant)
|
onClick: () => onCopy(participant)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1862,7 +2118,7 @@ function ParticipantsGrid({
|
|||||||
label: i18nMessage(I18N.sendInvitation, { value0: label }),
|
label: i18nMessage(I18N.sendInvitation, { value0: label }),
|
||||||
icon: <Send aria-hidden="true" size={16} />,
|
icon: <Send aria-hidden="true" size={16} />,
|
||||||
disabled: saving || Boolean(deliveryDisabledReason),
|
disabled: saving || Boolean(deliveryDisabledReason),
|
||||||
disabledReason: deliveryDisabledReason,
|
disabledReason: saving ? I18N.saving : deliveryDisabledReason,
|
||||||
onClick: () => onSend(participant)
|
onClick: () => onSend(participant)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1871,7 +2127,7 @@ function ParticipantsGrid({
|
|||||||
icon: <Link2Off aria-hidden="true" size={16} />,
|
icon: <Link2Off aria-hidden="true" size={16} />,
|
||||||
variant: "danger",
|
variant: "danger",
|
||||||
disabled: saving || Boolean(revokeDisabledReason),
|
disabled: saving || Boolean(revokeDisabledReason),
|
||||||
disabledReason: revokeDisabledReason,
|
disabledReason: saving ? I18N.saving : revokeDisabledReason,
|
||||||
onClick: () => onRevoke(participant)
|
onClick: () => onRevoke(participant)
|
||||||
}
|
}
|
||||||
]} />
|
]} />
|
||||||
@@ -1957,6 +2213,15 @@ function firstRequest(groups: SchedulingRequestGroups, includeManaged: boolean):
|
|||||||
return groups.owned[0] ?? groups.invited[0] ?? (includeManaged ? groups.other[0] : null) ?? null;
|
return groups.owned[0] ?? groups.invited[0] ?? (includeManaged ? groups.other[0] : null) ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lifecycleStageTone(
|
||||||
|
state: SchedulingLifecycleStageState
|
||||||
|
): "success" | "active" | "warning" | "neutral" {
|
||||||
|
if (state === "complete") return "success";
|
||||||
|
if (state === "current") return "active";
|
||||||
|
if (state === "stopped") return "warning";
|
||||||
|
return "neutral";
|
||||||
|
}
|
||||||
|
|
||||||
function requestStatusLabel(request: SchedulingRequest, actor: SchedulingActor): string {
|
function requestStatusLabel(request: SchedulingRequest, actor: SchedulingActor): string {
|
||||||
const phase = schedulingSortPhase(request, actor);
|
const phase = schedulingSortPhase(request, actor);
|
||||||
if (phase === "past") return I18N.past;
|
if (phase === "past") return I18N.past;
|
||||||
@@ -2053,6 +2318,198 @@ function localValue(date: Date): string {
|
|||||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SelfEnrollmentLinksCard({
|
||||||
|
settings,
|
||||||
|
request,
|
||||||
|
disabled
|
||||||
|
}: {
|
||||||
|
settings: ApiSettings;
|
||||||
|
request: SchedulingRequest;
|
||||||
|
disabled: boolean;
|
||||||
|
}) {
|
||||||
|
const { translateText } = usePlatformLanguage();
|
||||||
|
const defaultExpiry = useMemo(() => {
|
||||||
|
const candidate = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000);
|
||||||
|
const deadline = request.deadline_at ? new Date(request.deadline_at) : null;
|
||||||
|
return localValue(deadline && deadline < candidate ? deadline : candidate);
|
||||||
|
}, [request.deadline_at]);
|
||||||
|
const [links, setLinks] = useState<SchedulingEnrollmentLink[]>([]);
|
||||||
|
const [expiresAt, setExpiresAt] = useState(defaultExpiry);
|
||||||
|
const [capacity, setCapacity] = useState(25);
|
||||||
|
const [allowAnonymous, setAllowAnonymous] = useState(true);
|
||||||
|
const [allowAuthenticated, setAllowAuthenticated] = useState(true);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [working, setWorking] = useState(false);
|
||||||
|
const [error, setError] = useState("");
|
||||||
|
const [success, setSuccess] = useState("");
|
||||||
|
const [revokeTarget, setRevokeTarget] = useState<SchedulingEnrollmentLink | null>(null);
|
||||||
|
|
||||||
|
const load = useCallback(async () => {
|
||||||
|
setLoading(true);
|
||||||
|
try {
|
||||||
|
setLinks((await listSchedulingEnrollmentLinks(settings, request.id)).links);
|
||||||
|
setError("");
|
||||||
|
} catch (err) {
|
||||||
|
setError(errorMessage(err, translateText(I18N.selfEnrollmentLoadFailed)));
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
}, [request.id, settings]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
void load();
|
||||||
|
}, [load]);
|
||||||
|
|
||||||
|
async function createLink() {
|
||||||
|
let issuedLinkId: string | null = null;
|
||||||
|
setWorking(true);
|
||||||
|
setError("");
|
||||||
|
setSuccess("");
|
||||||
|
try {
|
||||||
|
const result = await createSchedulingEnrollmentLink(settings, request.id, {
|
||||||
|
expires_at: isoFromLocal(expiresAt),
|
||||||
|
max_enrollments: capacity,
|
||||||
|
allow_anonymous: allowAnonymous,
|
||||||
|
allow_authenticated: allowAuthenticated
|
||||||
|
});
|
||||||
|
issuedLinkId = result.link.id;
|
||||||
|
const absoluteUrl = result.action_url
|
||||||
|
? new URL(result.action_url, window.location.origin).toString()
|
||||||
|
: null;
|
||||||
|
if (!absoluteUrl || !navigator.clipboard) {
|
||||||
|
throw new Error(translateText(I18N.selfEnrollmentClipboardFailed));
|
||||||
|
}
|
||||||
|
await navigator.clipboard.writeText(absoluteUrl);
|
||||||
|
setSuccess(I18N.selfEnrollmentCopied);
|
||||||
|
await load();
|
||||||
|
} catch (err) {
|
||||||
|
if (issuedLinkId) {
|
||||||
|
try {
|
||||||
|
await revokeSchedulingEnrollmentLink(settings, request.id, issuedLinkId);
|
||||||
|
} catch {
|
||||||
|
// The list reload below surfaces the still-active link for explicit revocation.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setError(errorMessage(err, translateText(I18N.selfEnrollmentIssueFailed)));
|
||||||
|
await load();
|
||||||
|
} finally {
|
||||||
|
setWorking(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function revokeLink() {
|
||||||
|
if (!revokeTarget) return;
|
||||||
|
const target = revokeTarget;
|
||||||
|
setRevokeTarget(null);
|
||||||
|
setWorking(true);
|
||||||
|
setError("");
|
||||||
|
try {
|
||||||
|
await revokeSchedulingEnrollmentLink(settings, request.id, target.id);
|
||||||
|
setSuccess(I18N.selfEnrollmentRevoked);
|
||||||
|
await load();
|
||||||
|
} catch (err) {
|
||||||
|
setError(errorMessage(err, translateText(I18N.selfEnrollmentRevokeFailed)));
|
||||||
|
} finally {
|
||||||
|
setWorking(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
title={I18N.selfEnrollmentLinks}
|
||||||
|
actions={<DocumentationHelpLink reference={{
|
||||||
|
topicId: "scheduling.public-self-enrollment",
|
||||||
|
documentationType: "user"
|
||||||
|
}} />}>
|
||||||
|
<p className="scheduling-capability-note">
|
||||||
|
{I18N.selfEnrollmentLinksHelp}
|
||||||
|
</p>
|
||||||
|
{error ? <DismissibleAlert tone="danger">{error}</DismissibleAlert> : null}
|
||||||
|
{success ? <DismissibleAlert tone="success">{success}</DismissibleAlert> : null}
|
||||||
|
<FormGrid columns={2} collapseAt="standard" className="">
|
||||||
|
<FormField label={I18N.selfEnrollmentExpiresAt}>
|
||||||
|
<DateTimeField
|
||||||
|
required
|
||||||
|
min={localValue(new Date())}
|
||||||
|
value={expiresAt}
|
||||||
|
disabled={disabled || working || request.status !== "collecting"}
|
||||||
|
onChange={setExpiresAt} />
|
||||||
|
</FormField>
|
||||||
|
<FormField label={I18N.selfEnrollmentMaximum}>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
required
|
||||||
|
min={1}
|
||||||
|
max={10_000}
|
||||||
|
value={capacity}
|
||||||
|
disabled={disabled || working || request.status !== "collecting"}
|
||||||
|
onChange={(event) => setCapacity(Number(event.target.value))} />
|
||||||
|
</FormField>
|
||||||
|
</FormGrid>
|
||||||
|
<div className="scheduling-enrollment-modes">
|
||||||
|
<ToggleSwitch
|
||||||
|
label={I18N.selfEnrollmentAllowAnonymous}
|
||||||
|
checked={allowAnonymous}
|
||||||
|
disabled={disabled || working || request.status !== "collecting" || !request.allow_external_participants}
|
||||||
|
onChange={setAllowAnonymous} />
|
||||||
|
<ToggleSwitch
|
||||||
|
label={I18N.selfEnrollmentAllowAuthenticated}
|
||||||
|
checked={allowAuthenticated}
|
||||||
|
disabled={disabled || working || request.status !== "collecting"}
|
||||||
|
onChange={setAllowAuthenticated} />
|
||||||
|
</div>
|
||||||
|
<div className="scheduling-public-actions">
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="primary"
|
||||||
|
disabled={disabled || working || loading || request.status !== "collecting" || !expiresAt || capacity < 1 || (!allowAnonymous && !allowAuthenticated)}
|
||||||
|
disabledReason={request.status !== "collecting" ? I18N.selfEnrollmentOpenFirst : undefined}
|
||||||
|
onClick={() => void createLink()}>
|
||||||
|
<Copy aria-hidden="true" size={16} /> {I18N.selfEnrollmentIssueCopy}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{loading ? <p className="scheduling-note">{I18N.selfEnrollmentLoadingLinks}</p> : links.length ? (
|
||||||
|
<div className="scheduling-enrollment-links">
|
||||||
|
{links.map((link) => (
|
||||||
|
<div className="scheduling-compact-row" key={link.id}>
|
||||||
|
<span>
|
||||||
|
<strong>{link.enrollment_count} / {link.max_enrollments}</strong>
|
||||||
|
<small>{formatDateTime(link.expires_at)} · {link.allow_anonymous ? translateText(I18N.selfEnrollmentModeAnonymous) : ""}{link.allow_anonymous && link.allow_authenticated ? " + " : ""}{link.allow_authenticated ? translateText(I18N.selfEnrollmentModeAuthenticated) : ""}</small>
|
||||||
|
</span>
|
||||||
|
<StatusBadge status={link.status} label={selfEnrollmentLinkStatusLabel(link.status)} />
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
variant="danger"
|
||||||
|
disabled={disabled || working || link.status === "revoked"}
|
||||||
|
onClick={() => setRevokeTarget(link)}>
|
||||||
|
<Link2Off aria-hidden="true" size={16} /> {I18N.revokeLink}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : <p className="scheduling-note">{I18N.selfEnrollmentNoLinks}</p>}
|
||||||
|
<ConfirmDialog
|
||||||
|
open={Boolean(revokeTarget)}
|
||||||
|
title={I18N.selfEnrollmentRevokeTitle}
|
||||||
|
message={I18N.selfEnrollmentRevokeMessage}
|
||||||
|
confirmLabel={I18N.revokeLink}
|
||||||
|
tone="danger"
|
||||||
|
busy={working}
|
||||||
|
onCancel={() => setRevokeTarget(null)}
|
||||||
|
onConfirm={() => void revokeLink()} />
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function selfEnrollmentLinkStatusLabel(status: SchedulingEnrollmentLink["status"]): string {
|
||||||
|
return {
|
||||||
|
active: I18N.selfEnrollmentStatusActive,
|
||||||
|
expired: I18N.selfEnrollmentStatusExpired,
|
||||||
|
revoked: I18N.selfEnrollmentStatusRevoked,
|
||||||
|
exhausted: I18N.selfEnrollmentStatusExhausted
|
||||||
|
}[status];
|
||||||
|
}
|
||||||
|
|
||||||
function addLocalMinutes(value: string, minutes: number): string {
|
function addLocalMinutes(value: string, minutes: number): string {
|
||||||
if (!value) return "";
|
if (!value) return "";
|
||||||
const date = new Date(value);
|
const date = new Date(value);
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import { useEffect, useMemo, useState, type FormEvent } from "react";
|
import { useEffect, useMemo, useState, type FormEvent } from "react";
|
||||||
import { Link, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router";
|
||||||
import {
|
import { FormGrid,
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
DismissibleAlert,
|
DismissibleAlert,
|
||||||
|
DocumentationHelpLink,
|
||||||
FormField,
|
FormField,
|
||||||
LoadingFrame,
|
LoadingFrame,
|
||||||
|
PasswordField,
|
||||||
formatDateTime,
|
formatDateTime,
|
||||||
type ApiSettings,
|
type ApiSettings,
|
||||||
type AuthInfo
|
type AuthInfo
|
||||||
@@ -44,6 +46,7 @@ const I18N = {
|
|||||||
password: "i18n:govoplan-scheduling.guest_password.94545e82",
|
password: "i18n:govoplan-scheduling.guest_password.94545e82",
|
||||||
response: "i18n:govoplan-scheduling.your_availability.f86c8215",
|
response: "i18n:govoplan-scheduling.your_availability.f86c8215",
|
||||||
saved: "i18n:govoplan-scheduling.your_response_has_been_recorded.b855088d",
|
saved: "i18n:govoplan-scheduling.your_response_has_been_recorded.b855088d",
|
||||||
|
saving: "i18n:govoplan-scheduling.saving.56a2285c",
|
||||||
submit: "i18n:govoplan-scheduling.submit_response.a5f0c053",
|
submit: "i18n:govoplan-scheduling.submit_response.a5f0c053",
|
||||||
unavailable: "i18n:govoplan-scheduling.unavailable.2c9c1f79"
|
unavailable: "i18n:govoplan-scheduling.unavailable.2c9c1f79"
|
||||||
} as const;
|
} as const;
|
||||||
@@ -166,11 +169,19 @@ export default function SchedulingPublicPage({ settings, auth }: SchedulingPubli
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{!response && !loading && (
|
{!response && !loading && (
|
||||||
<Card title={I18N.accessDetails}>
|
<Card
|
||||||
|
title={I18N.accessDetails}
|
||||||
|
actions={(
|
||||||
|
<DocumentationHelpLink
|
||||||
|
reference={{
|
||||||
|
topicId: "scheduling.find-and-decide-meeting-time",
|
||||||
|
documentationType: "user"
|
||||||
|
}} />
|
||||||
|
)}>
|
||||||
<form className="scheduling-public-access-form" onSubmit={openRequest}>
|
<form className="scheduling-public-access-form" onSubmit={openRequest}>
|
||||||
<p className="muted">{I18N.accessHelp}</p>
|
<p className="muted">{I18N.accessHelp}</p>
|
||||||
{accessAttempted && error && <DismissibleAlert tone="danger">{error}</DismissibleAlert>}
|
{accessAttempted && error && <DismissibleAlert tone="danger">{error}</DismissibleAlert>}
|
||||||
<div className="form-grid two-col">
|
<FormGrid columns={2} collapseAt="standard" className="">
|
||||||
<FormField label={I18N.email}>
|
<FormField label={I18N.email}>
|
||||||
<input
|
<input
|
||||||
type="email"
|
type="email"
|
||||||
@@ -180,16 +191,20 @@ export default function SchedulingPublicPage({ settings, auth }: SchedulingPubli
|
|||||||
/>
|
/>
|
||||||
</FormField>
|
</FormField>
|
||||||
<FormField label={I18N.password}>
|
<FormField label={I18N.password}>
|
||||||
<input
|
<PasswordField
|
||||||
type="password"
|
|
||||||
autoComplete="current-password"
|
autoComplete="current-password"
|
||||||
value={password}
|
value={password}
|
||||||
onChange={(event) => setPassword(event.target.value)}
|
onValueChange={setPassword} />
|
||||||
/>
|
|
||||||
</FormField>
|
</FormField>
|
||||||
</div>
|
</FormGrid>
|
||||||
<div className="scheduling-public-actions">
|
<div className="scheduling-public-actions">
|
||||||
<Button type="submit" variant="primary">{I18N.accessRequest}</Button>
|
<Button
|
||||||
|
type="submit"
|
||||||
|
variant="primary"
|
||||||
|
disabled={loading}
|
||||||
|
disabledReason={loading ? I18N.loading : undefined}>
|
||||||
|
{I18N.accessRequest}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -197,7 +212,15 @@ export default function SchedulingPublicPage({ settings, auth }: SchedulingPubli
|
|||||||
|
|
||||||
{response && (
|
{response && (
|
||||||
<form className="scheduling-public-content" onSubmit={saveResponse}>
|
<form className="scheduling-public-content" onSubmit={saveResponse}>
|
||||||
<Card title={response.title}>
|
<Card
|
||||||
|
title={response.title}
|
||||||
|
actions={(
|
||||||
|
<DocumentationHelpLink
|
||||||
|
reference={{
|
||||||
|
topicId: "scheduling.find-and-decide-meeting-time",
|
||||||
|
documentationType: "user"
|
||||||
|
}} />
|
||||||
|
)}>
|
||||||
{response.description && <p className="scheduling-public-description">{response.description}</p>}
|
{response.description && <p className="scheduling-public-description">{response.description}</p>}
|
||||||
<dl className="scheduling-public-summary">
|
<dl className="scheduling-public-summary">
|
||||||
{response.location && <><dt>i18n:govoplan-scheduling.location.d219c681</dt><dd>{response.location}</dd></>}
|
{response.location && <><dt>i18n:govoplan-scheduling.location.d219c681</dt><dd>{response.location}</dd></>}
|
||||||
@@ -263,7 +286,13 @@ export default function SchedulingPublicPage({ settings, auth }: SchedulingPubli
|
|||||||
)}
|
)}
|
||||||
{collecting && (
|
{collecting && (
|
||||||
<div className="scheduling-public-actions">
|
<div className="scheduling-public-actions">
|
||||||
<Button type="submit" variant="primary" disabled={saving}>{I18N.submit}</Button>
|
<Button
|
||||||
|
type="submit"
|
||||||
|
variant="primary"
|
||||||
|
disabled={saving}
|
||||||
|
disabledReason={saving ? I18N.saving : undefined}>
|
||||||
|
{I18N.submit}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Card>}
|
</Card>}
|
||||||
|
|||||||
@@ -0,0 +1,138 @@
|
|||||||
|
import { useCallback, type ReactNode } from "react";
|
||||||
|
import { CalendarClock } from "lucide-react";
|
||||||
|
import { Link } from "react-router";
|
||||||
|
import {
|
||||||
|
DashboardWidgetList,
|
||||||
|
DismissibleAlert,
|
||||||
|
DocumentationHelpLink,
|
||||||
|
LoadingFrame,
|
||||||
|
StatusBadge,
|
||||||
|
formatDateTime,
|
||||||
|
useDashboardWidgetData,
|
||||||
|
type ApiSettings,
|
||||||
|
type DashboardWidgetConfiguration
|
||||||
|
} from "@govoplan/core-webui";
|
||||||
|
import {
|
||||||
|
listSchedulingRequests,
|
||||||
|
type SchedulingRequest
|
||||||
|
} from "../../api/scheduling";
|
||||||
|
|
||||||
|
const I18N = {
|
||||||
|
candidateSlots: "i18n:govoplan-scheduling.candidate_slots.c414946b",
|
||||||
|
deadline: "i18n:govoplan-scheduling.response_deadline.7fd9e3aa",
|
||||||
|
draft: "i18n:govoplan-scheduling.draft.23d33e22",
|
||||||
|
empty: "i18n:govoplan-scheduling.no_scheduling_request_selected.ac940664",
|
||||||
|
loading: "i18n:govoplan-scheduling.loading_scheduling_requests.f42be95d",
|
||||||
|
open: "i18n:govoplan-scheduling.open.cf9b7706",
|
||||||
|
openScheduling: "i18n:govoplan-scheduling.open_in_scheduling.48df1541",
|
||||||
|
responded: "i18n:govoplan-scheduling.responded.4f218211"
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export default function SchedulingRequestsWidget({
|
||||||
|
settings,
|
||||||
|
refreshKey,
|
||||||
|
configuration
|
||||||
|
}: {
|
||||||
|
settings: ApiSettings;
|
||||||
|
refreshKey: number;
|
||||||
|
configuration: DashboardWidgetConfiguration;
|
||||||
|
}) {
|
||||||
|
const maxItems = numberSetting(configuration.maxItems, 5, 1, 12);
|
||||||
|
const includeDrafts = configuration.includeDrafts === true;
|
||||||
|
const load = useCallback(async () => {
|
||||||
|
const response = await listSchedulingRequests(settings);
|
||||||
|
return response.requests
|
||||||
|
.filter(
|
||||||
|
(request) =>
|
||||||
|
request.status === "collecting"
|
||||||
|
|| (includeDrafts && request.status === "draft")
|
||||||
|
)
|
||||||
|
.sort(compareRequests)
|
||||||
|
.slice(0, maxItems);
|
||||||
|
}, [includeDrafts, maxItems, settings]);
|
||||||
|
const { data: requests, loading, error } = useDashboardWidgetData(
|
||||||
|
load,
|
||||||
|
refreshKey
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LoadingFrame loading={loading} label={I18N.loading}>
|
||||||
|
{error && (
|
||||||
|
<DismissibleAlert tone="warning" resetKey={error}>
|
||||||
|
{error}
|
||||||
|
</DismissibleAlert>
|
||||||
|
)}
|
||||||
|
<DashboardWidgetList
|
||||||
|
emptyText={I18N.empty}
|
||||||
|
items={(requests ?? []).map((request) => ({
|
||||||
|
id: request.id,
|
||||||
|
title: request.title,
|
||||||
|
detail: responseLabel(request),
|
||||||
|
meta: deadlineLabel(request),
|
||||||
|
leading: <CalendarClock size={17} aria-hidden="true" />,
|
||||||
|
trailing: (
|
||||||
|
<StatusBadge
|
||||||
|
status={request.status}
|
||||||
|
label={request.status === "collecting" ? I18N.open : I18N.draft}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
to: `/scheduling?request_id=${encodeURIComponent(request.id)}`
|
||||||
|
}))}
|
||||||
|
/>
|
||||||
|
<div className="dashboard-contribution-footer">
|
||||||
|
<DocumentationHelpLink
|
||||||
|
reference={{
|
||||||
|
topicId: "scheduling.find-and-decide-meeting-time",
|
||||||
|
documentationType: "user"
|
||||||
|
}} />
|
||||||
|
<Link className="btn btn-secondary" to="/scheduling">
|
||||||
|
{I18N.openScheduling}
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</LoadingFrame>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function compareRequests(
|
||||||
|
left: SchedulingRequest,
|
||||||
|
right: SchedulingRequest
|
||||||
|
): number {
|
||||||
|
if (left.status !== right.status) {
|
||||||
|
return left.status === "collecting" ? -1 : 1;
|
||||||
|
}
|
||||||
|
const leftDeadline = left.deadline_at
|
||||||
|
? new Date(left.deadline_at).getTime()
|
||||||
|
: Number.POSITIVE_INFINITY;
|
||||||
|
const rightDeadline = right.deadline_at
|
||||||
|
? new Date(right.deadline_at).getTime()
|
||||||
|
: Number.POSITIVE_INFINITY;
|
||||||
|
return (
|
||||||
|
leftDeadline - rightDeadline
|
||||||
|
|| new Date(right.updated_at).getTime() - new Date(left.updated_at).getTime()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function responseLabel(request: SchedulingRequest): ReactNode {
|
||||||
|
const responded = request.participant_aggregate.status_counts.responded ?? 0;
|
||||||
|
return <>{responded}/{request.participant_aggregate.total} {I18N.responded}</>;
|
||||||
|
}
|
||||||
|
|
||||||
|
function deadlineLabel(request: SchedulingRequest): ReactNode {
|
||||||
|
if (!request.deadline_at) return <>{request.slots.length} {I18N.candidateSlots}</>;
|
||||||
|
return <>{I18N.deadline}: {formatDateTime(request.deadline_at, {
|
||||||
|
day: "2-digit",
|
||||||
|
month: "short"
|
||||||
|
})}</>;
|
||||||
|
}
|
||||||
|
|
||||||
|
function numberSetting(
|
||||||
|
value: unknown,
|
||||||
|
fallback: number,
|
||||||
|
minimum: number,
|
||||||
|
maximum: number
|
||||||
|
): number {
|
||||||
|
const numeric = typeof value === "number" ? value : Number(value);
|
||||||
|
return Number.isFinite(numeric)
|
||||||
|
? Math.max(minimum, Math.min(maximum, Math.floor(numeric)))
|
||||||
|
: fallback;
|
||||||
|
}
|
||||||
@@ -35,6 +35,21 @@ export type SchedulingRequestGroups = {
|
|||||||
other: SchedulingRequest[];
|
other: SchedulingRequest[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type SchedulingLifecycleStageId = "prepare" | "participate" | "decide";
|
||||||
|
|
||||||
|
export type SchedulingLifecycleStageState =
|
||||||
|
| "complete"
|
||||||
|
| "current"
|
||||||
|
| "locked"
|
||||||
|
| "stopped";
|
||||||
|
|
||||||
|
export type SchedulingLifecycleStage = {
|
||||||
|
id: SchedulingLifecycleStageId;
|
||||||
|
state: SchedulingLifecycleStageState;
|
||||||
|
current: boolean;
|
||||||
|
locked: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
export type SchedulingSortPhase =
|
export type SchedulingSortPhase =
|
||||||
| "unanswered"
|
| "unanswered"
|
||||||
| "answered"
|
| "answered"
|
||||||
@@ -282,6 +297,37 @@ export function schedulingRequestIsPast(
|
|||||||
return slotEnds.every((value) => Number.isFinite(value) && value < now.getTime());
|
return slotEnds.every((value) => Number.isFinite(value) && value < now.getTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function schedulingLifecycleStages(
|
||||||
|
status: SchedulingRequest["status"]
|
||||||
|
): SchedulingLifecycleStage[] {
|
||||||
|
const currentIndex = status === "draft"
|
||||||
|
? 0
|
||||||
|
: status === "collecting" || status === "cancelled"
|
||||||
|
? 1
|
||||||
|
: 2;
|
||||||
|
const completedThrough = status === "draft"
|
||||||
|
? -1
|
||||||
|
: status === "collecting" || status === "cancelled"
|
||||||
|
? 0
|
||||||
|
: status === "closed"
|
||||||
|
? 1
|
||||||
|
: 2;
|
||||||
|
const stopped = status === "cancelled";
|
||||||
|
|
||||||
|
return (["prepare", "participate", "decide"] as const).map((id, index) => {
|
||||||
|
const current = index === currentIndex;
|
||||||
|
const locked = index > completedThrough + 1;
|
||||||
|
const state: SchedulingLifecycleStageState = stopped && current
|
||||||
|
? "stopped"
|
||||||
|
: index <= completedThrough
|
||||||
|
? "complete"
|
||||||
|
: current
|
||||||
|
? "current"
|
||||||
|
: "locked";
|
||||||
|
return { id, state, current, locked };
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function schedulingInvitationActionBlocks(
|
export function schedulingInvitationActionBlocks(
|
||||||
request: SchedulingRequest,
|
request: SchedulingRequest,
|
||||||
participant: SchedulingParticipant,
|
participant: SchedulingParticipant,
|
||||||
|
|||||||
@@ -1,5 +1,43 @@
|
|||||||
export const generatedTranslations = {
|
export const generatedTranslations = {
|
||||||
en: {
|
en: {
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.access": "Open self-enrollment",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.bind_account": "Bind this enrollment to my signed-in account",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.bind_help": "Account binding requires confirmation and lets you manage this response from Scheduling.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.claim_anonymous": "Bind an earlier anonymous enrollment using its recovery proof",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.expires": "Self-enrollment link expires",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.invalid": "This self-enrollment link is invalid, expired, full, or the supplied details are incorrect.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.proof": "Anonymous recovery proof",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.proof_help": "Keep this value privately. It is required to update or later bind an anonymous response and is never stored in clear text.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.remaining": "Enrollment places remaining",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.submit": "Enroll and submit response",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.saved": "Your enrollment and response have been recorded.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.participant_details": "Participant details",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.links": "Public self-enrollment links",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.links_help": "Reusable links are separate from participant invitations. Every link requires a capacity and expiry and is shown only once when copied.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.expires_at": "Expires at",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.maximum": "Maximum enrollments",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.allow_anonymous": "Allow anonymous enrollment with a recovery proof",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.allow_authenticated": "Allow signed-in enrollment after account-binding confirmation",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.issue_copy": "Issue and copy link",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.open_first": "Open the request before issuing a self-enrollment link.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.loading_links": "Loading self-enrollment links…",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.no_links": "No self-enrollment links have been issued.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.revoke_title": "Revoke self-enrollment link",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.revoke_message": "This stops the reusable link immediately. Existing participant responses remain governed by the request policy.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.copied": "A new self-enrollment link was issued and copied. Its credential will not be shown again.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.revoked": "The self-enrollment link was revoked.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.load_failed": "Self-enrollment links could not be loaded.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.issue_failed": "The self-enrollment link could not be issued.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.revoke_failed": "The self-enrollment link could not be revoked.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.clipboard_failed": "The link was issued, but clipboard access is unavailable. The new link will be revoked automatically.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.mode_anonymous": "anonymous",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.mode_authenticated": "signed in",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.status_active": "Active",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.status_expired": "Expired",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.status_revoked": "Revoked",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.status_exhausted": "Full",
|
||||||
|
"i18n:govoplan-scheduling.calendar_cleanup_retry_title": "Calendar cleanup requires attention.",
|
||||||
|
"i18n:govoplan-scheduling.calendar_cleanup_retry_message": "{value0} tentative hold operations remain. Reconcile failed Calendar outbound changes if necessary, then repeat the original decision or cancellation action.",
|
||||||
"i18n:govoplan-scheduling.access_details.79c06b89": "Access details",
|
"i18n:govoplan-scheduling.access_details.79c06b89": "Access details",
|
||||||
"i18n:govoplan-scheduling.automatic_invitation_delivery_is_unavailable_copy_the_link_instead.4e39d0b3": "Automatic invitation delivery is unavailable; copy the link instead.",
|
"i18n:govoplan-scheduling.automatic_invitation_delivery_is_unavailable_copy_the_link_instead.4e39d0b3": "Automatic invitation delivery is unavailable; copy the link instead.",
|
||||||
"i18n:govoplan-scheduling.cancellation_notice_available_until.f840d1e6": "Cancellation notice available until",
|
"i18n:govoplan-scheduling.cancellation_notice_available_until.f840d1e6": "Cancellation notice available until",
|
||||||
@@ -78,6 +116,7 @@ export const generatedTranslations = {
|
|||||||
"i18n:govoplan-scheduling.configured_calendar.e2e8ebd5": "Configured calendar",
|
"i18n:govoplan-scheduling.configured_calendar.e2e8ebd5": "Configured calendar",
|
||||||
"i18n:govoplan-scheduling.calendar_integration.181ad18b": "Calendar integration",
|
"i18n:govoplan-scheduling.calendar_integration.181ad18b": "Calendar integration",
|
||||||
"i18n:govoplan-scheduling.calendar_integration_requires_the_calendar_module_plus_c.f892cb1e": "Calendar integration requires the Calendar module plus calendar-read, availability-read, and event-write access.",
|
"i18n:govoplan-scheduling.calendar_integration_requires_the_calendar_module_plus_c.f892cb1e": "Calendar integration requires the Calendar module plus calendar-read, availability-read, and event-write access.",
|
||||||
|
"i18n:govoplan-scheduling.enable_calendar_and_grant_calendar_availability_and_event_access.f1a20106": "Enable Calendar and grant calendar, availability, and event access.",
|
||||||
"i18n:govoplan-scheduling.candidate_availability.9541c4b5": "Candidate availability",
|
"i18n:govoplan-scheduling.candidate_availability.9541c4b5": "Candidate availability",
|
||||||
"i18n:govoplan-scheduling.candidate_slots.c414946b": "Candidate slots",
|
"i18n:govoplan-scheduling.candidate_slots.c414946b": "Candidate slots",
|
||||||
"i18n:govoplan-scheduling.check_free_busy.e9700e00": "Check free/busy",
|
"i18n:govoplan-scheduling.check_free_busy.e9700e00": "Check free/busy",
|
||||||
@@ -97,6 +136,7 @@ export const generatedTranslations = {
|
|||||||
"i18n:govoplan-scheduling.discard.36fff63c": "Discard",
|
"i18n:govoplan-scheduling.discard.36fff63c": "Discard",
|
||||||
"i18n:govoplan-scheduling.discard_this_unsaved_scheduling_request.4a956be2": "Discard this unsaved scheduling request?",
|
"i18n:govoplan-scheduling.discard_this_unsaved_scheduling_request.4a956be2": "Discard this unsaved scheduling request?",
|
||||||
"i18n:govoplan-scheduling.draft.23d33e22": "Draft",
|
"i18n:govoplan-scheduling.draft.23d33e22": "Draft",
|
||||||
|
"i18n:govoplan-scheduling.enable_enforceable_public_participation_controls_or_keep_participation_signed_in.f1a20105": "Enable enforceable public participation controls, or keep participation signed in.",
|
||||||
"i18n:govoplan-scheduling.end.a2bb9d34": "End",
|
"i18n:govoplan-scheduling.end.a2bb9d34": "End",
|
||||||
"i18n:govoplan-scheduling.error.7f2f6a15": "Error",
|
"i18n:govoplan-scheduling.error.7f2f6a15": "Error",
|
||||||
"i18n:govoplan-scheduling.every_candidate_slot_must_end_after_it_starts.47836010": "Every candidate slot must end after it starts.",
|
"i18n:govoplan-scheduling.every_candidate_slot_must_end_after_it_starts.47836010": "Every candidate slot must end after it starts.",
|
||||||
@@ -124,6 +164,8 @@ export const generatedTranslations = {
|
|||||||
"i18n:govoplan-scheduling.other_scheduling_requests.5cb6eb30": "Other scheduling requests",
|
"i18n:govoplan-scheduling.other_scheduling_requests.5cb6eb30": "Other scheduling requests",
|
||||||
"i18n:govoplan-scheduling.participant_email.2cadfd9e": "Participant email",
|
"i18n:govoplan-scheduling.participant_email.2cadfd9e": "Participant email",
|
||||||
"i18n:govoplan-scheduling.participant_names_and_statuses_are_hidden_aggregate_counts_r.d811a69a": "Participant names and statuses are hidden. Aggregate counts remain visible.",
|
"i18n:govoplan-scheduling.participant_names_and_statuses_are_hidden_aggregate_counts_r.d811a69a": "Participant names and statuses are hidden. Aggregate counts remain visible.",
|
||||||
|
"i18n:govoplan-scheduling.participant_removed.0cf4ec4c": "Participant removed",
|
||||||
|
"i18n:govoplan-scheduling.participant_replaced.2623752d": "Participant replaced",
|
||||||
"i18n:govoplan-scheduling.share_participant_names_and_response_statuses.df0bf9e0": "Share participant names and response statuses",
|
"i18n:govoplan-scheduling.share_participant_names_and_response_statuses.df0bf9e0": "Share participant names and response statuses",
|
||||||
"i18n:govoplan-scheduling.when_enabled_participants_can_see_other_participants_names.3ac78361": "When enabled, participants can see other participants' names and response statuses. Email addresses and invitation details remain private.",
|
"i18n:govoplan-scheduling.when_enabled_participants_can_see_other_participants_names.3ac78361": "When enabled, participants can see other participants' names and response statuses. Email addresses and invitation details remain private.",
|
||||||
"i18n:govoplan-scheduling.participants.cd56e083": "Participants",
|
"i18n:govoplan-scheduling.participants.cd56e083": "Participants",
|
||||||
@@ -131,6 +173,7 @@ export const generatedTranslations = {
|
|||||||
"i18n:govoplan-scheduling.pending.96f608c1": "Pending",
|
"i18n:govoplan-scheduling.pending.96f608c1": "Pending",
|
||||||
"i18n:govoplan-scheduling.queued.6a599877": "Queued",
|
"i18n:govoplan-scheduling.queued.6a599877": "Queued",
|
||||||
"i18n:govoplan-scheduling.refresh_requests.0a3ed7a1": "Refresh requests",
|
"i18n:govoplan-scheduling.refresh_requests.0a3ed7a1": "Refresh requests",
|
||||||
|
"i18n:govoplan-scheduling.required_action.f1a20101": "Required action",
|
||||||
"i18n:govoplan-scheduling.reminder_creates_a_notification_job_for_every_active_par.7ec68797": "Reminder creates a notification job for every active participant.",
|
"i18n:govoplan-scheduling.reminder_creates_a_notification_job_for_every_active_par.7ec68797": "Reminder creates a notification job for every active participant.",
|
||||||
"i18n:govoplan-scheduling.remove.e963907d": "Remove",
|
"i18n:govoplan-scheduling.remove.e963907d": "Remove",
|
||||||
"i18n:govoplan-scheduling.remove_participant_value.e55f2b70": "Remove participant {value0}",
|
"i18n:govoplan-scheduling.remove_participant_value.e55f2b70": "Remove participant {value0}",
|
||||||
@@ -155,6 +198,7 @@ export const generatedTranslations = {
|
|||||||
"i18n:govoplan-scheduling.sent.35f49dcf": "Sent",
|
"i18n:govoplan-scheduling.sent.35f49dcf": "Sent",
|
||||||
"i18n:govoplan-scheduling.skipped.5a000ad7": "Skipped",
|
"i18n:govoplan-scheduling.skipped.5a000ad7": "Skipped",
|
||||||
"i18n:govoplan-scheduling.start.952f3754": "Start",
|
"i18n:govoplan-scheduling.start.952f3754": "Start",
|
||||||
|
"i18n:govoplan-scheduling.system_or_tenant_administrator.f1a20104": "System or tenant administrator",
|
||||||
"i18n:govoplan-scheduling.status.bae7d5be": "Status",
|
"i18n:govoplan-scheduling.status.bae7d5be": "Status",
|
||||||
"i18n:govoplan-scheduling.submit_response.a5f0c053": "Submit response",
|
"i18n:govoplan-scheduling.submit_response.a5f0c053": "Submit response",
|
||||||
"i18n:govoplan-scheduling.tentative_holds_create_one_provisional_calendar_event_pe.ff3f1884": "Tentative holds create one provisional calendar event per candidate slot.",
|
"i18n:govoplan-scheduling.tentative_holds_create_one_provisional_calendar_event_pe.ff3f1884": "Tentative holds create one provisional calendar event per candidate slot.",
|
||||||
@@ -168,10 +212,50 @@ export const generatedTranslations = {
|
|||||||
"i18n:govoplan-scheduling.value_participants.e776b092": "{value0} participants",
|
"i18n:govoplan-scheduling.value_participants.e776b092": "{value0} participants",
|
||||||
"i18n:govoplan-scheduling.value_responses.ba17af9a": "{value0} responses",
|
"i18n:govoplan-scheduling.value_responses.ba17af9a": "{value0} responses",
|
||||||
"i18n:govoplan-scheduling.what_do_these_actions_do.9a9aee0e": "What do these actions do?",
|
"i18n:govoplan-scheduling.what_do_these_actions_do.9a9aee0e": "What do these actions do?",
|
||||||
|
"i18n:govoplan-scheduling.where_to_go.f1a20103": "Where to go",
|
||||||
|
"i18n:govoplan-scheduling.who_can_fix_it.f1a20102": "Who can fix it",
|
||||||
"i18n:govoplan-scheduling.you_can_respond_here_or_use_the_invitation_link_you_rece.1a25fd53": "You can respond here or use the invitation link you received.",
|
"i18n:govoplan-scheduling.you_can_respond_here_or_use_the_invitation_link_you_rece.1a25fd53": "You can respond here or use the invitation link you received.",
|
||||||
"i18n:govoplan-scheduling.your_response_has_been_recorded.b855088d": "Your response has been recorded."
|
"i18n:govoplan-scheduling.your_response_has_been_recorded.b855088d": "Your response has been recorded."
|
||||||
},
|
},
|
||||||
de: {
|
de: {
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.access": "Selbstanmeldung öffnen",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.bind_account": "Diese Anmeldung mit meinem angemeldeten Konto verknüpfen",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.bind_help": "Die Kontoverknüpfung muss bestätigt werden und ermöglicht die Verwaltung dieser Antwort in der Terminplanung.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.claim_anonymous": "Eine frühere anonyme Anmeldung mit ihrem Wiederherstellungsnachweis verknüpfen",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.expires": "Link zur Selbstanmeldung läuft ab",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.invalid": "Dieser Link zur Selbstanmeldung ist ungültig, abgelaufen oder vollständig belegt, oder die angegebenen Daten sind falsch.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.proof": "Wiederherstellungsnachweis für anonyme Anmeldung",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.proof_help": "Bewahren Sie diesen Wert vertraulich auf. Er wird zum Aktualisieren oder späteren Verknüpfen einer anonymen Antwort benötigt und nie im Klartext gespeichert.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.remaining": "Verbleibende Anmeldeplätze",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.submit": "Anmelden und Antwort senden",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.saved": "Ihre Anmeldung und Antwort wurden gespeichert.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.participant_details": "Angaben zur teilnehmenden Person",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.links": "Öffentliche Links zur Selbstanmeldung",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.links_help": "Wiederverwendbare Links sind von persönlichen Einladungen getrennt. Jeder Link benötigt eine Kapazität und ein Ablaufdatum und wird beim Kopieren nur einmal angezeigt.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.expires_at": "Läuft ab am",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.maximum": "Maximale Anmeldungen",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.allow_anonymous": "Anonyme Anmeldung mit Wiederherstellungsnachweis zulassen",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.allow_authenticated": "Anmeldung mit Konto nach Bestätigung der Verknüpfung zulassen",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.issue_copy": "Link ausstellen und kopieren",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.open_first": "Öffnen Sie die Anfrage, bevor Sie einen Link zur Selbstanmeldung ausstellen.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.loading_links": "Links zur Selbstanmeldung werden geladen …",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.no_links": "Es wurden noch keine Links zur Selbstanmeldung ausgestellt.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.revoke_title": "Link zur Selbstanmeldung widerrufen",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.revoke_message": "Der wiederverwendbare Link wird sofort deaktiviert. Vorhandene Antworten bleiben weiterhin durch die Richtlinie der Anfrage geregelt.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.copied": "Ein neuer Link zur Selbstanmeldung wurde ausgestellt und kopiert. Seine Zugangsdaten werden nicht erneut angezeigt.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.revoked": "Der Link zur Selbstanmeldung wurde widerrufen.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.load_failed": "Die Links zur Selbstanmeldung konnten nicht geladen werden.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.issue_failed": "Der Link zur Selbstanmeldung konnte nicht ausgestellt werden.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.revoke_failed": "Der Link zur Selbstanmeldung konnte nicht widerrufen werden.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.clipboard_failed": "Der Link wurde ausgestellt, aber die Zwischenablage ist nicht verfügbar. Der neue Link wird automatisch widerrufen.",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.mode_anonymous": "anonym",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.mode_authenticated": "angemeldet",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.status_active": "Aktiv",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.status_expired": "Abgelaufen",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.status_revoked": "Widerrufen",
|
||||||
|
"i18n:govoplan-scheduling.self_enrollment.status_exhausted": "Vollständig belegt",
|
||||||
|
"i18n:govoplan-scheduling.calendar_cleanup_retry_title": "Die Kalenderbereinigung erfordert Aufmerksamkeit.",
|
||||||
|
"i18n:govoplan-scheduling.calendar_cleanup_retry_message": "{value0} Vorgänge für vorläufige Reservierungen stehen noch aus. Gleichen Sie fehlgeschlagene ausgehende Kalenderänderungen bei Bedarf ab und wiederholen Sie anschließend die ursprüngliche Entscheidungs- oder Abbruchaktion.",
|
||||||
"i18n:govoplan-scheduling.access_details.79c06b89": "Zugangsdaten",
|
"i18n:govoplan-scheduling.access_details.79c06b89": "Zugangsdaten",
|
||||||
"i18n:govoplan-scheduling.automatic_invitation_delivery_is_unavailable_copy_the_link_instead.4e39d0b3": "Die automatische Einladungszustellung ist nicht verfügbar; kopieren Sie stattdessen den Link.",
|
"i18n:govoplan-scheduling.automatic_invitation_delivery_is_unavailable_copy_the_link_instead.4e39d0b3": "Die automatische Einladungszustellung ist nicht verfügbar; kopieren Sie stattdessen den Link.",
|
||||||
"i18n:govoplan-scheduling.cancellation_notice_available_until.f840d1e6": "Stornierungshinweis verfügbar bis",
|
"i18n:govoplan-scheduling.cancellation_notice_available_until.f840d1e6": "Stornierungshinweis verfügbar bis",
|
||||||
@@ -250,6 +334,7 @@ export const generatedTranslations = {
|
|||||||
"i18n:govoplan-scheduling.configured_calendar.e2e8ebd5": "Ausgewählter Kalender",
|
"i18n:govoplan-scheduling.configured_calendar.e2e8ebd5": "Ausgewählter Kalender",
|
||||||
"i18n:govoplan-scheduling.calendar_integration.181ad18b": "Kalenderintegration",
|
"i18n:govoplan-scheduling.calendar_integration.181ad18b": "Kalenderintegration",
|
||||||
"i18n:govoplan-scheduling.calendar_integration_requires_the_calendar_module_plus_c.f892cb1e": "Die Kalenderintegration benötigt das Kalendermodul sowie Leserechte für Kalender und Verfügbarkeiten und Schreibrechte für Termine.",
|
"i18n:govoplan-scheduling.calendar_integration_requires_the_calendar_module_plus_c.f892cb1e": "Die Kalenderintegration benötigt das Kalendermodul sowie Leserechte für Kalender und Verfügbarkeiten und Schreibrechte für Termine.",
|
||||||
|
"i18n:govoplan-scheduling.enable_calendar_and_grant_calendar_availability_and_event_access.f1a20106": "Aktivieren Sie Kalender und vergeben Sie Rechte für Kalender, Verfügbarkeiten und Termine.",
|
||||||
"i18n:govoplan-scheduling.candidate_availability.9541c4b5": "Verfügbarkeit zu den Vorschlägen",
|
"i18n:govoplan-scheduling.candidate_availability.9541c4b5": "Verfügbarkeit zu den Vorschlägen",
|
||||||
"i18n:govoplan-scheduling.candidate_slots.c414946b": "Terminvorschläge",
|
"i18n:govoplan-scheduling.candidate_slots.c414946b": "Terminvorschläge",
|
||||||
"i18n:govoplan-scheduling.check_free_busy.e9700e00": "Frei/Belegt prüfen",
|
"i18n:govoplan-scheduling.check_free_busy.e9700e00": "Frei/Belegt prüfen",
|
||||||
@@ -269,6 +354,7 @@ export const generatedTranslations = {
|
|||||||
"i18n:govoplan-scheduling.discard.36fff63c": "Verwerfen",
|
"i18n:govoplan-scheduling.discard.36fff63c": "Verwerfen",
|
||||||
"i18n:govoplan-scheduling.discard_this_unsaved_scheduling_request.4a956be2": "Diese ungespeicherte Terminanfrage verwerfen?",
|
"i18n:govoplan-scheduling.discard_this_unsaved_scheduling_request.4a956be2": "Diese ungespeicherte Terminanfrage verwerfen?",
|
||||||
"i18n:govoplan-scheduling.draft.23d33e22": "Entwurf",
|
"i18n:govoplan-scheduling.draft.23d33e22": "Entwurf",
|
||||||
|
"i18n:govoplan-scheduling.enable_enforceable_public_participation_controls_or_keep_participation_signed_in.f1a20105": "Aktivieren Sie durchsetzbare Regeln für die öffentliche Teilnahme oder beschränken Sie die Teilnahme auf angemeldete Personen.",
|
||||||
"i18n:govoplan-scheduling.end.a2bb9d34": "Ende",
|
"i18n:govoplan-scheduling.end.a2bb9d34": "Ende",
|
||||||
"i18n:govoplan-scheduling.error.7f2f6a15": "Fehler",
|
"i18n:govoplan-scheduling.error.7f2f6a15": "Fehler",
|
||||||
"i18n:govoplan-scheduling.every_candidate_slot_must_end_after_it_starts.47836010": "Jeder Terminvorschlag muss nach seinem Beginn enden.",
|
"i18n:govoplan-scheduling.every_candidate_slot_must_end_after_it_starts.47836010": "Jeder Terminvorschlag muss nach seinem Beginn enden.",
|
||||||
@@ -296,6 +382,8 @@ export const generatedTranslations = {
|
|||||||
"i18n:govoplan-scheduling.other_scheduling_requests.5cb6eb30": "Andere Terminanfragen",
|
"i18n:govoplan-scheduling.other_scheduling_requests.5cb6eb30": "Andere Terminanfragen",
|
||||||
"i18n:govoplan-scheduling.participant_email.2cadfd9e": "E-Mail der teilnehmenden Person",
|
"i18n:govoplan-scheduling.participant_email.2cadfd9e": "E-Mail der teilnehmenden Person",
|
||||||
"i18n:govoplan-scheduling.participant_names_and_statuses_are_hidden_aggregate_counts_r.d811a69a": "Namen und Antwortstatus der Teilnehmenden sind ausgeblendet. Zusammengefasste Anzahlen bleiben sichtbar.",
|
"i18n:govoplan-scheduling.participant_names_and_statuses_are_hidden_aggregate_counts_r.d811a69a": "Namen und Antwortstatus der Teilnehmenden sind ausgeblendet. Zusammengefasste Anzahlen bleiben sichtbar.",
|
||||||
|
"i18n:govoplan-scheduling.participant_removed.0cf4ec4c": "Teilnehmende Person entfernt",
|
||||||
|
"i18n:govoplan-scheduling.participant_replaced.2623752d": "Teilnehmende Person ersetzt",
|
||||||
"i18n:govoplan-scheduling.share_participant_names_and_response_statuses.df0bf9e0": "Namen und Antwortstatus der Teilnehmenden freigeben",
|
"i18n:govoplan-scheduling.share_participant_names_and_response_statuses.df0bf9e0": "Namen und Antwortstatus der Teilnehmenden freigeben",
|
||||||
"i18n:govoplan-scheduling.when_enabled_participants_can_see_other_participants_names.3ac78361": "Wenn aktiviert, sehen Teilnehmende die Namen und Antwortstatus anderer Teilnehmender. E-Mail-Adressen und Einladungsdetails bleiben privat.",
|
"i18n:govoplan-scheduling.when_enabled_participants_can_see_other_participants_names.3ac78361": "Wenn aktiviert, sehen Teilnehmende die Namen und Antwortstatus anderer Teilnehmender. E-Mail-Adressen und Einladungsdetails bleiben privat.",
|
||||||
"i18n:govoplan-scheduling.participants.cd56e083": "Teilnehmende",
|
"i18n:govoplan-scheduling.participants.cd56e083": "Teilnehmende",
|
||||||
@@ -303,6 +391,7 @@ export const generatedTranslations = {
|
|||||||
"i18n:govoplan-scheduling.pending.96f608c1": "Ausstehend",
|
"i18n:govoplan-scheduling.pending.96f608c1": "Ausstehend",
|
||||||
"i18n:govoplan-scheduling.queued.6a599877": "Eingereiht",
|
"i18n:govoplan-scheduling.queued.6a599877": "Eingereiht",
|
||||||
"i18n:govoplan-scheduling.refresh_requests.0a3ed7a1": "Anfragen aktualisieren",
|
"i18n:govoplan-scheduling.refresh_requests.0a3ed7a1": "Anfragen aktualisieren",
|
||||||
|
"i18n:govoplan-scheduling.required_action.f1a20101": "Erforderliche Maßnahme",
|
||||||
"i18n:govoplan-scheduling.reminder_creates_a_notification_job_for_every_active_par.7ec68797": "Erinnern erstellt für jede aktive teilnehmende Person einen Benachrichtigungsauftrag.",
|
"i18n:govoplan-scheduling.reminder_creates_a_notification_job_for_every_active_par.7ec68797": "Erinnern erstellt für jede aktive teilnehmende Person einen Benachrichtigungsauftrag.",
|
||||||
"i18n:govoplan-scheduling.remove.e963907d": "Entfernen",
|
"i18n:govoplan-scheduling.remove.e963907d": "Entfernen",
|
||||||
"i18n:govoplan-scheduling.remove_participant_value.e55f2b70": "Teilnehmende Person {value0} entfernen",
|
"i18n:govoplan-scheduling.remove_participant_value.e55f2b70": "Teilnehmende Person {value0} entfernen",
|
||||||
@@ -327,6 +416,7 @@ export const generatedTranslations = {
|
|||||||
"i18n:govoplan-scheduling.sent.35f49dcf": "Gesendet",
|
"i18n:govoplan-scheduling.sent.35f49dcf": "Gesendet",
|
||||||
"i18n:govoplan-scheduling.skipped.5a000ad7": "Übersprungen",
|
"i18n:govoplan-scheduling.skipped.5a000ad7": "Übersprungen",
|
||||||
"i18n:govoplan-scheduling.start.952f3754": "Beginn",
|
"i18n:govoplan-scheduling.start.952f3754": "Beginn",
|
||||||
|
"i18n:govoplan-scheduling.system_or_tenant_administrator.f1a20104": "System- oder Mandantenadministration",
|
||||||
"i18n:govoplan-scheduling.status.bae7d5be": "Status",
|
"i18n:govoplan-scheduling.status.bae7d5be": "Status",
|
||||||
"i18n:govoplan-scheduling.submit_response.a5f0c053": "Antwort senden",
|
"i18n:govoplan-scheduling.submit_response.a5f0c053": "Antwort senden",
|
||||||
"i18n:govoplan-scheduling.tentative_holds_create_one_provisional_calendar_event_pe.ff3f1884": "Vorläufige Reservierungen erstellen je Terminvorschlag einen provisorischen Kalendereintrag.",
|
"i18n:govoplan-scheduling.tentative_holds_create_one_provisional_calendar_event_pe.ff3f1884": "Vorläufige Reservierungen erstellen je Terminvorschlag einen provisorischen Kalendereintrag.",
|
||||||
@@ -340,6 +430,8 @@ export const generatedTranslations = {
|
|||||||
"i18n:govoplan-scheduling.value_participants.e776b092": "{value0} Teilnehmende",
|
"i18n:govoplan-scheduling.value_participants.e776b092": "{value0} Teilnehmende",
|
||||||
"i18n:govoplan-scheduling.value_responses.ba17af9a": "{value0} Antworten",
|
"i18n:govoplan-scheduling.value_responses.ba17af9a": "{value0} Antworten",
|
||||||
"i18n:govoplan-scheduling.what_do_these_actions_do.9a9aee0e": "Was bewirken diese Aktionen?",
|
"i18n:govoplan-scheduling.what_do_these_actions_do.9a9aee0e": "Was bewirken diese Aktionen?",
|
||||||
|
"i18n:govoplan-scheduling.where_to_go.f1a20103": "Ziel",
|
||||||
|
"i18n:govoplan-scheduling.who_can_fix_it.f1a20102": "Zuständig",
|
||||||
"i18n:govoplan-scheduling.you_can_respond_here_or_use_the_invitation_link_you_rece.1a25fd53": "Sie können hier oder über den erhaltenen Einladungslink antworten.",
|
"i18n:govoplan-scheduling.you_can_respond_here_or_use_the_invitation_link_you_rece.1a25fd53": "Sie können hier oder über den erhaltenen Einladungslink antworten.",
|
||||||
"i18n:govoplan-scheduling.your_response_has_been_recorded.b855088d": "Ihre Antwort wurde gespeichert."
|
"i18n:govoplan-scheduling.your_response_has_been_recorded.b855088d": "Ihre Antwort wurde gespeichert."
|
||||||
}
|
}
|
||||||
|
|||||||
+69
-3
@@ -1,20 +1,78 @@
|
|||||||
import { createElement, lazy } from "react";
|
import { createElement, lazy } from "react";
|
||||||
import type { PlatformWebModule } from "@govoplan/core-webui";
|
import type {
|
||||||
|
DashboardWidgetsUiCapability,
|
||||||
|
PlatformWebModule
|
||||||
|
} from "@govoplan/core-webui";
|
||||||
|
import SchedulingRequestsWidget from "./features/scheduling/SchedulingRequestsWidget";
|
||||||
import { generatedTranslations } from "./i18n/generatedTranslations";
|
import { generatedTranslations } from "./i18n/generatedTranslations";
|
||||||
import "./styles/scheduling.css";
|
import "./styles/scheduling.css";
|
||||||
|
|
||||||
const SchedulingPage = lazy(() => import("./features/scheduling/SchedulingPage"));
|
const SchedulingPage = lazy(() => import("./features/scheduling/SchedulingPage"));
|
||||||
const SchedulingPublicPage = lazy(() => import("./features/scheduling/SchedulingPublicPage"));
|
const SchedulingPublicPage = lazy(() => import("./features/scheduling/SchedulingPublicPage"));
|
||||||
|
const SchedulingEnrollmentPage = lazy(() => import("./features/scheduling/SchedulingEnrollmentPage"));
|
||||||
|
|
||||||
const scheduleRead = ["scheduling:schedule:read"];
|
const scheduleRead = ["scheduling:schedule:read"];
|
||||||
|
const schedulingDashboardWidgets: DashboardWidgetsUiCapability = {
|
||||||
|
widgets: [
|
||||||
|
{
|
||||||
|
id: "scheduling.open-requests",
|
||||||
|
surfaceId: "scheduling.widget.open-requests",
|
||||||
|
title: "Scheduling requests",
|
||||||
|
description: "Open scheduling polls and their response progress.",
|
||||||
|
moduleId: "scheduling",
|
||||||
|
category: "Planning",
|
||||||
|
order: 45,
|
||||||
|
defaultVisible: false,
|
||||||
|
defaultSize: "medium",
|
||||||
|
supportedSizes: ["medium", "wide"],
|
||||||
|
anyOf: scheduleRead,
|
||||||
|
refreshIntervalMs: 60_000,
|
||||||
|
defaultConfiguration: {
|
||||||
|
maxItems: 5,
|
||||||
|
includeDrafts: false
|
||||||
|
},
|
||||||
|
configurationFields: [
|
||||||
|
{
|
||||||
|
id: "maxItems",
|
||||||
|
label: "Maximum requests",
|
||||||
|
kind: "number",
|
||||||
|
min: 1,
|
||||||
|
max: 12,
|
||||||
|
step: 1,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "includeDrafts",
|
||||||
|
label: "Include drafts",
|
||||||
|
kind: "boolean"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
render: ({ settings, refreshKey, configuration }) =>
|
||||||
|
createElement(SchedulingRequestsWidget, {
|
||||||
|
settings,
|
||||||
|
refreshKey,
|
||||||
|
configuration
|
||||||
|
})
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
export const schedulingModule: PlatformWebModule = {
|
export const schedulingModule: PlatformWebModule = {
|
||||||
id: "scheduling",
|
id: "scheduling",
|
||||||
label: "Scheduling",
|
label: "Scheduling",
|
||||||
version: "0.1.11",
|
version: "0.1.20",
|
||||||
dependencies: ["poll"],
|
dependencies: ["poll"],
|
||||||
optionalDependencies: ["access", "calendar", "mail", "notifications", "workflow", "appointments", "addresses"],
|
optionalDependencies: ["access", "calendar", "mail", "notifications", "workflow", "appointments", "addresses"],
|
||||||
translations: generatedTranslations,
|
translations: generatedTranslations,
|
||||||
|
viewSurfaces: [
|
||||||
|
{
|
||||||
|
id: "scheduling.widget.open-requests",
|
||||||
|
moduleId: "scheduling",
|
||||||
|
kind: "section",
|
||||||
|
label: "Scheduling requests widget",
|
||||||
|
order: 45
|
||||||
|
}
|
||||||
|
],
|
||||||
navItems: [{ to: "/scheduling", label: "Scheduling", iconName: "calendar-clock", anyOf: scheduleRead, order: 56 }],
|
navItems: [{ to: "/scheduling", label: "Scheduling", iconName: "calendar-clock", anyOf: scheduleRead, order: 56 }],
|
||||||
routes: [
|
routes: [
|
||||||
{ path: "/scheduling", anyOf: scheduleRead, order: 56, render: ({ settings, auth }) => createElement(SchedulingPage, { settings, auth }) }
|
{ path: "/scheduling", anyOf: scheduleRead, order: 56, render: ({ settings, auth }) => createElement(SchedulingPage, { settings, auth }) }
|
||||||
@@ -24,8 +82,16 @@ export const schedulingModule: PlatformWebModule = {
|
|||||||
path: "/scheduling/public/:requestId/:token",
|
path: "/scheduling/public/:requestId/:token",
|
||||||
order: 10,
|
order: 10,
|
||||||
render: ({ settings, auth }) => createElement(SchedulingPublicPage, { settings, auth })
|
render: ({ settings, auth }) => createElement(SchedulingPublicPage, { settings, auth })
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/scheduling/enrol/:requestId/:token",
|
||||||
|
order: 11,
|
||||||
|
render: ({ settings, auth }) => createElement(SchedulingEnrollmentPage, { settings, auth })
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
uiCapabilities: {
|
||||||
|
"dashboard.widgets": schedulingDashboardWidgets
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default schedulingModule;
|
export default schedulingModule;
|
||||||
|
|||||||
@@ -1,12 +1,3 @@
|
|||||||
.scheduling-page {
|
|
||||||
box-sizing: border-box;
|
|
||||||
height: calc(100vh - 115px);
|
|
||||||
min-height: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
color: var(--text);
|
|
||||||
background: var(--bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.scheduling-public-page {
|
.scheduling-public-page {
|
||||||
width: min(920px, calc(100% - 32px));
|
width: min(920px, calc(100% - 32px));
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
@@ -102,21 +93,11 @@
|
|||||||
padding-top: 12px;
|
padding-top: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.scheduling-public-page .form-grid.two-col {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scheduling-public-summary {
|
.scheduling-public-summary {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.scheduling-page *,
|
|
||||||
.scheduling-page *::before,
|
|
||||||
.scheduling-page *::after {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scheduling-workspace {
|
.scheduling-workspace {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@@ -341,12 +322,6 @@
|
|||||||
justify-items: start;
|
justify-items: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.scheduling-columns {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.scheduling-compact-row {
|
.scheduling-compact-row {
|
||||||
min-height: 36px;
|
min-height: 36px;
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -425,7 +400,37 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.scheduling-selected-calendar {
|
.scheduling-selected-calendar {
|
||||||
max-width: 520px;
|
max-width: 560px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scheduling-enrollment-confirmation {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 10px;
|
||||||
|
margin: 16px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scheduling-enrollment-confirmation span {
|
||||||
|
display: grid;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scheduling-enrollment-confirmation small,
|
||||||
|
.scheduling-enrollment-links small {
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scheduling-enrollment-modes,
|
||||||
|
.scheduling-enrollment-links {
|
||||||
|
display: grid;
|
||||||
|
gap: 10px;
|
||||||
|
margin-top: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scheduling-enrollment-links .scheduling-compact-row > span:first-child {
|
||||||
|
display: grid;
|
||||||
|
flex: 1;
|
||||||
|
gap: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
@media (max-width: 900px) {
|
||||||
@@ -435,7 +440,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 820px) {
|
@media (max-width: 760px) {
|
||||||
.scheduling-page {
|
.scheduling-page {
|
||||||
height: auto;
|
height: auto;
|
||||||
min-height: calc(100vh - 115px);
|
min-height: calc(100vh - 115px);
|
||||||
@@ -463,10 +468,6 @@
|
|||||||
border-bottom: var(--border-line);
|
border-bottom: var(--border-line);
|
||||||
}
|
}
|
||||||
|
|
||||||
.scheduling-columns {
|
|
||||||
grid-template-columns: minmax(0, 1fr);
|
|
||||||
}
|
|
||||||
|
|
||||||
.scheduling-page-header {
|
.scheduling-page-header {
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|||||||
@@ -8,11 +8,40 @@ import {
|
|||||||
participantDraftsFromPicker,
|
participantDraftsFromPicker,
|
||||||
participantPayload,
|
participantPayload,
|
||||||
schedulingInvitationActionBlocks,
|
schedulingInvitationActionBlocks,
|
||||||
|
schedulingLifecycleStages,
|
||||||
schedulingPublicInvitationUrl,
|
schedulingPublicInvitationUrl,
|
||||||
schedulingSortPhase,
|
schedulingSortPhase,
|
||||||
type SchedulingActor
|
type SchedulingActor
|
||||||
} from "../src/features/scheduling/schedulingViewModel.ts";
|
} from "../src/features/scheduling/schedulingViewModel.ts";
|
||||||
|
|
||||||
|
test("derives the scheduling lifecycle without inventing new backend states", () => {
|
||||||
|
assert.deepEqual(schedulingLifecycleStages("draft"), [
|
||||||
|
{ id: "prepare", state: "current", current: true, locked: false },
|
||||||
|
{ id: "participate", state: "locked", current: false, locked: true },
|
||||||
|
{ id: "decide", state: "locked", current: false, locked: true }
|
||||||
|
]);
|
||||||
|
assert.deepEqual(schedulingLifecycleStages("collecting"), [
|
||||||
|
{ id: "prepare", state: "complete", current: false, locked: false },
|
||||||
|
{ id: "participate", state: "current", current: true, locked: false },
|
||||||
|
{ id: "decide", state: "locked", current: false, locked: true }
|
||||||
|
]);
|
||||||
|
assert.deepEqual(schedulingLifecycleStages("closed"), [
|
||||||
|
{ id: "prepare", state: "complete", current: false, locked: false },
|
||||||
|
{ id: "participate", state: "complete", current: false, locked: false },
|
||||||
|
{ id: "decide", state: "current", current: true, locked: false }
|
||||||
|
]);
|
||||||
|
assert.deepEqual(schedulingLifecycleStages("handed_off").map((stage) => stage.state), [
|
||||||
|
"complete",
|
||||||
|
"complete",
|
||||||
|
"complete"
|
||||||
|
]);
|
||||||
|
assert.deepEqual(schedulingLifecycleStages("cancelled"), [
|
||||||
|
{ id: "prepare", state: "complete", current: false, locked: false },
|
||||||
|
{ id: "participate", state: "stopped", current: true, locked: false },
|
||||||
|
{ id: "decide", state: "locked", current: false, locked: true }
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
test("maps visible account and contact selections into bounded scheduling participant payloads", () => {
|
test("maps visible account and contact selections into bounded scheduling participant payloads", () => {
|
||||||
let sequence = 0;
|
let sequence = 0;
|
||||||
const selected = participantDraftsFromPicker([
|
const selected = participantDraftsFromPicker([
|
||||||
|
|||||||
Reference in New Issue
Block a user