Skip to content

Commit

Permalink
refactor: Update TeamPermissionService to include projectId in select…
Browse files Browse the repository at this point in the history
… props

This code change updates the TeamPermissionService to include the "projectId" property in the select props when querying for team members. This ensures that the "projectId" value is retrieved along with the "userId" value, allowing for easier access to the project ID in subsequent code logic.
  • Loading branch information
simlarsen committed May 31, 2024
1 parent 230d345 commit 93ba752
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions CommonServer/Services/TeamPermissionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,21 @@ export class Service extends DatabaseService<Model> {
});

for (const member of teamMembers) {
if (!member.userId) {
throw new BadDataException('Invalid User ID');
}

if (!member.projectId) {
throw new BadDataException('Invalid Project ID');
}

/// Refresh tokens.
await AccessTokenService.refreshUserGlobalAccessPermission(
member.userId!
member.userId
);
await AccessTokenService.refreshUserTenantAccessPermission(
member.userId!,
permission.projectId!
member.userId,
member.projectId
);
}
}
Expand Down Expand Up @@ -212,13 +220,21 @@ export class Service extends DatabaseService<Model> {
for (const member of onDelete.carryForward) {
const teamMember: TeamMember = member as TeamMember;

if (!teamMember.userId) {
throw new BadDataException('Invalid User ID');
}

if (!teamMember.projectId) {
throw new BadDataException('Invalid Project ID');
}

/// Refresh tokens.
await AccessTokenService.refreshUserGlobalAccessPermission(
teamMember.userId!
teamMember.userId
);
await AccessTokenService.refreshUserTenantAccessPermission(
teamMember.userId!,
teamMember.projectId!
teamMember.userId,
teamMember.projectId
);
}

Expand Down

0 comments on commit 93ba752

Please sign in to comment.