diff --git a/.changeset/blue-peas-heal.md b/.changeset/blue-peas-heal.md new file mode 100644 index 00000000000..873d7786b09 --- /dev/null +++ b/.changeset/blue-peas-heal.md @@ -0,0 +1,7 @@ +--- +"@wso2is/admin.console-settings.v1": patch +"@wso2is/admin.users.v1": patch +"@wso2is/admin.core.v1": patch +--- + +Fix issues in console settings and update admin profile diff --git a/features/admin.core.v1/models/users.ts b/features/admin.core.v1/models/users.ts index b557af406d9..d1108765eec 100644 --- a/features/admin.core.v1/models/users.ts +++ b/features/admin.core.v1/models/users.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2020-2024, WSO2 LLC. (https://www.wso2.com). + * Copyright (c) 2020-2025, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -45,7 +45,7 @@ export interface UserMetaInterface { * Captures the basic details of the user. */ export interface UserBasicInterface { - id: string; + id?: string; userName: string; emails?: string[] | MultiValueAttributeInterface[]; name?: NameInterface; diff --git a/features/admin.users.v1/components/edit-user.tsx b/features/admin.users.v1/components/edit-user.tsx index c67a4e8748d..cc4d8c259b8 100644 --- a/features/admin.users.v1/components/edit-user.tsx +++ b/features/admin.users.v1/components/edit-user.tsx @@ -1,5 +1,5 @@ /** - * Copyright (c) 2020-2024, WSO2 LLC. (https://www.wso2.com). + * Copyright (c) 2020-2025, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -18,7 +18,7 @@ import { useRequiredScopes } from "@wso2is/access-control"; import { FeatureConfigInterface } from "@wso2is/admin.core.v1/models"; -import { store } from "@wso2is/admin.core.v1/store"; +import { AppState, store } from "@wso2is/admin.core.v1/store"; import { SCIMConfigs } from "@wso2is/admin.extensions.v1/configs/scim"; import { userstoresConfig } from "@wso2is/admin.extensions.v1/configs/userstores"; import { useGetCurrentOrganizationType } from "@wso2is/admin.organizations.v1/hooks/use-get-organization-type"; @@ -27,15 +27,16 @@ import { ConnectorPropertyInterface } from "@wso2is/admin.server-configurations. import { isFeatureEnabled } from "@wso2is/core/helpers"; import { AlertInterface, AlertLevels, ProfileInfoInterface, SBACInterface } from "@wso2is/core/models"; import { addAlert } from "@wso2is/core/store"; -import { ResourceTab } from "@wso2is/react-components"; +import { Message, ResourceTab } from "@wso2is/react-components"; import { AxiosError } from "axios"; import React, { FunctionComponent, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import { useDispatch } from "react-redux"; +import { useDispatch, useSelector } from "react-redux"; import { Dispatch } from "redux"; -import { TabProps } from "semantic-ui-react"; +import { Divider, Grid, TabProps } from "semantic-ui-react"; import { UserGroupsList } from "./user-groups-edit"; import { UserProfile } from "./user-profile"; +import { UserRolesList } from "./user-roles-list"; import { UserSessions } from "./user-sessions"; import { AdminAccountTypes, UserManagementConstants } from "../constants"; import useUserManagement from "../hooks/use-user-management"; @@ -107,6 +108,10 @@ export const EditUser: FunctionComponent = ( const [ isUserManagedByParentOrg, setIsUserManagedByParentOrg ] = useState(false); const [ isUserProfileReadOnly, setIsUserProfileReadOnly ] = useState(false); + const userRolesDisabledFeatures: string[] = useSelector((state: AppState) => { + return state.config.ui.features?.users?.disabledFeatures; + }); + useEffect(() => { const userStore: string = user?.userName?.split("/").length > 1 ? user?.userName?.split("/")[0] @@ -116,6 +121,7 @@ export const EditUser: FunctionComponent = ( || readOnlyUserStores?.includes(userStore?.toString()) || !hasUsersUpdatePermissions || user[ SCIMConfigs.scim.enterpriseSchema ]?.userSourceId + || user[ UserManagementConstants.CUSTOMSCHEMA ]?.isReadOnlyUser === "true" ) { setReadOnly(true); } @@ -211,11 +217,31 @@ export const EditUser: FunctionComponent = ( isReadOnlyUserStoresLoading={ isReadOnlyUserStoresLoading } isUserManagedByParentOrg={ isUserManagedByParentOrg } adminUserType={ AdminAccountTypes.INTERNAL } + allowDeleteOnly={ + user[ UserManagementConstants.CUSTOMSCHEMA ]?.isReadOnlyUser === "true" + } + editUserDisclaimerMessage={ ( + + + + + + + + ) } /> ) }, - { + ( + !userRolesDisabledFeatures?.includes(UserManagementConstants.FEATURE_DICTIONARY.get("USER_GROUPS")) + || user?.userName?.split("/").length !== 1 + ) + && { menuItem: t("users:editUser.tab.menuItems.1"), render: () => ( @@ -228,6 +254,14 @@ export const EditUser: FunctionComponent = ( ) }, + { + menuItem: t("users:editUser.tab.menuItems.2"), + render: () => ( + + + + ) + }, { menuItem: t("users:editUser.tab.menuItems.3"), render: () => ( diff --git a/features/admin.users.v1/components/user-profile.tsx b/features/admin.users.v1/components/user-profile.tsx index cf520608937..c1de44168b6 100644 --- a/features/admin.users.v1/components/user-profile.tsx +++ b/features/admin.users.v1/components/user-profile.tsx @@ -2618,7 +2618,10 @@ export const UserProfile: FunctionComponent = ( !isEmpty(profileInfo) && ( { - (isReadOnly && !isEmpty(tenantAdmin)) && editUserDisclaimerMessage + isReadOnly + && (!isEmpty(tenantAdmin) || tenantAdmin !== null) + && !user[ SCIMConfigs.scim.enterpriseSchema ]?.userSourceId + && editUserDisclaimerMessage }