ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 32 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 41 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().

42  {
43  $this->initAuth($sid);
44  $this->initIlias();
45 
46  if (!$this->checkSession($sid)) {
47  return $this->raiseError($this->getMessage(), $this->getMessageCode());
48  }
49 
50  global $DIC;
51 
52  $rbacsystem = $DIC['rbacsystem'];
53 
54  if (!$rbacsystem->checkAccess('create', $target_id, 'grp')) {
55  return $this->raiseError('Check access failed. No permission to create groups', 'Server');
56  }
57 
59  return $this->raiseError("Parent with ID $target_id has been deleted.", 'CLIENT_TARGET_DELETED');
60  }
61 
62  $newObj = new ilObjGroup();
63  $newObj->setTitle('dummy');
64  $newObj->setDescription("");
65  $newObj->create();
66 
67  include_once("./Modules/Group/classes/class.ilObjGroup.php");
68  include_once 'Modules/Group/classes/class.ilGroupXMLParser.php';
69  $xml_parser = new ilGroupXMLParser($newObj, $grp_xml, $target_id);
70  $xml_parser->startParsing();
71  $new_ref_id = $xml_parser->getObjectRefId();
72 
73  return $new_ref_id ?: "0";
74  }
raiseError(string $a_message, $a_code)
$target_id
Definition: goto.php:52
global $DIC
Definition: feed.php:28
static _isInTrash(int $ref_id)
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 339 of file class.ilSoapGroupAdministration.php.

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

340  {
341  $this->initAuth($sid);
342  $this->initIlias();
343 
344  if (!$this->checkSession($sid)) {
345  return $this->raiseError($this->getMessage(), $this->getMessageCode());
346  }
347  global $DIC;
348 
349  $rbacreview = $DIC['rbacreview'];
350  $ilObjDataCache = $DIC['ilObjDataCache'];
351  $tree = $DIC['tree'];
352 
353  include_once 'webservice/soap/classes/class.ilXMLResultSetParser.php';
354  $parser = new ilXMLResultSetParser($parameters);
355  try {
356  $parser->startParsing();
357  } catch (ilSaxParserException $exception) {
358  return $this->raiseError($exception->getMessage(), "Client");
359  }
360  $xmlResultSet = $parser->getXMLResultSet();
361 
362  if (!$xmlResultSet->hasColumn("user_id")) {
363  return $this->raiseError("parameter user_id is missing", "Client");
364  }
365 
366  if (!$xmlResultSet->hasColumn("status")) {
367  return $this->raiseError("parameter status is missing", "Client");
368  }
369 
370  $user_id = (int) $xmlResultSet->getValue(0, "user_id");
371  $status = (int) $xmlResultSet->getValue(0, "status");
372 
373  $ref_ids = array();
374 
377  foreach ($rbacreview->assignedRoles($user_id) as $role_id) {
378  if ($role = ilObjectFactory::getInstanceByObjId($role_id, false)) {
379  #echo $role->getType();
380  if ($role->getType() !== "role") {
381  continue;
382  }
383 
384  if ($role->getParent() == ROLE_FOLDER_ID) {
385  continue;
386  }
387  $role_title = $role->getTitle();
388 
389  if ($ref_id = ilUtil::__extractRefId($role_title)) {
391  continue;
392  }
393 
394  #echo $role_title;
395  if (ilSoapGroupAdministration::MEMBER == ($status & ilSoapGroupAdministration::MEMBER) && strpos(
396  $role_title,
397  "member"
398  ) !== false) {
399  $ref_ids [] = $ref_id;
400  } elseif (ilSoapGroupAdministration::ADMIN == ($status & ilSoapGroupAdministration::ADMIN) && strpos(
401  $role_title,
402  "admin"
403  ) !== false) {
404  $ref_ids [] = $ref_id;
405  }
406  }
407  }
408  }
409  }
410 
411  if (($status & ilSoapGroupAdministration::OWNER) == ilSoapGroupAdministration::OWNER) {
412  $owned_objects = ilObjectFactory::getObjectsForOwner("grp", $user_id);
413  foreach ($owned_objects as $obj_id) {
414  $allrefs = ilObject::_getAllReferences($obj_id);
415  $refs = array();
416  foreach ($allrefs as $r) {
417  if ($tree->isDeleted($r)) {
418  continue;
419  }
420  if ($tree->isInTree($r)) {
421  $refs[] = $r;
422  }
423  }
424  if (count($refs) > 0) {
425  $ref_ids[] = array_pop($refs);
426  }
427  }
428  }
429  $ref_ids = array_unique($ref_ids);
430 
431  include_once 'webservice/soap/classes/class.ilXMLResultSetWriter.php';
432  include_once 'Modules/Group/classes/class.ilObjGroup.php';
433  include_once 'Modules/Group/classes/class.ilGroupXMLWriter.php';
434 
435  $xmlResultSet = new ilXMLResultSet();
436  $xmlResultSet->addColumn("ref_id");
437  $xmlResultSet->addColumn("xml");
438  $xmlResultSet->addColumn("parent_ref_id");
439 
440  foreach ($ref_ids as $group_id) {
441  $group_obj = $this->checkObjectAccess($group_id, ['grp'], "write", true);
442  if ($group_obj instanceof ilObjGroup) {
443  $row = new ilXMLResultSetRow();
444  $row->setValue("ref_id", $group_id);
445  $xmlWriter = new ilGroupXMLWriter($group_obj);
446  $xmlWriter->setAttachUsers(false);
447  $xmlWriter->start();
448  $row->setValue("xml", $xmlWriter->getXML());
449  $row->setValue("parent_ref_id", $tree->getParentId($group_id));
450  $xmlResultSet->addRow($row);
451  }
452  }
453  $xmlResultSetWriter = new ilXMLResultSetWriter($xmlResultSet);
454  $xmlResultSetWriter->start();
455  return $xmlResultSetWriter->getXML();
456  }
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.
global $DIC
Definition: feed.php:28
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
$ref_id
Definition: ltiauth.php:67
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)
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.
+ Here is the call graph for this function:

◆ groupExists()

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

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

References $DIC, $type, 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().

124  {
125  $this->initAuth($sid);
126  $this->initIlias();
127 
128  if (!$this->checkSession($sid)) {
129  return $this->raiseError($this->getMessage(), $this->getMessageCode());
130  }
131 
132  if (!$title) {
133  return $this->raiseError(
134  'No title given. Please choose an title for the group in question.',
135  'Client'
136  );
137  }
138 
139  return ilUtil::groupNameExists($title);
140  }
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 35 of file class.ilSoapGroupAdministration.php.

Referenced by getGroupsForUser().

◆ MEMBER

const ilSoapGroupAdministration::MEMBER = 1

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

Referenced by getGroupsForUser().

◆ OWNER

const ilSoapGroupAdministration::OWNER = 4

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

Referenced by getGroupsForUser().


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