diff --git a/backend/src/ee/services/permission/permission-service.ts b/backend/src/ee/services/permission/permission-service.ts index b71e63c10..c90598b09 100644 --- a/backend/src/ee/services/permission/permission-service.ts +++ b/backend/src/ee/services/permission/permission-service.ts @@ -362,7 +362,7 @@ export const permissionServiceFactory = ({ actorId, actorType: actor }); - if (!permissionData?.length) throw new ForbiddenRequestError({ name: "You are not member of this organization" }); + if (!permissionData?.length) throw new ForbiddenRequestError({ name: "You are not member of this project" }); const permissionFromRoles = permissionData.flatMap((membership) => { const activeRoles = membership?.roles diff --git a/backend/src/services/identity-access-token/identity-access-token-service.ts b/backend/src/services/identity-access-token/identity-access-token-service.ts index c720c97c0..853c57fb1 100644 --- a/backend/src/services/identity-access-token/identity-access-token-service.ts +++ b/backend/src/services/identity-access-token/identity-access-token-service.ts @@ -234,20 +234,18 @@ export const identityAccessTokenServiceFactory = ({ parentOrgId = subOrganization.parentOrgId as string; } else { - const organization = await orgDAL.findOne({ id: rootOrgId }); - const identityOrgMembership = await membershipIdentityDAL.findOne({ scope: AccessScope.Organization, actorIdentityId: identityAccessToken.identityId, - scopeOrgId: rootOrgId + scopeOrgId: identityOrgDetails.id }); if (!identityOrgMembership) { throw new BadRequestError({ message: "Identity does not belong to any organization" }); } - orgId = rootOrgId; - orgName = organization.name; + orgId = identityOrgDetails.id; + orgName = identityOrgDetails.name; parentOrgId = rootOrgId; } diff --git a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx index a8e3e640d..9d0adf893 100644 --- a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx +++ b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx @@ -83,7 +83,7 @@ export const IdentityTab = withProjectPermission( () => { const { currentProject, projectId } = useProject(); const navigate = useNavigate(); - const { isSubOrganization } = useOrganization(); + const { isSubOrganization, currentOrg } = useOrganization(); const { offset, @@ -279,7 +279,7 @@ export const IdentityTab = withProjectPermission( data.identityMemberships.length > 0 && data.identityMemberships.map((identityMember) => { const { - identity: { id, name, projectId: identityProjectId }, + identity: { id, name, projectId: identityProjectId, orgId: identityOrgId }, roles } = identityMember; return ( @@ -412,7 +412,7 @@ export const IdentityTab = withProjectPermission( Project - ) : isSubOrganization ? ( + ) : isSubOrganization && currentOrg.id === identityOrgId ? ( <> Sub-Organization diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityDetailsSection.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityDetailsSection.tsx index bab3208ce..8ce45dcfd 100644 --- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityDetailsSection.tsx +++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityDetailsSection.tsx @@ -143,7 +143,7 @@ export const ProjectIdentityDetailsSection = ({ identity, membership }: Props) =

Identity ID

-

{identity.id}

+

{identity.id}