Skip to content

Commit

Permalink
OHDSI#2925 additional logging to attempt to identify specific permiss…
Browse files Browse the repository at this point in the history
…ions issues we're experiencing
  • Loading branch information
qcaas-nhs-sjt committed Apr 11, 2024
1 parent 14ec280 commit 9f77439
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions js/services/AuthAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,24 +219,31 @@ define(function(require, exports) {

var isPermitted = function (permission) {
if (!config.userAuthenticationEnabled) {
console.warn("User Authentication is not enabled");
return true;
}

if (!permissions()) return false;

if (!permissions()) {
console.error("permissions is not populated.");
return false;
}
firstPerm = permission.split(":")[0];

var etalons = [...(permissions()["*"] || []), ...(permissions()[firstPerm]||[])];
if (!etalons) {
console.error("etalons is not populated")
return false;
}

for (var i = 0; i < etalons.length; i++) {
if (checkPermission(permission, etalons[i])) {
console.info(`User has permission: ${permission}`)
return true;
}
}

console.warn(`${permission} is not present in etalons: ${etalons}`);

return false;
};

Expand Down

0 comments on commit 9f77439

Please sign in to comment.