Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[examiner] Adds permission check when adding examiner to site. #9188

Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions modules/examiner/php/addexaminer.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,21 @@ class AddExaminer extends \NDB_Page
$fullName = $values['addName'] ?? '';
$siteID = $values['addSite'] ?? '';

// check for site permissions
$user = \User::singleton();
if (!$user->hasAnyPermission(
[
'superuser',
racostas marked this conversation as resolved.
Show resolved Hide resolved
'examiner_multisite',
]
)
&& !in_array($siteID, $user->getCenterIDs())
) {
return new \LORIS\Http\Response\JSON\Conflict(
racostas marked this conversation as resolved.
Show resolved Hide resolved
'Permission denied: You cannot assign examiner to this Site.'
);
};

if ($this->examinerExists($fullName, $siteID)) {
return new \LORIS\Http\Response\JSON\Conflict(
'This examiner already exists.'
Expand Down
16 changes: 14 additions & 2 deletions modules/examiner/php/examiner.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,22 @@ class Examiner extends \DataFrameworkMenu

$useCertification = ($this->useCertification == 1) ? true : false;

$user = \User::singleton();
if ($user->hasAnyPermission(
[
'superuser',
'examiner_multisite',
]
)
) {
$sites = \Utility::getSiteList(false);
} else {
$sites = $user->getStudySites();
}
return [
'sites' => \Utility::getSiteList(false),
'sites' => $sites,
'radiologists' => $yesNoOptions,
'useCertification' => $useCertification,
'useCertification' => $useCertification,
];

}
Expand Down
Loading