From 10f5bf644f973552f3c3d155fda410b6e071f147 Mon Sep 17 00:00:00 2001 From: Amanda Ariyaratne Date: Mon, 28 Oct 2024 18:03:58 +0530 Subject: [PATCH 1/3] remove delete button from system dialects and claims --- .changeset/little-eagles-burn.md | 7 ++++ .../components/claims-list.tsx | 18 ++++----- .../edit-basic-details-local-claims.tsx | 10 +++++ .../constants/claim-management-constants.ts | 13 +++++++ .../pages/external-dialect-edit.tsx | 4 +- .../admin.extensions.v1/configs/attribute.ts | 37 ------------------- .../configs/models/attribute.ts | 5 --- modules/core/src/models/claim.ts | 1 + 8 files changed, 42 insertions(+), 53 deletions(-) create mode 100644 .changeset/little-eagles-burn.md diff --git a/.changeset/little-eagles-burn.md b/.changeset/little-eagles-burn.md new file mode 100644 index 00000000000..541adff002f --- /dev/null +++ b/.changeset/little-eagles-burn.md @@ -0,0 +1,7 @@ +--- +"@wso2is/admin.extensions.v1": patch +"@wso2is/admin.claims.v1": patch +"@wso2is/core": patch +--- + +remove delete option from default claims and dialects diff --git a/features/admin.claims.v1/components/claims-list.tsx b/features/admin.claims.v1/components/claims-list.tsx index ff4ee37118f..12bfcf369e3 100644 --- a/features/admin.claims.v1/components/claims-list.tsx +++ b/features/admin.claims.v1/components/claims-list.tsx @@ -38,6 +38,7 @@ import { ExternalClaim, LoadableComponentInterface, ProfileSchemaInterface, + Property, SBACInterface, TestableComponentInterface } from "@wso2is/core/models"; @@ -1100,16 +1101,13 @@ export const ClaimsList: FunctionComponent = ( return true; } - if (attributeConfig.defaultScimMapping - && Object.keys(attributeConfig.defaultScimMapping).length > 0) { - const defaultSCIMClaims: Map = attributeConfig - .defaultScimMapping[claim.claimDialectURI]; - - if (defaultSCIMClaims && defaultSCIMClaims.get(claim.claimURI)) { - return true; - } else { - return false; - } + if (claim?.properties?.some((property: Property) => + property.key === ClaimManagementConstants.SYSTEM_CLAIM_PROPERTY_NAME + && property.value === "true" + )) { + return true; + } else { + return false; } }, icon: (): SemanticICONS => "trash alternate", 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..f42ab08140f 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 @@ -69,6 +69,7 @@ import { Dispatch } from "redux"; import { Divider, Grid, Icon, Form as SemanticForm } from "semantic-ui-react"; import { deleteAClaim, getExternalClaims, updateAClaim } from "../../../api"; import { ClaimManagementConstants } from "../../../constants"; +import { Property } from "@wso2is/core/src/models"; /** * Prop types for `EditBasicDetailsLocalClaims` component @@ -130,6 +131,7 @@ export const EditBasicDetailsLocalClaims: FunctionComponent(undefined); const [ accountVerificationEnabled, setAccountVerificationEnabled ] = useState(false); const [ selfRegistrationEnabled, setSelfRegistrationEnabledEnabled ] = useState(false); + const [ isSystemClaim, setIsSystemClaim ] = useState(false); const { t } = useTranslation(); @@ -184,6 +186,13 @@ export const EditBasicDetailsLocalClaims: FunctionComponent + property.key === ClaimManagementConstants.SYSTEM_CLAIM_PROPERTY_NAME + && property.value === "true" + ) + ); }, [ claim, usernameConfig ]); useEffect(() => { @@ -758,6 +767,7 @@ export const EditBasicDetailsLocalClaims: FunctionComponent