Skip to content

Commit

Permalink
[backend] review: rename method
Browse files Browse the repository at this point in the history
  • Loading branch information
marieflorescontact committed Oct 17, 2024
1 parent 1e834b6 commit c125d0d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions opencti-platform/opencti-graphql/src/domain/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,14 +418,14 @@ export const roleEditContext = async (context, user, roleId, input) => {
});
};

const isAdministratedOrga = (user, organizationId) => {
const isUserAdministratingOrga = (user, organizationId) => {
return user.administrated_organizations.some(({ id }) => id === organizationId);
};

Check warning on line 423 in opencti-platform/opencti-graphql/src/domain/user.js

View check run for this annotation

Codecov / codecov/patch

opencti-platform/opencti-graphql/src/domain/user.js#L422-L423

Added lines #L422 - L423 were not covered by tests

export const assignOrganizationToUser = async (context, user, userId, organizationId) => {
if (isOnlyOrgaAdmin(user)) {
// When user is organization admin, we make sure she is also admin of organization added
if (!isAdministratedOrga(user, organizationId)) {
if (!isUserAdministratingOrga(user, organizationId)) {
throw ForbiddenAccess();
}

Check warning on line 430 in opencti-platform/opencti-graphql/src/domain/user.js

View check run for this annotation

Codecov / codecov/patch

opencti-platform/opencti-graphql/src/domain/user.js#L427-L430

Added lines #L427 - L430 were not covered by tests
}
Expand Down Expand Up @@ -1014,7 +1014,7 @@ export const userIdDeleteRelation = async (context, user, userId, toId, relation
export const userDeleteOrganizationRelation = async (context, user, userId, toId) => {
if (isOnlyOrgaAdmin(user)) {
// When user is organization admin, we make sure she is also admin of organization removed
if (!isAdministratedOrga(user, toId)) {
if (!isUserAdministratingOrga(user, toId)) {
throw ForbiddenAccess();
}

Check warning on line 1019 in opencti-platform/opencti-graphql/src/domain/user.js

View check run for this annotation

Codecov / codecov/patch

opencti-platform/opencti-graphql/src/domain/user.js#L1016-L1019

Added lines #L1016 - L1019 were not covered by tests
}
Expand Down

0 comments on commit c125d0d

Please sign in to comment.