mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-09 23:12:06 -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 { useConfirmDialog } from "../confirm-dialog/ConfirmDialog";
|
||||||
import { BruteUser, findUsers } from "../role-mapping/resource";
|
import { BruteUser, findUsers } from "../role-mapping/resource";
|
||||||
import { UserDataTableToolbarItems } from "./UserDataTableToolbarItems";
|
import { UserDataTableToolbarItems } from "./UserDataTableToolbarItems";
|
||||||
|
import { NetworkError } from "@keycloak/keycloak-admin-client";
|
||||||
|
|
||||||
export type UserFilter = {
|
export type UserFilter = {
|
||||||
exact: boolean;
|
exact: boolean;
|
||||||
@ -141,8 +142,13 @@ export function UserDataTable() {
|
|||||||
fetchRealmInfo(adminClient),
|
fetchRealmInfo(adminClient),
|
||||||
adminClient.users.getProfile(),
|
adminClient.users.getProfile(),
|
||||||
]);
|
]);
|
||||||
} catch {
|
} catch (error) {
|
||||||
return [{}, {}] as [UiRealmInfo, UserProfileConfig];
|
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]) => {
|
([uiRealmInfo, profile]) => {
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package org.keycloak.admin.ui.rest;
|
package org.keycloak.admin.ui.rest;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.Produces;
|
||||||
import org.eclipse.microprofile.openapi.annotations.Operation;
|
import org.eclipse.microprofile.openapi.annotations.Operation;
|
||||||
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
|
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType;
|
||||||
import org.eclipse.microprofile.openapi.annotations.media.Content;
|
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")
|
@Operation(summary = "Gets information about the realm, viewable by all realm admins")
|
||||||
@APIResponse(responseCode = "200", description = "", content = {
|
@APIResponse(responseCode = "200", description = "", content = {
|
||||||
@Content(schema = @Schema(implementation = UIRealmInfo.class, type = SchemaType.OBJECT))})
|
@Content(schema = @Schema(implementation = UIRealmInfo.class, type = SchemaType.OBJECT))})
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public UIRealmInfo getInfo() {
|
public UIRealmInfo getInfo() {
|
||||||
auth.requireAnyAdminRole();
|
auth.requireAnyAdminRole();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user