Skip to content

Commit

Permalink
Utilize useRequiredScopes hook.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasasr1 committed Nov 5, 2024
1 parent 6151889 commit 4fad846
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
*/

import Alert from "@oxygen-ui/react/Alert";
import { useRequiredScopes } from "@wso2is/access-control";
import {
AppConstants,
AppState,
FeatureConfigInterface,
UIConstants,
history
} from "@wso2is/admin.core.v1";
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";
Expand Down Expand Up @@ -81,17 +81,7 @@ const OrganizationDiscoveryDomainsPage: FunctionComponent<OrganizationDiscoveryD
const featureConfig: FeatureConfigInterface = useSelector((state: AppState) => state?.config?.ui?.features);
const isEmailDomainDiscoveryForSelfRegFeatureEnabled: boolean = !featureConfig?.organizationDiscovery?.
disabledFeatures?.includes("organizationDiscovery.emailDomainDiscoveryForSelfReg");
const allowedScopes: string = useSelector((state: AppState) => state?.auth?.allowedScopes);

const isReadOnly: boolean = useMemo(
() =>
!hasRequiredScopes(
featureConfig?.organizationDiscovery,
featureConfig?.organizationDiscovery?.scopes?.update,
allowedScopes
),
[ featureConfig, allowedScopes ]
);
const isReadOnly: boolean = !useRequiredScopes(featureConfig?.organizationDiscovery?.scopes?.update);

const [ searchQuery, setSearchQuery ] = useState<string>("");
const [ listItemLimit, setListItemLimit ] = useState<number>(UIConstants.DEFAULT_RESOURCE_LIST_ITEM_LIMIT);
Expand Down

0 comments on commit 4fad846

Please sign in to comment.