09dd49d6d6
## Description - This PR is focused on issue https://github.com/twentyhq/core-team-issues/issues/1421 - Added workspace-level impersonation apart from current server-level-impersonation - Introduced WorkspaceImpersonationModule, including service and resolver for user impersonation within workspaces. - Enhanced AdminPanelService and AdminPanelResolver to support impersonation logic, including authentication checks and token generation. - added Member Management Interface in settings/members table - added GraphQL mutation for workspace-level impersonation ## Visual Proof <img width="919" height="444" alt="Screenshot 2025-09-09 at 1 29 22 AM" src="https://github.com/user-attachments/assets/a361c6eb-03de-48db-b68a-7d3a489fafde" /> https://github.com/user-attachments/assets/454bc1aa-8b8f-4de1-9304-7c147da71dd4 ## Impersontion Cookie <img width="1792" height="297" alt="Screenshot 2025-09-11 at 9 44 06 PM" src="https://github.com/user-attachments/assets/a8a37d5e-d38d-4472-94a7-4e4b36fba14e" /> <img width="1235" height="1041" alt="Screenshot 2025-09-19 at 1 24 09 AM" src="https://github.com/user-attachments/assets/875e8f9c-e0cb-404b-8291-8fadc6c2a163" /> --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com> Co-authored-by: Félix Malfait <felix@twenty.com> Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
49 lines
1.1 KiB
TypeScript
49 lines
1.1 KiB
TypeScript
import request from 'supertest';
|
|
|
|
const client = request(`http://localhost:${APP_PORT}`);
|
|
|
|
describe('peopleResolver (e2e)', () => {
|
|
it('should find many people', () => {
|
|
const queryData = {
|
|
query: `
|
|
query people {
|
|
people {
|
|
edges {
|
|
node {
|
|
jobTitle
|
|
city
|
|
avatarUrl
|
|
position
|
|
searchVector
|
|
id
|
|
createdAt
|
|
updatedAt
|
|
deletedAt
|
|
companyId
|
|
intro
|
|
workPreference
|
|
performanceRating
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`,
|
|
};
|
|
|
|
return client
|
|
.post('/graphql')
|
|
.set(
|
|
'Authorization',
|
|
`Bearer ${APPLE_SARAH_IMPERSONATE_TIM_INVALID_ACCESS_TOKEN}`,
|
|
)
|
|
.send(queryData)
|
|
.expect(200)
|
|
.expect((res) => {
|
|
expect(res.body.errors).toBeDefined();
|
|
expect(res.body.errors[0].message).toContain(
|
|
'Impersonation not allowed',
|
|
);
|
|
});
|
|
});
|
|
});
|