Skip to content

Commit

Permalink
[core] Fix incorrect message/error for instrument access (#8284)
Browse files Browse the repository at this point in the history
An incorrect error message was displayed on the frontend when a user did not have the permission to access an instrument.
The code was test looping on ALL permissions, but it failed when trying to do so on only ONE permission (the loop went through the instrument name and permission instead of the actual instruments objects).

Resolves #8171
  • Loading branch information
regisoc authored Jan 12, 2023
1 parent e054e67 commit 8a0b2c8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions php/libraries/NDB_BVL_Instrument.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,18 @@ abstract class NDB_BVL_Instrument extends NDB_Page
} else { //check if user has instrument's permissions
//is the instrument listed at all in instrumentPermissions?
$instrumentListed = false;
foreach ($instrumentPermissions["instrument"] as $instrument) {
// get an array of instruments
// if one instrument, get it into an array
$instrumentList = Utility::asArray(
$instrumentPermissions["instrument"]
);
// iterate through instruments
foreach ($instrumentList as $instrument) {
if ($instrument["Test_name"] == $this->testName) {
$instrumentListed = true;
$instrumentPerms = Utility::asArray($instrument["permission"]);
$instrumentPerms = Utility::asArray(
$instrument["permission"]
);
}
}

Expand Down

0 comments on commit 8a0b2c8

Please # to comment.