UNPKG

@keycloakify/keycloak-admin-ui

Version:
29 lines 1.57 kB
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import { PageSection } from "@patternfly/react-core"; import { useAdminClient } from "../admin-client"; import { RolesList } from "../components/roles-list/RolesList"; import { ViewHeader } from "../components/view-header/ViewHeader"; import { useAccess } from "../context/access/Access"; import { useRealm } from "../context/realm-context/RealmContext"; import helpUrls from "../help-urls"; import { toAddRole } from "../realm-roles/routes/AddRole"; import { toRealmRole } from "../realm-roles/routes/RealmRole"; export default function RealmRolesSection() { const { adminClient } = useAdminClient(); const { realm } = useRealm(); const { hasAccess } = useAccess(); const isManager = hasAccess("manage-realm"); const loader = (first, max, search) => { const params = { first: first, max: max, }; const searchParam = search || ""; if (searchParam) { params.search = searchParam; } return adminClient.roles.find(params); }; return (_jsxs(_Fragment, { children: [_jsx(ViewHeader, { titleKey: "titleRoles", subKey: "roleExplain", helpUrl: helpUrls.realmRolesUrl }), _jsx(PageSection, { variant: "light", padding: { default: "noPadding" }, children: _jsx(RolesList, { loader: loader, toCreate: toAddRole({ realm }), toDetail: (roleId) => toRealmRole({ realm, id: roleId, tab: "details" }), isReadOnly: !isManager }) })] })); } //# sourceMappingURL=RealmRolesSection.js.map