ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSoapGroupAdministration Class Reference
+ Inheritance diagram for ilSoapGroupAdministration:
+ Collaboration diagram for ilSoapGroupAdministration:

Public Member Functions

 addGroup (string $sid, int $target_id, string $grp_xml)
 
 groupExists (string $sid, string $title)
 
 getGroupsForUser (string $sid, string $parameters)
 
- Public Member Functions inherited from ilSoapAdministration
 __construct (bool $use_nusoap=true)
 
 getMessage ()
 
 appendMessage (string $a_str)
 
 setMessageCode (string $a_code)
 
 getMessageCode ()
 
 reInitUser ()
 
 isFault ($object)
 
 getInstallationInfoXML ()
 
 getClientInfoXML (string $clientid)
 

Data Fields

const MEMBER = 1
 
const ADMIN = 2
 
const OWNER = 4
 
- Data Fields inherited from ilSoapAdministration
const NUSOAP = 1
 
const PHP5 = 2
 
int $error_method
 Defines type of error handling (PHP5 || NUSOAP) More...
 

Additional Inherited Members

- Protected Member Functions inherited from ilSoapAdministration
 checkSession (string $sid)
 
 explodeSid (string $sid)
 
 setMessage (string $a_str)
 
 initAuth (string $sid)
 
 initIlias ()
 
 initAuthenticationObject ()
 
 raiseError (string $a_message, $a_code)
 
 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 More...
 
- Protected Attributes inherited from ilSoapAdministration
bool $soap_check = true
 
string $message = ''
 
string $message_code = ''
 

Detailed Description

Definition at line 24 of file class.ilSoapGroupAdministration.php.

Member Function Documentation

◆ addGroup()

ilSoapGroupAdministration::addGroup ( string  $sid,
int  $target_id,
string  $grp_xml 
)
Returns
soap_fault|SoapFault|string|null

Definition at line 33 of file class.ilSoapGroupAdministration.php.

34 {
35 $this->initAuth($sid);
36 $this->initIlias();
37
38 if (!$this->checkSession($sid)) {
39 return $this->raiseError($this->getMessage(), $this->getMessageCode());
40 }
41
42 global $DIC;
43
44 $rbacsystem = $DIC['rbacsystem'];
45
46 if (!$rbacsystem->checkAccess('create', $target_id, 'grp')) {
47 return $this->raiseError('Check access failed. No permission to create groups', 'Server');
48 }
49
50 if (ilObject::_isInTrash($target_id)) {
51 return $this->raiseError("Parent with ID $target_id has been deleted.", 'CLIENT_TARGET_DELETED');
52 }
53
54 $newObj = new ilObjGroup();
55 $newObj->setTitle('dummy');
56 $newObj->setDescription("");
57 $newObj->create();
58
59 $xml_parser = new ilGroupXMLParser($newObj, $grp_xml, $target_id);
60 $xml_parser->startParsing();
61 $new_ref_id = $xml_parser->getObjectRefId();
62
63 return $new_ref_id ?: "0";
64 }
Group Import Parser.
Class ilObjGroup.
static _isInTrash(int $ref_id)
raiseError(string $a_message, $a_code)
global $DIC
Definition: shib_login.php:26

