mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-09 15:02:05 -03:30
Fix missing response content type and more explicit error handling
Closes #36410 Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
parent
b997d0506f
commit
f392675d41
@ -43,6 +43,7 @@ import { emptyFormatter } from "../../util";
|
||||
import { useConfirmDialog } from "../confirm-dialog/ConfirmDialog";
|
||||
import { BruteUser, findUsers } from "../role-mapping/resource";
|
||||
import { UserDataTableToolbarItems } from "./UserDataTableToolbarItems";
|
||||
import { NetworkError } from "@keycloak/keycloak-admin-client";
|
||||
|
||||
export type UserFilter = {
|
||||
exact: boolean;
|
||||
@ -141,8 +142,13 @@ export function UserDataTable() {
|
||||
fetchRealmInfo(adminClient),
|
||||
adminClient.users.getProfile(),
|
||||
]);
|
||||
} catch {
|
||||
return [{}, {}] as [UiRealmInfo, UserProfileConfig];
|
||||
} catch (error) {
|
||||
if (error instanceof NetworkError && error?.response?.status === 403) {
|
||||
// "User Profile" attributes not available for Users Attribute search, when admin user does not have view- or manage-realm realm-management role
|
||||
return [{}, {}] as [UiRealmInfo, UserProfileConfig];
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
},
|
||||
([uiRealmInfo, profile]) => {
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
package org.keycloak.admin.ui.rest;
|
||||
|
||||
import jakarta.ws.rs.Produces;
|
||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
|
||||
import org.eclipse.microprofile.openapi.annotations.media.Content;
|
||||
@ -81,6 +82,7 @@ public class UIRealmResource {
|
||||
@Operation(summary = "Gets information about the realm, viewable by all realm admins")
|
||||
@APIResponse(responseCode = "200", description = "", content = {
|
||||
@Content(schema = @Schema(implementation = UIRealmInfo.class, type = SchemaType.OBJECT))})
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public UIRealmInfo getInfo() {
|
||||
auth.requireAnyAdminRole();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user