Skip to content

Commit

Permalink
refactor: FORMS-1408 remove unnecessary if (bcgov#1455)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterMoar authored Aug 1, 2024
1 parent b58ee10 commit 81363aa
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions app/src/forms/auth/middleware/userAccess.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,15 +356,9 @@ const hasRoleModifyPermissions = async (req, _res, next) => {

if (userRoles.includes(Roles.OWNER)) {
// Can't remove a different user's owner role unless you are an owner.
//
// TODO: Remove this if statement and just throw the exception. It's not
// possible for userId === currentUser.id since we're in an if that we
// are !isOwner but also that userRoles.includes(Roles.OWNER).
if (userId !== currentUser.id) {
throw new Problem(401, {
detail: "You can't update an owner's roles.",
});
}
throw new Problem(401, {
detail: "You can't update an owner's roles.",
});
} else if (futureRoles.includes(Roles.OWNER)) {
// Can't add an owner role unless you are an owner.
throw new Problem(401, {
Expand Down

0 comments on commit 81363aa

Please sign in to comment.