Skip to content

Commit

Permalink
[backend] Fix organization admin user can't delete user account status
Browse files Browse the repository at this point in the history
  • Loading branch information
marieflorescontact committed Aug 23, 2024
1 parent 7ca2cc2 commit 43ec7f6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion opencti-platform/opencti-graphql/src/domain/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ export const userDelete = async (context, user, userId) => {
// When user is organization admin, we make sure that the deleted user is in one of the administrated organizations of the admin
const userData = await storeLoadById(context, user, userId, ENTITY_TYPE_USER);
const myAdministratedOrganizationsIds = user.administrated_organizations.map(({ id }) => id);
if (!userData.objectOrganization.find((orga) => myAdministratedOrganizationsIds.includes(orga))) {
if (!userData['rel_granted.internal_id'].find((orga) => myAdministratedOrganizationsIds.includes(orga))) {
throw ForbiddenAccess();
}
}
Expand Down

0 comments on commit 43ec7f6

Please sign in to comment.