mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
chore: list users and groups under each role in projectaccessadded event (#5581)
## About the changes Changes the project access added event to list all users and groups added to each role instead of in root event.
This commit is contained in:
parent
7800d9d1b4
commit
5603e8683d
@ -121,11 +121,13 @@ test('should anonymise any PII fields, no matter the depth', async () => {
|
|||||||
createdBy: 'some@email.com',
|
createdBy: 'some@email.com',
|
||||||
createdByUserId: TEST_USER_ID,
|
createdByUserId: TEST_USER_ID,
|
||||||
data: {
|
data: {
|
||||||
groups: [
|
roles: [
|
||||||
{
|
{
|
||||||
name: 'test',
|
roleId: 1,
|
||||||
project: 'default',
|
groupIds: [1, 2],
|
||||||
users: [{ username: testUsername }],
|
// Doesn't reflect the real data structure for event here, normally a number array.
|
||||||
|
// Testing PII anonymisation
|
||||||
|
users: [{ id: 1, username: testUsername }],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -138,7 +140,7 @@ test('should anonymise any PII fields, no matter the depth', async () => {
|
|||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
expect(body.events.length).toBe(1);
|
expect(body.events.length).toBe(1);
|
||||||
expect(body.events[0].data.groups[0].users[0].username).not.toBe(
|
expect(body.events[0].data.roles[0].users[0].username).not.toBe(
|
||||||
testUsername,
|
testUsername,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -681,9 +681,11 @@ export default class ProjectService {
|
|||||||
createdBy,
|
createdBy,
|
||||||
createdByUserId,
|
createdByUserId,
|
||||||
data: {
|
data: {
|
||||||
roleId,
|
roles: {
|
||||||
groups: usersAndGroups.groups.map(({ id }) => id),
|
roleId,
|
||||||
users: usersAndGroups.users.map(({ id }) => id),
|
groupIds: usersAndGroups.groups.map(({ id }) => id),
|
||||||
|
userIds: usersAndGroups.users.map(({ id }) => id),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -711,9 +713,13 @@ export default class ProjectService {
|
|||||||
createdBy,
|
createdBy,
|
||||||
createdByUserId,
|
createdByUserId,
|
||||||
data: {
|
data: {
|
||||||
roles,
|
roles: roles.map((roleId) => {
|
||||||
groups,
|
return {
|
||||||
users,
|
roleId,
|
||||||
|
groupIds: groups,
|
||||||
|
userIds: users,
|
||||||
|
};
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user