19declare(strict_types=1);
47 defined(
'IL_SOAPMODE') &&
48 defined(
'IL_SOAPMODE_NUSOAP') &&
63 $ilUser =
$DIC->user();
78 if (!
$GLOBALS[
'DIC'][
'ilAuthSession']->isAuthenticated()) {
84 $can =
$DIC[
'legalDocuments']->canUseSoapApi()->applyTo(
new Ok($ilUser))->except(
85 fn($error) =>
new Error(is_string($error) ? $error : $error->getMessage())
93 if ($this->soap_check) {
95 $this->
setMessage(
'SOAP is not enabled in ILIAS administration for this client');
97 return ((
int) $set->get(
'soap_user_administration',
'0')) === 1;
105 $exploded = explode(
'::', $sid);
107 return is_array($exploded) ? $exploded : array(
'sid' =>
'',
'client' =>
'');
112 $this->message = $a_str;
122 $this->message .= isset($this->message) ?
' ' :
'';
123 $this->message .= $a_str;
128 $this->message_code = $a_code;
140 if (session_status() === PHP_SESSION_ACTIVE && $sid === session_id()) {
144 if (session_status() === PHP_SESSION_ACTIVE) {
161 }
catch (Exception
$e) {
171 }
catch (Exception
$e) {
188 switch ($this->error_method) {
190 require_once __DIR__ .
'/../lib/nusoap.php';
191 return new soap_fault($a_code,
'', $a_message);
193 return new SoapFault($a_code, $a_message);
200 switch ($this->error_method) {
202 require_once __DIR__ .
'/../lib/nusoap.php';
205 return $object instanceof SoapFault;
215 array $expected_type,
217 bool $returnObject =
false
221 $rbacsystem =
$DIC->rbac()->system();
226 'CLIENT_OBJECT_NOT_FOUND'
232 'Object is already trashed.',
233 'CLIENT_OBJECT_DELETED'
238 if (!in_array($type, $expected_type,
true)) {
240 "Wrong type $type for id. Expected: " . implode(
',', $expected_type),
241 'CLIENT_OBJECT_WRONG_TYPE'
244 if (!$rbacsystem->checkAccess($permission,
$ref_id, $type)) {
246 'Missing permission $permission for type $type.',
247 'CLIENT_OBJECT_WRONG_PERMISSION'
254 return $this->
raiseError(
'No valid ref_id given',
'Client');
269 if (is_array($clientdirs)) {
270 foreach ($clientdirs as $clientdir) {
271 $writer->addClient($clientdir);
275 return $writer->getXML();
290 if (!$writer->addClient($clientdir)) {
292 'Client ID ' . $clientid .
'does not exist!',
297 return $writer->getXML();
A result encapsulates a value or an error and simplifies the handling of those.
const int CONTEXT_SOAP
SOAP based authentication.
static setContext(int $a_context)
const CONTEXT_SOAP_WITHOUT_CLIENT
static getType()
Get context type.
static init(string $a_type)
Init context by type.
static initILIAS()
ilias initialisation
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
Object not found exception.
static _lookupType(int $id, bool $reference=false)
static _isInTrash(int $ref_id)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupObjId(int $ref_id)
getClientInfoXML(string $clientid)
raiseError(string $a_message, $a_code)
initAuthenticationObject()
appendMessage(string $a_str)
checkSession(string $sid)
__construct(bool $use_nusoap=true)
int $error_method
Defines type of error handling (PHP5 || NUSOAP)
checkObjectAccess(int $ref_id, array $expected_type, string $permission, bool $returnObject=false)
check access for ref id: expected type, permission, return object instance if returnobject is true
setMessageCode(string $a_code)
setMessage(string $a_str)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static setCookie(string $a_cookie_name, string $a_cookie_value='', bool $a_also_set_super_global=true, bool $a_set_cookie_invalid=false)