Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

#0043452: getTreeChilds & getXMLTree: add checks for empty types and user_ids #8854

Merged
Merged
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
2 changes: 1 addition & 1 deletion webservice/soap/classes/class.ilObjectXMLWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ private function appendOperations(int $a_ref_id, string $a_type): void
$ops_ids = ilRbacReview::lookupCreateOperationIds(array_keys($objects));
$creation_operations = array();
foreach ($objects as $type => $info) {
$ops_id = $ops_ids[$type];
$ops_id = $ops_ids[$type] ?? null;

if (!$ops_id) {
continue;
Expand Down
13 changes: 9 additions & 4 deletions webservice/soap/classes/class.ilSoapObjectAdministration.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ public function searchObjects(string $sid, ?array $types, string $key, string $c
/**
* @return soap_fault|SoapFault|string|null
*/
public function getTreeChilds(string $sid, int $ref_id, ?array $types, ?int $user_id = null)
public function getTreeChilds(string $sid, int $ref_id, ?array $types = null, ?int $user_id = null)
{
$this->initAuth($sid);
$this->initIlias();
Expand Down Expand Up @@ -417,7 +417,7 @@ public function getTreeChilds(string $sid, int $ref_id, ?array $types, ?int $use
);
}

if (!is_array($types)) {
if (!is_array($types) || empty($types)) {
$all = true;
}

Expand Down Expand Up @@ -449,7 +449,7 @@ public function getTreeChilds(string $sid, int $ref_id, ?array $types, ?int $use
/**
* @return soap_fault|SoapFault|string|null
*/
public function getXMLTree(string $sid, int $ref_id, ?array $types, ?int $user_id =null)
public function getXMLTree(string $sid, int $ref_id, ?array $types = null, ?int $user_id = null)
{
$this->initAuth($sid);
$this->initIlias();
Expand All @@ -466,6 +466,11 @@ public function getXMLTree(string $sid, int $ref_id, ?array $types, ?int $user_i
$nodedata = $tree->getNodeData($ref_id);
$nodearray = $tree->getSubTree($nodedata);

$all = false;
if (!is_array($types) || empty($types)) {
$all = true;
}

$filter = $types;

global $DIC;
Expand All @@ -476,7 +481,7 @@ public function getXMLTree(string $sid, int $ref_id, ?array $types, ?int $user_i
if (
!$objDefinition->isAdministrationObject($node['type']) &&
!$objDefinition->isSystemObject($node['type']) &&
!in_array($node['type'], $filter, true) &&
($all || !in_array($node['type'], $filter, true)) &&
$access->checkAccess("read", "", (int) $node['ref_id']) &&
($tmp = ilObjectFactory::getInstanceByRefId($node['ref_id'], false))) {
$nodes[] = $tmp;
Expand Down
4 changes: 2 additions & 2 deletions webservice/soap/include/inc.soap_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public static function searchObjects(string $sid, array $types, string $key, str
/**
* @return soap_fault|SoapFault|string|null
*/
public static function getTreeChilds(string $sid, int $ref_id, array $types, int $user_id)
public static function getTreeChilds(string $sid, int $ref_id, ?array $types = null, ?int $user_id = null)
{
include_once './webservice/soap/classes/class.ilSoapObjectAdministration.php';
$soa = new ilSoapObjectAdministration();
Expand All @@ -263,7 +263,7 @@ public static function getTreeChilds(string $sid, int $ref_id, array $types, int
/**
* @return soap_fault|SoapFault|string|null
*/
public static function getXMLTree(string $sid, int $ref_id, array $types, ?int $user_id = null)
public static function getXMLTree(string $sid, int $ref_id, ?array $types = null, ?int $user_id = null)
{
include_once './webservice/soap/classes/class.ilSoapObjectAdministration.php';
$soa = new ilSoapObjectAdministration();
Expand Down
Loading