ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 30 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 39 of file class.ilSoapGroupAdministration.php.

References $DIC, $ref_id, ilGroupXMLParser\$UPDATE, ilObject\_isInTrash(), ilSoapAdministration\checkSession(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\getMessage(), ilSoapAdministration\getMessageCode(), ilObjectFactory\getTypeByRefId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilSoapAdministration\raiseError().

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

◆ getGroupsForUser()

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

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

References $DIC, $r, $ref_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.

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

◆ groupExists()

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

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

References $DIC, $user_id, ilObject\_getAllReferences(), ilGroupParticipants\_getInstanceByObjId(), ilObject\_isInTrash(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilSoapAdministration\checkSession(), ilObjectFactory\getInstanceByObjId(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\getMessage(), ilSoapAdministration\getMessageCode(), ilUtil\groupNameExists(), ilParticipants\IL_GRP_ADMIN, ilParticipants\IL_GRP_MEMBER, ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilSoapAdministration\raiseError().

117  {
118  $this->initAuth($sid);
119  $this->initIlias();
120 
121  if (!$this->checkSession($sid)) {
122  return $this->raiseError($this->getMessage(), $this->getMessageCode());
123  }
124 
125  if (!$title) {
126  return $this->raiseError(
127  'No title given. Please choose an title for the group in question.',
128  'Client'
129  );
130  }
131 
132  return ilUtil::groupNameExists($title);
133  }
raiseError(string $a_message, $a_code)
static groupNameExists(string $a_group_name, ?int $a_id=null)
checks if group name already exists.
+ Here is the call graph for this function:

Field Documentation

◆ ADMIN

const ilSoapGroupAdministration::ADMIN = 2

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

Referenced by getGroupsForUser().

◆ MEMBER

const ilSoapGroupAdministration::MEMBER = 1

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

Referenced by getGroupsForUser().

◆ OWNER

const ilSoapGroupAdministration::OWNER = 4

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

Referenced by getGroupsForUser().


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