Skip to content

Commit

Permalink
feat(api): Log any access granted as part of a legacy fallback. (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajordens authored May 1, 2019
1 parent 1df3824 commit 4e4c282
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ public boolean hasPermission(String username,
hasPermission ? null : new AuthorizationFailure(a, r, resourceName.toString())
);

if (permission != null && permission.isLegacyFallback() && hasPermission) {
// log any access that was granted as part of a legacy fallback.
if (a == Authorization.READ) {
// purposely logging at 'debug' as 'READ' will be sufficiently more verbose
log.debug("Legacy fallback granted {} access (type: {}, resource: {})", a, r, resourceName);
} else {
log.warn("Legacy fallback granted {} access (type: {}, resource: {})", a, r, resourceName);
}
}

return hasPermission;
}

Expand Down

0 comments on commit 4e4c282

Please sign in to comment.