Skip to content

Commit

Permalink
Merge pull request ILIAS-eLearning#7627 from ingoj/release_8-SOAPObje…
Browse files Browse the repository at this point in the history
…ctAdministration

fix some functoins if optional parameters are omitted
  • Loading branch information
jeph864 authored Nov 29, 2024
2 parents 6977315 + e99189e commit 4620330
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions webservice/soap/classes/class.ilSoapObjectAdministration.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function getObjIdsByRefIds(string $sid, array $ref_ids)
/**
* @return soap_fault|SoapFault|string|null
*/
public function getObjectByReference(string $sid, int $a_ref_id, int $user_id)
public function getObjectByReference(string $sid, int $a_ref_id, ?int $user_id = null)
{
$this->initAuth($sid);
$this->initIlias();
Expand All @@ -178,7 +178,7 @@ public function getObjectByReference(string $sid, int $a_ref_id, int $user_id)

$xml_writer = new ilObjectXMLWriter();
$xml_writer->enablePermissionCheck(true);
if ($user_id) {
if (is_int($user_id)) {
$xml_writer->setUserId($user_id);
$xml_writer->enableOperations(true);
}
Expand All @@ -192,7 +192,7 @@ public function getObjectByReference(string $sid, int $a_ref_id, int $user_id)
/**
* @return soap_fault|SoapFault|string|null
*/
public function getObjectsByTitle(string $sid, string $a_title, int $user_id)
public function getObjectsByTitle(string $sid, string $a_title, ?int $user_id = null)
{
$this->initAuth($sid);
$this->initIlias();
Expand Down Expand Up @@ -251,7 +251,7 @@ public function getObjectsByTitle(string $sid, string $a_title, int $user_id)

$xml_writer = new ilObjectXMLWriter();
$xml_writer->enablePermissionCheck(true);
if ($user_id) {
if (is_int($user_id)) {
$xml_writer->setUserId($user_id);
$xml_writer->enableOperations(true);
}
Expand All @@ -265,7 +265,7 @@ public function getObjectsByTitle(string $sid, string $a_title, int $user_id)
/**
* @return soap_fault|SoapFault|string|null
*/
public function searchObjects(string $sid, array $types, string $key, string $combination, int $user_id)
public function searchObjects(string $sid, ?array $types, string $key, string $combination, ?int $user_id = null)
{
$this->initAuth($sid);
$this->initIlias();
Expand Down Expand Up @@ -344,7 +344,7 @@ public function searchObjects(string $sid, array $types, string $key, string $co
$object_search = new ilLikeObjectSearch($query_parser);
$object_search->setFilter($types);
$res = $object_search->performSearch();
if ($user_id) {
if (is_int($user_id)) {
$res->setUserId($user_id);
}
$res->setMaxHits(100);
Expand Down Expand Up @@ -389,7 +389,7 @@ public function searchObjects(string $sid, array $types, string $key, string $co
/**
* @return soap_fault|SoapFault|string|null
*/
public function getTreeChilds(string $sid, int $ref_id, array $types, int $user_id)
public function getTreeChilds(string $sid, int $ref_id, ?array $types, ?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 $user_
);
}

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

Expand All @@ -436,7 +436,7 @@ public function getTreeChilds(string $sid, int $ref_id, array $types, int $user_
$xml_writer->enablePermissionCheck(true);
$xml_writer->setObjects($objs);
$xml_writer->enableOperations(true);
if ($user_id) {
if (is_int($user_id)) {
$xml_writer->setUserId($user_id);
}

Expand All @@ -449,7 +449,7 @@ public function getTreeChilds(string $sid, int $ref_id, array $types, int $user_
/**
* @return soap_fault|SoapFault|string|null
*/
public function getXMLTree(string $sid, int $ref_id, array $types, int $user_id)
public function getXMLTree(string $sid, int $ref_id, ?array $types, ?int $user_id =null)
{
$this->initAuth($sid);
$this->initIlias();
Expand Down Expand Up @@ -489,7 +489,7 @@ public function getXMLTree(string $sid, int $ref_id, array $types, int $user_id)
$xml_writer->setObjects($nodes);
$xml_writer->enableOperations(false);

if ($user_id) {
if (is_int($user_id)) {
$xml_writer->setUserId($user_id);
}

Expand Down
8 changes: 4 additions & 4 deletions webservice/soap/include/inc.soap_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public static function getRefIdsByObjId(string $sid, int $object_id)
/**
* @return soap_fault|SoapFault|string|null
*/
public static function getObjectByReference(string $sid, int $a_ref_id, int $user_id)
public static function getObjectByReference(string $sid, int $a_ref_id, ?int $user_id = null)
{
include_once './webservice/soap/classes/class.ilSoapObjectAdministration.php';
$soa = new ilSoapObjectAdministration();
Expand All @@ -183,7 +183,7 @@ public static function getObjectByReference(string $sid, int $a_ref_id, int $use
/**
* @return soap_fault|SoapFault|string|null
*/
public static function getObjectsByTitle(string $sid, string $a_title, int $user_id)
public static function getObjectsByTitle(string $sid, string $a_title, ?int $user_id = null)
{
include_once './webservice/soap/classes/class.ilSoapObjectAdministration.php';
$soa = new ilSoapObjectAdministration();
Expand Down Expand Up @@ -243,7 +243,7 @@ public static function updateObjects(string $sid, string $obj_xml)
/**
* @return soap_fault|SoapFault|string|null
*/
public static function searchObjects(string $sid, array $types, string $key, string $combination, int $user_id)
public static function searchObjects(string $sid, array $types, string $key, string $combination, ?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)
public static function getXMLTree(string $sid, int $ref_id, array $types, ?int $user_id = null)
{
include_once './webservice/soap/classes/class.ilSoapObjectAdministration.php';
$soa = new ilSoapObjectAdministration();
Expand Down

0 comments on commit 4620330

Please sign in to comment.