Skip to content

Commit

Permalink
chore: list users and groups under each role in projectaccessadded event
Browse files Browse the repository at this point in the history
  • Loading branch information
daveleek committed Dec 11, 2023
1 parent 9508c79 commit e67c20d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/lib/routes/admin-api/events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ test('should anonymise any PII fields, no matter the depth', async () => {
new ProjectAccessAddedEvent({
createdBy: '[email protected]',
data: {
groups: [
roles: [
{
name: 'test',
project: 'default',
users: [{ username: testUsername }],
roleId: 1,
groupIds: [1, 2],
users: [1],
},
],
},
Expand Down
18 changes: 12 additions & 6 deletions src/lib/services/project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,11 @@ export default class ProjectService {
project: projectId,
createdBy,
data: {
roleId,
groups: usersAndGroups.groups.map(({ id }) => id),
users: usersAndGroups.users.map(({ id }) => id),
roles: {
roleId,
groupIds: usersAndGroups.groups.map(({ id }) => id),
userIds: usersAndGroups.users.map(({ id }) => id),
},
},
}),
);
Expand All @@ -689,9 +691,13 @@ export default class ProjectService {
project: projectId,
createdBy,
data: {
roles,
groups,
users,
roles: roles.map((roleId) => {
return {
roleId,
groupIds: groups,
userIds: users,
};
}),
},
}),
);
Expand Down

0 comments on commit e67c20d

Please sign in to comment.