permission-node: simplify undefined check and fix applyConditions signature

Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
MT Lewis
2021-12-22 10:17:21 +00:00
parent 8e72b573aa
commit cbb85e07f0
@@ -93,13 +93,13 @@ export type ApplyConditionsResponse = ApplyConditionsResponseEntry[];
const applyConditions = <TResource>(
criteria: PermissionCriteria<PermissionCondition>,
resource: TResource,
resource: TResource | undefined,
getRule: (name: string) => PermissionRule<TResource, unknown>,
): boolean => {
// If resource was not found, deny. This avoids leaking information from the
// apply-conditions API which would allow a user to differentiate between
// non-existent resources and resources to which they do not have access.
if (typeof resource === 'undefined') {
if (resource === undefined) {
return false;
}