diff --git a/backend/src/services/identity-project/identity-project-service.ts b/backend/src/services/identity-project/identity-project-service.ts index abe0446da..15d94c684 100644 --- a/backend/src/services/identity-project/identity-project-service.ts +++ b/backend/src/services/identity-project/identity-project-service.ts @@ -60,8 +60,14 @@ export const identityProjectServiceFactory = ({ }); const totalCount = await identityProjectDAL.getCountByProjectId(projectId, { search }); + const filteredMemberships = identityMemberships.filter((el) => + permission.can( + ProjectPermissionIdentityActions.Read, + subject(ProjectPermissionSub.Identity, { identityId: el.id }) + ) + ); - return { identityMemberships, totalCount }; + return { identityMemberships: filteredMemberships, totalCount }; }; const getProjectIdentityByIdentityId = async ({ diff --git a/backend/src/services/membership-identity/membership-identity-service.ts b/backend/src/services/membership-identity/membership-identity-service.ts index 224dff67b..ab63c4508 100644 --- a/backend/src/services/membership-identity/membership-identity-service.ts +++ b/backend/src/services/membership-identity/membership-identity-service.ts @@ -299,7 +299,7 @@ export const membershipIdentityServiceFactory = ({ const { scopeData } = dto; const factory = scopeFactory[scopeData.scope]; - await factory.onListMembershipIdentityGuard(dto); + const listFilter = await factory.onListMembershipIdentityGuard(dto); const memberships = await membershipIdentityDAL.findIdentities({ scopeData, filter: { @@ -317,7 +317,7 @@ export const membershipIdentityServiceFactory = ({ : undefined } }); - return memberships; + return { ...memberships, data: memberships.data.filter((el) => listFilter({ identityId: el.identity.id })) }; }; const getMembershipByIdentityId = async (dto: TGetMembershipIdentityByIdentityIdDTO) => { diff --git a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx index 56d03e6fc..61d48c52d 100644 --- a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx +++ b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx @@ -79,6 +79,7 @@ import { usePopUp } from "@app/hooks/usePopUp"; import { ProjectIdentityModal } from "@app/pages/project/AccessControlPage/components/IdentityTab/components/ProjectIdentityModal"; import { ProjectLinkIdentityModal } from "./components/ProjectLinkIdentityModal"; +import { Blur } from "@app/components/v2/Blur"; const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2; @@ -174,7 +175,6 @@ export const IdentityTab = withProjectPermission( handlePopUpClose("deleteIdentity"); }; - const handleSort = (column: ProjectIdentityOrderBy) => { if (column === orderBy) { setOrderDirection((prev) => @@ -187,6 +187,12 @@ export const IdentityTab = withProjectPermission( setOrderDirection(OrderByDirection.ASC); }; + const noAccessIdentityCount = Math.max( + (page * perPage > totalCount ? totalCount % perPage : perPage) - + (data?.identityMemberships?.length || 0), + 0 + ); + return (
@@ -450,6 +456,20 @@ export const IdentityTab = withProjectPermission( ); })} + {!isPending && + data && + data?.totalCount !== 0 && + Array.from(Array(noAccessIdentityCount)).map((_e, i) => ( + + No Access + + + + + ))} {!isPending && data && totalCount > 0 && ( @@ -461,16 +481,19 @@ export const IdentityTab = withProjectPermission( onChangePerPage={handlePerPageChange} /> )} - {!isPending && data && data?.identityMemberships.length === 0 && ( - 0 - ? "No identities match search filter" - : "No identities have been added to this project" - } - icon={faServer} - /> - )} + {!isPending && + data && + data?.identityMemberships.length === 0 && + data?.totalCount === 0 && ( + 0 + ? "No identities match search filter" + : "No identities have been added to this project" + } + icon={faServer} + /> + )}