Skip to content

Commit

Permalink
Merge pull request #7530 from PasinduYeshan/fix/attribute-verificatio…
Browse files Browse the repository at this point in the history
…n-readonly

Fix the attribute change verification section read-only issue when attribute dialect edit permissions are granted
  • Loading branch information
PasinduYeshan authored Feb 7, 2025
2 parents 3385dab + 4cafec5 commit f45a613
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .changeset/seven-fans-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wso2is/admin.claims.v1": patch
"@wso2is/console": patch
---

Fix attribute verification section scope issue
4 changes: 3 additions & 1 deletion apps/console/src/public/deployment.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,12 @@
],
"read": [
"internal_claim_meta_view",
"internal_governance_view",
"internal_userstore_view"
],
"update": [
"internal_claim_meta_update"
"internal_claim_meta_update",
"internal_governance_update"
]
}
},
Expand Down
17 changes: 5 additions & 12 deletions features/admin.claims.v1/pages/attribute-verification-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* under the License.
*/

import { useRequiredScopes } from "@wso2is/access-control";
import { AppConstants } from "@wso2is/admin.core.v1/constants/app-constants";
import { history } from "@wso2is/admin.core.v1/helpers/history";
import { FeatureConfigInterface } from "@wso2is/admin.core.v1/models/config";
Expand All @@ -28,14 +29,13 @@ import {
UpdateGovernanceConnectorConfigInterface
} from "@wso2is/admin.server-configurations.v1/models/governance-connectors";
import { GovernanceConnectorUtils } from "@wso2is/admin.server-configurations.v1/utils";
import { hasRequiredScopes } from "@wso2is/core/helpers";
import { AlertLevels, IdentifiableComponentInterface } from "@wso2is/core/models";
import { addAlert } from "@wso2is/core/store";
import { Field, Form } from "@wso2is/form";
import { ContentLoader, EmphasizedSegment, PageLayout } from "@wso2is/react-components";
import { AxiosError } from "axios";
import isEmpty from "lodash-es/isEmpty";
import React, { FunctionComponent, ReactElement, useEffect, useMemo, useState } from "react";
import React, { FunctionComponent, ReactElement, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { useDispatch, useSelector } from "react-redux";
import { Dispatch } from "redux";
Expand Down Expand Up @@ -95,20 +95,13 @@ const AttributeVerificationSettingsFormPage: FunctionComponent<AttributeVerifica
const [ isSubmitting, setIsSubmitting ] = useState<boolean>(false);
const [ isFormInitialized, setIsFormInitialized ] = useState<boolean>(false);

const allowedScopes: string = useSelector((state: AppState) => state?.auth?.allowedScopes);
const featureConfig: FeatureConfigInterface = useSelector((state: AppState) => state.config.ui.features);
const isReadOnly: boolean = !useRequiredScopes(
featureConfig?.attributeDialects?.scopes?.update
);

// TODO: Enable connector based on the feature flag.
const isConnectorEnabled: boolean = true;
const isReadOnly: boolean = useMemo(
() =>
!hasRequiredScopes(
featureConfig?.governanceConnectors,
featureConfig?.governanceConnectors?.scopes?.update,
allowedScopes
),
[ featureConfig, allowedScopes ]
);

/**
* Load Attributes verification connector details on page load.
Expand Down

0 comments on commit f45a613

Please sign in to comment.