Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*
*********************************************************************/

declare(strict_types=1);

/**
* Soap object administration methods
* @author Stefan Meyer <meyer@leifos.com>
Expand Down
10 changes: 10 additions & 0 deletions components/ILIAS/soap/classes/class.ilSoapTestAdministration.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ public function isAllowedCall(string $sid, int $active_id, bool $saveaction = tr
}

if ($saveaction) {
$owner_result = $ilDB->queryF(
"SELECT user_fi FROM tst_active WHERE active_id = %s",
array('integer'),
array($active_id)
);
$owner_row = $ilDB->fetchAssoc($owner_result);
if (!is_array($owner_row) || (int) $owner_row['user_fi'] !== $ilUser->getId()) {
return false;
}

$result = $ilDB->queryF(
"SELECT * FROM tst_times WHERE active_fi = %s ORDER BY started DESC",
array('integer'),
Expand Down
12 changes: 9 additions & 3 deletions components/ILIAS/soap/classes/class.ilSoapUserAdministration.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,15 +518,21 @@ public function getUserForRole(string $sid, int $role_id, bool $attachRoles, int
$tree = $DIC->repositoryTree();
$ilUser = $DIC->user();
$access = $DIC->access();
$rbacsystem = $DIC->rbac()->system();

$global_roles = $rbacreview->getGlobalRoles();

if (in_array($role_id, $global_roles, true)) {
// global roles
if ($role_id === SYSTEM_ROLE_ID &&
!in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()), true)) {
$actor_has_system_role = in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()), true);

if ($role_id === SYSTEM_ROLE_ID && !$actor_has_system_role) {
return $this->raiseError("Role access not permitted. ($role_id)", "Server");
}

if (!$actor_has_system_role &&
!$rbacsystem->checkAccessOfUser($ilUser->getId(), 'edit_userassignment', ROLE_FOLDER_ID)) {
return $this->raiseError('Role access not permitted. ' . '(' . $role_id . ')', 'Server');
}
} else {
// local roles
$rolfs = $rbacreview->getFoldersAssignedToRole($role_id, true);
Expand Down
Loading