diff --git a/apps/console/java/org.wso2.identity.apps.console.server.feature/resources/deployment.config.json.j2 b/apps/console/java/org.wso2.identity.apps.console.server.feature/resources/deployment.config.json.j2 index f9a2bc76f46..76a77f27864 100644 --- a/apps/console/java/org.wso2.identity.apps.console.server.feature/resources/deployment.config.json.j2 +++ b/apps/console/java/org.wso2.identity.apps.console.server.feature/resources/deployment.config.json.j2 @@ -1909,5 +1909,8 @@ "theme": { "name": "{{ console.theme }}" } + {% if identity_mgt.user_claim_update.uniqueness.enable is defined %} + "isClaimUniquenessValidationEnabled": "{{ identity_mgt.user_claim_update.uniqueness.enable }}", + {% endif %} } } diff --git a/features/admin.claims.v1/components/edit/local-claim/edit-basic-details-local-claims.tsx b/features/admin.claims.v1/components/edit/local-claim/edit-basic-details-local-claims.tsx index 73ef6aabcdf..a3ac0703cb7 100644 --- a/features/admin.claims.v1/components/edit/local-claim/edit-basic-details-local-claims.tsx +++ b/features/admin.claims.v1/components/edit/local-claim/edit-basic-details-local-claims.tsx @@ -18,6 +18,7 @@ import { Show } from "@wso2is/access-control"; import { AppConstants, AppState, FeatureConfigInterface, history } from "@wso2is/admin.core.v1"; +import useUIConfig from "@wso2is/admin.core.v1/hooks/use-ui-configs"; import { attributeConfig } from "@wso2is/admin.extensions.v1"; import { SCIMConfigs } from "@wso2is/admin.extensions.v1/configs/scim"; import { @@ -135,6 +136,8 @@ export const EditBasicDetailsLocalClaims: FunctionComponent) => { + const updatedProperties: { key: string; value: string }[] = [ ...(claim.properties || []) ]; + const uniquenessScopeIndex: number = updatedProperties.findIndex((prop: { key: string; value: string }) => + prop.key === "UniquenessScope" + ); + + if (uniquenessScopeIndex !== -1) { + updatedProperties[uniquenessScopeIndex].value = values.uniquenessScope?.toString() || "NONE"; + } else { + updatedProperties.push({ + key: "UniquenessScope", + value: values.uniquenessScope?.toString() || "NONE" + }); + } + const data: Claim = { attributeMapping: claim.attributeMapping, claimURI: claim.claimURI, @@ -425,7 +442,7 @@ export const EditBasicDetailsLocalClaims: FunctionComponent ) } + { + claim && !READONLY_CLAIM_CONFIGS.includes(claim?.claimURI) + && !hideSpecialClaims && mappingChecked + && UIConfig?.isClaimUniquenessValidationEnabled && ( + prop.key === "UniquenessScope" + )?.value as string) || "NONE" + } + /> + ) + } { !READONLY_CLAIM_CONFIGS.includes(claim?.claimURI) && mappingChecked ? ( !hideSpecialClaims && diff --git a/features/admin.core.v1/configs/app.ts b/features/admin.core.v1/configs/app.ts index 592452d6d53..ce70b84df0a 100644 --- a/features/admin.core.v1/configs/app.ts +++ b/features/admin.core.v1/configs/app.ts @@ -320,6 +320,8 @@ export class Config { hiddenUserStores: window[ "AppUtils" ]?.getConfig()?.ui?.hiddenUserStores, i18nConfigs: window[ "AppUtils" ]?.getConfig()?.ui?.i18nConfigs, identityProviderTemplates: window[ "AppUtils" ]?.getConfig()?.ui?.identityProviderTemplates, + isClaimUniquenessValidationEnabled: + window[ "AppUtils" ]?.getConfig()?.ui?.isClaimUniquenessValidationEnabled, isClientSecretHashEnabled: window[ "AppUtils" ]?.getConfig()?.ui?.isClientSecretHashEnabled, isCookieConsentBannerEnabled: window[ "AppUtils" ]?.getConfig()?.ui?.isCookieConsentBannerEnabled, isCustomClaimMappingEnabled: window[ "AppUtils" ]?.getConfig()?.ui?.isCustomClaimMappingEnabled, diff --git a/features/admin.core.v1/models/config.ts b/features/admin.core.v1/models/config.ts index 2dc521e3f45..2a3a823aec8 100644 --- a/features/admin.core.v1/models/config.ts +++ b/features/admin.core.v1/models/config.ts @@ -360,6 +360,10 @@ export interface UIConfigInterface extends CommonUIConfigInterface