fix: refresh Access Settings policy from /access response

Reopening the Access Settings dialog after a save could leave the
radio on the wrong policy: the form initialized `access_policy`
from the route list's snapshot, but the list isn't refreshed when
the dialog closes, so the snapshot's value silently shadowed the
just-saved policy.

Backend now returns the route's authoritative `access_policy` on
`GET /v2/model-routes/{id}/access`. Use that value when the GET
resolves, falling back to the parent snapshot only as the initial
seed so the radio isn't briefly unselected.

While we're here, widen the `access_policy` type from a closed
union to `string` — plugins can contribute additional policy
values via the `accessControl.allowedUsersOverride` slot, so the
wire type shouldn't restrict to the OSS-side enum.
This commit is contained in:
gitlawr
2026-05-11 19:30:21 +08:00
committed by jialin
parent f37fad11b1
commit 68235e188a
4 changed files with 24 additions and 7 deletions
@@ -23,7 +23,7 @@ const AccessControlModal: React.FC<
const handleOnFinish = async (values: AccessControlFormData) => {
try {
const data: any = {
const data: AccessControlFormData = {
access_policy: values.access_policy,
// `users` is only meaningful for the legacy `allowed_users`
// policy; for the plugin override (typically the principal-