Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove index files in admin.administrators.v1 module #7186

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/hungry-camels-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wso2is/admin.console-settings.v1": patch
"@wso2is/admin.administrators.v1": patch
---

Remove index files in admin.administrators.v1 module
19 changes: 0 additions & 19 deletions features/admin.administrators.v1/api/index.ts

This file was deleted.

23 changes: 0 additions & 23 deletions features/admin.administrators.v1/components/guests/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* under the License.
*/

import { FeatureStatus, useCheckFeatureStatus } from "@wso2is/access-control";
import { FeatureStatus, useCheckFeatureStatus, useRequiredScopes } from "@wso2is/access-control";
import {
AppState,
FeatureConfigInterface,
Expand Down Expand Up @@ -44,7 +44,7 @@ import {
import { UserManagementUtils } from "@wso2is/admin.users.v1/utils";
import { UserstoreConstants } from "@wso2is/core/constants";
import { IdentityAppsApiException } from "@wso2is/core/exceptions";
import { getUserNameWithoutDomain, hasRequiredScopes, isFeatureEnabled } from "@wso2is/core/helpers";
import { getUserNameWithoutDomain, isFeatureEnabled } from "@wso2is/core/helpers";
import {
AlertLevels,
IdentifiableComponentInterface,
Expand All @@ -68,7 +68,7 @@ import { useTranslation } from "react-i18next";
import { useDispatch, useSelector } from "react-redux";
import { Dispatch } from "redux";
import { Header, Icon, Label, ListItemProps, SemanticICONS } from "semantic-ui-react";
import { AdministratorConstants } from "../../constants";
import { AdministratorConstants } from "../../constants/users";

/**
* Prop types for the onboarded collaborator users list component.
Expand Down Expand Up @@ -185,14 +185,16 @@ export const OnboardedGuestUsersList: React.FunctionComponent<OnboardedGuestUser
const { t } = useTranslation();
const dispatch: Dispatch = useDispatch();

const hasUserUpdatePermissions: boolean = useRequiredScopes(featureConfig?.users?.scopes?.update);
const hasUserDeletePermissions: boolean = useRequiredScopes(featureConfig?.users?.scopes?.delete);

const [ showDeleteConfirmationModal, setShowDeleteConfirmationModal ] = useState<boolean>(false);
const [ deletingUser, setDeletingUser ] = useState<UserBasicInterface | UserRoleInterface>(undefined);
const [ alert, setAlert, alertComponent ] = useConfirmationModalAlert();
const [ usersList, setUsersList ] = useState<UserListInterface | InternalAdminUserListInterface>({});
const [ loading, setLoading ] = useState(false);

const authenticatedUser: string = useSelector((state: AppState) => state?.auth?.username);
const allowedScopes: string = useSelector((state: AppState) => state?.auth?.allowedScopes);
const isPrivilegedUser: boolean = useSelector((state: AppState) => state.auth.isPrivilegedUser);

const saasFeatureStatus : FeatureStatus = useCheckFeatureStatus(FeatureGateConstants.SAAS_FEATURES_IDENTIFIER);
Expand Down Expand Up @@ -491,7 +493,7 @@ export const OnboardedGuestUsersList: React.FunctionComponent<OnboardedGuestUser
: "PRIMARY";

return (
!hasRequiredScopes(featureConfig?.users, featureConfig?.users?.scopes?.update, allowedScopes)
!hasUserUpdatePermissions
|| !isFeatureEnabled(featureConfig?.users,
UserManagementConstants.FEATURE_DICTIONARY.get("USER_UPDATE"))
|| readOnlyUserStores?.includes(userStore.toString())
Expand All @@ -508,7 +510,7 @@ export const OnboardedGuestUsersList: React.FunctionComponent<OnboardedGuestUser
: "PRIMARY";

return (
!hasRequiredScopes(featureConfig?.users, featureConfig?.users?.scopes?.update, allowedScopes)
!hasUserUpdatePermissions
|| !isFeatureEnabled(featureConfig?.users,
UserManagementConstants.FEATURE_DICTIONARY.get("USER_UPDATE"))
|| readOnlyUserStores?.includes(userStore.toString())
Expand All @@ -530,7 +532,7 @@ export const OnboardedGuestUsersList: React.FunctionComponent<OnboardedGuestUser
return !isFeatureEnabled(featureConfig?.users,
UserManagementConstants.FEATURE_DICTIONARY.get("USER_DELETE"))
|| isPrivilegedUser
|| !hasRequiredScopes(featureConfig?.users, featureConfig?.users?.scopes?.delete, allowedScopes)
|| !hasUserDeletePermissions
|| readOnlyUserStores?.includes(userStore.toString())
|| (adminType === AdminAccountTypes.EXTERNAL
&& (getUserNameWithoutDomain(user?.userName) === realmConfigs?.adminUser
Expand Down
20 changes: 0 additions & 20 deletions features/admin.administrators.v1/components/index.ts

This file was deleted.

19 changes: 0 additions & 19 deletions features/admin.administrators.v1/constants/index.ts

This file was deleted.

21 changes: 0 additions & 21 deletions features/admin.administrators.v1/models/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions features/admin.administrators.v1/pages/administrator-edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ import { useDispatch, useSelector } from "react-redux";
import { AnyAction } from "redux";
import { ThunkDispatch } from "redux-thunk";
import { Icon } from "semantic-ui-react";
import { EditGuestUser } from "../components";
import { AdministratorConstants } from "../constants";
import { EditGuestUser } from "../components/guests/edit-guest-user";
import { AdministratorConstants } from "../constants/users";

/**
* Admin User Edit page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { Dispatch } from "redux";
import { Checkbox, CheckboxProps, Icon, Message } from "semantic-ui-react";
import { updateOrganizationConfigV2 } from "../api/updateOrganizationConfigV2";
import { useOrganizationConfigV2 } from "../api/useOrganizationConfigV2";
import { AdministratorConstants } from "../constants";
import { AdministratorConstants } from "../constants/users";
import { OrganizationInterface, UseOrganizationConfigType } from "../models/organization";

/**
Expand Down
7 changes: 4 additions & 3 deletions features/admin.administrators.v1/pages/administrators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ import {
TabProps
} from "semantic-ui-react";
import { useOrganizationConfigV2 } from "../api/useOrganizationConfigV2";
import { GuestUsersList, OnboardedGuestUsersList } from "../components";
import { AdministratorConstants } from "../constants";
import { GuestUsersList } from "../components/guests/guest-users-list";
import { OnboardedGuestUsersList } from "../components/guests/onboarded-guest-user-list";
import { AdministratorConstants } from "../constants/users";
import { UseOrganizationConfigType } from "../models/organization";
import { isAdminUser, isOwner } from "../utils/administrators";
import { AddAdministratorWizard } from "../wizard";
import { AddAdministratorWizard } from "../wizard/add-administrator-wizard";

/**
* Props for the Users page.
Expand Down
20 changes: 0 additions & 20 deletions features/admin.administrators.v1/pages/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import { Grid, Icon, Modal } from "semantic-ui-react";
import {
AddAdminUserBasic
} from "./steps/admin-user-basic";
import { InternalAdminFormDataInterface } from "../models";
import { InternalAdminFormDataInterface } from "../models/invite";
import { isAdminUser } from "../utils/administrators";

interface AddUserWizardPropsInterface extends IdentifiableComponentInterface, TestableComponentInterface {
Expand Down
19 changes: 0 additions & 19 deletions features/admin.administrators.v1/wizard/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ import React, { FormEvent, ReactElement, useCallback, useEffect, useMemo, useSta
import { useTranslation } from "react-i18next";
import { useSelector } from "react-redux";
import { Divider, DropdownProps, Grid, Header } from "semantic-ui-react";
import { AdministratorConstants } from "../../constants";
import { InternalAdminFormDataInterface } from "../../models";
import { AdministratorConstants } from "../../constants/users";
import { InternalAdminFormDataInterface } from "../../models/invite";
import { isAdminUser, isCollaboratorUser } from "../../utils/administrators";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Radio from "@oxygen-ui/react/Radio";
import RadioGroup from "@oxygen-ui/react/RadioGroup";
import { FeatureStatus, useCheckFeatureStatus, useRequiredScopes } from "@wso2is/access-control";
import { useOrganizationConfigV2 } from "@wso2is/admin.administrators.v1/api/useOrganizationConfigV2";
import { UseOrganizationConfigType } from "@wso2is/admin.administrators.v1/models";
import { UseOrganizationConfigType } from "@wso2is/admin.administrators.v1/models/organization";
import { AppState, OrganizationType, store } from "@wso2is/admin.core.v1";
import { userstoresConfig } from "@wso2is/admin.extensions.v1/configs/userstores";
import FeatureGateConstants from "@wso2is/admin.feature-gate.v1/constants/feature-gate-constants";
Expand Down
Loading