Skip to content

Commit

Permalink
(fix) requiredPrivilege should not display an error if privilege is u…
Browse files Browse the repository at this point in the history
…ndefined (#504)
  • Loading branch information
ibacher authored Aug 15, 2022
1 parent 3038800 commit 144a312
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function setUserLanguage(data: Session) {
}

function userHasPrivilege(
requiredPrivilege: string | string[],
requiredPrivilege: string | string[] | undefined,
user: { privileges: Array<Privilege> }
) {
if (typeof requiredPrivilege === "string") {
Expand All @@ -134,7 +134,7 @@ function userHasPrivilege(
return requiredPrivilege.every(
(rp) => !isUndefined(user.privileges.find((p) => rp === p.display))
);
} else {
} else if (!isUndefined(requiredPrivilege)) {
console.error(`Could not understand privileges "${requiredPrivilege}"`);
}

Expand Down

0 comments on commit 144a312

Please sign in to comment.