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 6, 2024
1 parent 6151889 commit 9d66740
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ const DiscoverableOrganizationsListLayout: FunctionComponent<DiscoverableOrganiz
AppConstants.getPaths().get("ASSIGN_ORGANIZATION_DISCOVERY_DOMAINS")
);
} }
data-componentid={ `${ componentId }-list-layout-assign-button` }
data-componentid={ `${ componentId }-assign-button` }
>
<Icon name="add" />
{ t("organizationDiscovery:emailDomains.actions.assign") }
Expand Down
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 9d66740

Please sign in to comment.