References $DIC, ilObject\_isInTrash(), ilSoapAdministration\checkSession(), ilSoapAdministration\getMessage(), ilSoapAdministration\getMessageCode(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilSoapAdministration\raiseError().

+ Here is the call graph for this function:

◆ getGroupsForUser()

ilSoapGroupAdministration::getGroupsForUser ( string  $sid,
string  $parameters 
)
Returns
soap_fault|SoapFault|string|null

Definition at line 323 of file class.ilSoapGroupAdministration.php.

324 {
325 $this->initAuth($sid);
326 $this->initIlias();
327
328 if (!$this->checkSession($sid)) {
329 return $this->raiseError($this->getMessage(), $this->getMessageCode());
330 }
331 global $DIC;
332
333 $rbacreview = $DIC['rbacreview'];
334 $ilObjDataCache = $DIC['ilObjDataCache'];
335 $tree = $DIC['tree'];
336
337 $parser = new ilXMLResultSetParser($parameters);
338 try {
339 $parser->startParsing();
340 } catch (ilSaxParserException $exception) {
341 return $this->raiseError($exception->getMessage(), "Client");
342 }
343 $xmlResultSet = $parser->getXMLResultSet();
344
345 if (!$xmlResultSet->hasColumn("user_id")) {
346 return $this->raiseError("parameter user_id is missing", "Client");
347 }
348
349 if (!$xmlResultSet->hasColumn("status")) {
350 return $this->raiseError("parameter status is missing", "Client");
351 }
352
353 $user_id = (int) $xmlResultSet->getValue(0, "user_id");
354 $status = (int) $xmlResultSet->getValue(0, "status");
355
356 $ref_ids = array();
357
360 foreach ($rbacreview->assignedRoles($user_id) as $role_id) {
361 if ($role = ilObjectFactory::getInstanceByObjId($role_id, false)) {
362 #echo $role->getType();
363 if ($role->getType() !== "role") {
364 continue;
365 }
366
367 if ($role->getParent() == ROLE_FOLDER_ID) {
368 continue;
369 }
370 $role_title = $role->getTitle();
371
372 if ($ref_id = ilUtil::__extractRefId($role_title)) {
374 continue;
375 }
376
377 #echo $role_title;
379 $role_title,
380 "member"
381 ) !== false) {
382 $ref_ids [] = $ref_id;
384 $role_title,
385 "admin"
386 ) !== false) {
387 $ref_ids [] = $ref_id;
388 }
389 }
390 }
391 }
392 }
393
395 $owned_objects = ilObjectFactory::getObjectsForOwner("grp", $user_id);
396 foreach ($owned_objects as $obj_id) {
397 $allrefs = ilObject::_getAllReferences($obj_id);
398 $refs = array();
399 foreach ($allrefs as $r) {
400 if ($tree->isDeleted($r)) {
401 continue;
402 }
403 if ($tree->isInTree($r)) {
404 $refs[] = $r;
405 }
406 }
407 if (count($refs) > 0) {
408 $ref_ids[] = array_pop($refs);
409 }
410 }
411 }
412 $ref_ids = array_unique($ref_ids);
413
414 $xmlResultSet = new ilXMLResultSet();
415 $xmlResultSet->addColumn("ref_id");
416 $xmlResultSet->addColumn("xml");
417 $xmlResultSet->addColumn("parent_ref_id");
418
419 foreach ($ref_ids as $group_id) {
420 $group_obj = $this->checkObjectAccess($group_id, ['grp'], "write", true);
421 if ($group_obj instanceof ilObjGroup) {
422 $row = new ilXMLResultSetRow();
423 $row->setValue("ref_id", $group_id);
424 $xmlWriter = new ilGroupXMLWriter($group_obj);
425 $xmlWriter->setAttachUsers(false);
426 $xmlWriter->start();
427 $row->setValue("xml", $xmlWriter->getXML());
428 $row->setValue("parent_ref_id", $tree->getParentId($group_id));
429 $xmlResultSet->addRow($row);
430 }
431 }
432 $xmlResultSetWriter = new ilXMLResultSetWriter($xmlResultSet);
433 $xmlResultSetWriter->start();
434 return $xmlResultSetWriter->getXML();
435 }
static getObjectsForOwner(string $object_type, int $owner_id)
returns all objects of an owner, filtered by type, objects are not deleted!
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static _getAllReferences(int $id)
get all reference ids for object ID
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
static __extractRefId(string $role_title)
extract ref id from role title, e.g.
Row Class for XMLResultSet.
XML Writer for XMLResultSet.
const ROLE_FOLDER_ID
Definition: constants.php:34
$ref_id
Definition: ltiauth.php:66

References $DIC, $ref_id, $user_id, ilUtil\__extractRefId(), ilObject\_exists(), ilObject\_getAllReferences(), ilObject\_isInTrash(), ADMIN, ilSoapAdministration\checkObjectAccess(), ilSoapAdministration\checkSession(), ilObjectFactory\getInstanceByObjId(), ilSoapAdministration\getMessage(), ilSoapAdministration\getMessageCode(), ilObjectFactory\getObjectsForOwner(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), ILIAS\Repository\int(), MEMBER, OWNER, ilSoapAdministration\raiseError(), and ROLE_FOLDER_ID.

+ Here is the call graph for this function:

◆ groupExists()

ilSoapGroupAdministration::groupExists ( string  $sid,
string  $title 
)
Returns
bool|soap_fault|SoapFault|null

Definition at line 110 of file class.ilSoapGroupAdministration.php.

111 {
112 $this->initAuth($sid);
113 $this->initIlias();
114
115 if (!$this->checkSession($sid)) {
116 return $this->raiseError($this->getMessage(), $this->getMessageCode());
117 }
118
119 if (!$title) {
120 return $this->raiseError(
121 'No title given. Please choose an title for the group in question.',
122 'Client'
123 );
124 }
125
126 return ilUtil::groupNameExists($title);
127 }
static groupNameExists(string $a_group_name, ?int $a_id=null)
checks if group name already exists.

References ilSoapAdministration\checkSession(), ilSoapAdministration\getMessage(), ilSoapAdministration\getMessageCode(), ilUtil\groupNameExists(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilSoapAdministration\raiseError().

+ Here is the call graph for this function:

Field Documentation

◆ ADMIN

const ilSoapGroupAdministration::ADMIN = 2

Definition at line 27 of file class.ilSoapGroupAdministration.php.

Referenced by getGroupsForUser().

◆ MEMBER

const ilSoapGroupAdministration::MEMBER = 1

Definition at line 26 of file class.ilSoapGroupAdministration.php.

Referenced by getGroupsForUser().

◆ OWNER

const ilSoapGroupAdministration::OWNER = 4

Definition at line 28 of file class.ilSoapGroupAdministration.php.

Referenced by getGroupsForUser().


The documentation for this class was generated from the following file: