From 40fb43e314fcbefa4c34636e1969eb047a423cff Mon Sep 17 00:00:00 2001 From: alex <48489896+devnaumov@users.noreply.github.com> Date: Tue, 27 Dec 2022 14:05:47 +0100 Subject: [PATCH] CB-2550 check that team is not granted yet (#1375) --- .../src/Administration/Users/UserForm/UserFormController.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/UserFormController.ts b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/UserFormController.ts index 29fb1a05ae..e496fb9da6 100644 --- a/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/UserFormController.ts +++ b/webapp/packages/plugin-authentication-administration/src/Administration/Users/UserForm/UserFormController.ts @@ -295,7 +295,9 @@ export class UserFormController implements IInitializableController, IDestructib await this.usersResource.grantTeam(this.user.userId, teamId, true); } } else { - await this.usersResource.revokeTeam(this.user.userId, teamId, true); + if (this.user.grantedTeams.includes(teamId)) { + await this.usersResource.revokeTeam(this.user.userId, teamId, true); + } } } }