Skip to content

Commit 88f9f38

Browse files
authored
fix(api-aco): clone original permissions to prevent mutation while decorating with teams' permissions (#4632)
1 parent 02966b1 commit 88f9f38

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/api-aco/src/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class GetDefaultPermissionsWithTeams implements IGetDefaultPermissions {
2121
this.decoretee = decoretee;
2222
}
2323

24-
async execute(permissions: FolderPermission[]) {
24+
async execute(originalPermissions: FolderPermission[]) {
2525
/**
2626
* Retrieves the list of teams the current identity belongs to and checks if any of these teams
2727
* have permissions for the folder. If a team has permissions, the current identity is granted
@@ -30,6 +30,8 @@ export class GetDefaultPermissionsWithTeams implements IGetDefaultPermissions {
3030
const identity = this.getIdentityGateway.execute();
3131
const identityTeams: Team[] = (await this.listIdentityTeamsGateway.execute()) ?? [];
3232

33+
const permissions = [...originalPermissions]; // Clone the original permissions to avoid mutation.
34+
3335
if (identityTeams.length) {
3436
for (const identityTeam of identityTeams) {
3537
// Check if the team has permissions for the folder.

0 commit comments

Comments
 (0)