Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
theme.keycloak.v2.admin.resources.assets.DedicatedScopes-a66dfcfe.js.map Maven / Gradle / Ivy
Go to download
The user inferface to administrate the Keycloak server.
{"version":3,"file":"DedicatedScopes-a66dfcfe.js","sources":["../../src/clients/scopes/DecicatedScope.tsx","../../src/clients/scopes/DedicatedScopes.tsx"],"sourcesContent":["import type ClientRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/clientRepresentation\";\nimport type { RoleMappingPayload } from \"@keycloak/keycloak-admin-client/lib/defs/roleRepresentation\";\nimport {\n AlertVariant,\n Divider,\n FormGroup,\n PageSection,\n Switch,\n} from \"@patternfly/react-core\";\nimport { useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { FormAccess } from \"../../components/form/FormAccess\";\nimport { HelpItem } from \"ui-shared\";\n\nimport { adminClient } from \"../../admin-client\";\nimport { useAlerts } from \"../../components/alert/Alerts\";\nimport { RoleMapping, Row } from \"../../components/role-mapping/RoleMapping\";\nimport { useAccess } from \"../../context/access/Access\";\n\ntype DedicatedScopeProps = {\n client: ClientRepresentation;\n};\n\nexport const DedicatedScope = ({\n client: initialClient,\n}: DedicatedScopeProps) => {\n const { t } = useTranslation(\"clients\");\n const { addAlert, addError } = useAlerts();\n\n const [client, setClient] = useState(initialClient);\n\n const { hasAccess } = useAccess();\n const isManager = hasAccess(\"manage-clients\") || client.access?.manage;\n\n const assignRoles = async (rows: Row[]) => {\n try {\n const realmRoles = rows\n .filter((row) => row.client === undefined)\n .map((row) => row.role as RoleMappingPayload)\n .flat();\n await Promise.all([\n adminClient.clients.addRealmScopeMappings(\n {\n id: client.id!,\n },\n realmRoles,\n ),\n ...rows\n .filter((row) => row.client !== undefined)\n .map((row) =>\n adminClient.clients.addClientScopeMappings(\n {\n id: client.id!,\n client: row.client!.id!,\n },\n [row.role as RoleMappingPayload],\n ),\n ),\n ]);\n\n addAlert(t(\"clientScopeSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"clients:clientScopeError\", error);\n }\n };\n\n const update = async () => {\n const newClient = { ...client, fullScopeAllowed: !client.fullScopeAllowed };\n try {\n await adminClient.clients.update({ id: client.id! }, newClient);\n addAlert(t(\"clientScopeSuccess\"), AlertVariant.success);\n setClient(newClient);\n } catch (error) {\n addError(\"clients:clientScopeError\", error);\n }\n };\n\n return (\n \n \n \n }\n fieldId=\"fullScopeAllowed\"\n >\n \n \n \n {!client.fullScopeAllowed && (\n <>\n \n \n >\n )}\n \n );\n};\n","import type ClientRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/clientRepresentation\";\nimport type ProtocolMapperRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/protocolMapperRepresentation\";\nimport type { ProtocolMapperTypeRepresentation } from \"@keycloak/keycloak-admin-client/lib/defs/serverInfoRepesentation\";\nimport {\n AlertVariant,\n PageSection,\n Tab,\n TabTitleText,\n} from \"@patternfly/react-core\";\nimport { useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { useNavigate } from \"react-router-dom\";\n\nimport { adminClient } from \"../../admin-client\";\nimport { MapperList } from \"../../client-scopes/details/MapperList\";\nimport { useAlerts } from \"../../components/alert/Alerts\";\nimport { KeycloakSpinner } from \"../../components/keycloak-spinner/KeycloakSpinner\";\nimport {\n RoutableTabs,\n useRoutableTab,\n} from \"../../components/routable-tabs/RoutableTabs\";\nimport { ViewHeader } from \"../../components/view-header/ViewHeader\";\nimport { useFetch } from \"../../utils/useFetch\";\nimport { useParams } from \"../../utils/useParams\";\nimport {\n DedicatedScopeDetailsParams,\n DedicatedScopeTab,\n toDedicatedScope,\n} from \"../routes/DedicatedScopeDetails\";\nimport { toMapper } from \"../routes/Mapper\";\nimport { DedicatedScope } from \"./DecicatedScope\";\n\nexport default function DedicatedScopes() {\n const { t } = useTranslation(\"clients\");\n const navigate = useNavigate();\n const { realm, clientId } = useParams();\n const { addAlert, addError } = useAlerts();\n\n const [client, setClient] = useState();\n\n useFetch(() => adminClient.clients.findOne({ id: clientId }), setClient, []);\n\n const useTab = (tab: DedicatedScopeTab) =>\n useRoutableTab(toDedicatedScope({ realm, clientId, tab }));\n\n const mappersTab = useTab(\"mappers\");\n const scopeTab = useTab(\"scope\");\n\n if (!client) {\n return ;\n }\n\n const addMappers = async (\n mappers: ProtocolMapperTypeRepresentation | ProtocolMapperRepresentation[],\n ): Promise => {\n if (!Array.isArray(mappers)) {\n const mapper = mappers as ProtocolMapperTypeRepresentation;\n navigate(\n toMapper({\n realm,\n id: client.id!,\n mapperId: mapper.id!,\n }),\n );\n } else {\n try {\n await adminClient.clients.addMultipleProtocolMappers(\n { id: client.id! },\n mappers as ProtocolMapperRepresentation[],\n );\n setClient(await adminClient.clients.findOne({ id: client.id! }));\n addAlert(t(\"common:mappingCreatedSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"common:mappingCreatedError\", error);\n }\n }\n };\n\n const onDeleteMapper = async (mapper: ProtocolMapperRepresentation) => {\n try {\n await adminClient.clients.delProtocolMapper({\n id: client.id!,\n mapperId: mapper.id!,\n });\n setClient({\n ...client,\n protocolMappers: client.protocolMappers?.filter(\n (m) => m.id !== mapper.id,\n ),\n });\n addAlert(t(\"common:mappingDeletedSuccess\"), AlertVariant.success);\n } catch (error) {\n addError(\"common:mappingDeletedError\", error);\n }\n return true;\n };\n\n return (\n <>\n \n \n \n {t(\"mappers\")}}\n data-testid=\"mappersTab\"\n {...mappersTab}\n >\n \n toMapper({ realm, id: client.id!, mapperId })\n }\n />\n \n {t(\"scope\")}}\n data-testid=\"scopeTab\"\n {...scopeTab}\n >\n \n \n \n \n >\n );\n}\n"],"names":["DedicatedScope","initialClient","t","useTranslation","addAlert","addError","useAlerts","client","setClient","useState","hasAccess","useAccess","isManager","assignRoles","rows","realmRoles","row","adminClient","AlertVariant","error","update","newClient","PageSection","jsx","FormAccess","FormGroup","HelpItem","Switch","jsxs","Fragment","Divider","RoleMapping","DedicatedScopes","navigate","useNavigate","realm","clientId","useParams","useFetch","useTab","tab","useRoutableTab","toDedicatedScope","mappersTab","scopeTab","KeycloakSpinner","addMappers","mappers","mapper","toMapper","onDeleteMapper","m","ViewHeader","RoutableTabs","Tab","TabTitleText","MapperList","mapperId"],"mappings":"o5CAwBO,MAAMA,EAAiB,CAAC,CAC7B,OAAQC,CACV,IAA2B,CACzB,KAAM,CAAE,EAAAC,CAAA,EAAMC,EAAe,SAAS,EAChC,CAAE,SAAAC,EAAU,SAAAC,CAAS,EAAIC,EAAU,EAEnC,CAACC,EAAQC,CAAS,EAAIC,WAA+BR,CAAa,EAElE,CAAE,UAAAS,GAAcC,IAChBC,EAAYF,EAAU,gBAAgB,GAAKH,EAAO,QAAQ,OAE1DM,EAAc,MAAOC,GAAgB,CACrC,GAAA,CACF,MAAMC,EAAaD,EAChB,OAAQE,GAAQA,EAAI,SAAW,MAAS,EACxC,IAAKA,GAAQA,EAAI,IAA0B,EAC3C,OACH,MAAM,QAAQ,IAAI,CAChBC,EAAY,QAAQ,sBAClB,CACE,GAAIV,EAAO,EACb,EACAQ,CACF,EACA,GAAGD,EACA,OAAQE,GAAQA,EAAI,SAAW,MAAS,EACxC,IAAKA,GACJC,EAAY,QAAQ,uBAClB,CACE,GAAIV,EAAO,GACX,OAAQS,EAAI,OAAQ,EACtB,EACA,CAACA,EAAI,IAA0B,CACjC,CACF,CAAA,CACH,EAEDZ,EAASF,EAAE,oBAAoB,EAAGgB,EAAa,OAAO,QAC/CC,EAAO,CACdd,EAAS,2BAA4Bc,CAAK,CAC5C,CAAA,EAGIC,EAAS,SAAY,CACzB,MAAMC,EAAY,CAAE,GAAGd,EAAQ,iBAAkB,CAACA,EAAO,kBACrD,GAAA,CACI,MAAAU,EAAY,QAAQ,OAAO,CAAE,GAAIV,EAAO,IAAOc,CAAS,EAC9DjB,EAASF,EAAE,oBAAoB,EAAGgB,EAAa,OAAO,EACtDV,EAAUa,CAAS,QACZF,EAAO,CAC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