feat(permissions): add reset to defaults button in permissions modals (#25931)

Adds a 'Reset to Defaults' button to both the Edit Default Permissions
modal and the Edit User Group permissions modal.

- Default permissions modal: resets to stock/env-var configuration
- User group modal: resets to current global default permissions

Backend: new GET /api/v1/users/default/permissions/defaults endpoint
that returns DEFAULT_USER_PERMISSIONS (env-var-based initial defaults).
This commit is contained in:
G30
2026-06-17 00:25:20 +02:00
committed by GitHub
parent 7ee75a0c04
commit 6b2d962cd6
3 changed files with 101 additions and 1 deletions
+27
View File
@@ -85,6 +85,33 @@ export const updateUserDefaultPermissions = async (token: string, permissions: o
return res;
};
export const getUserDefaultPermissionsDefaults = async (token: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/users/default/permissions/defaults`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
console.error(err);
error = err.detail;
return null;
});
if (error) {
throw error;
}
return res;
};
export const updateUserRole = async (token: string, id: string, role: string) => {
let error = null;