24 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
52 $rbacsystem = $DIC[
'rbacsystem'];
54 if (!$rbacsystem->checkAccess(
'create', $target_id,
'grp')) {
55 return $this->
raiseError(
'Check access failed. No permission to create groups',
'Server');
59 return $this->
raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
63 $newObj->setTitle(
'dummy');
64 $newObj->setDescription(
"");
67 include_once(
"./Modules/Group/classes/class.ilObjGroup.php");
68 include_once
'Modules/Group/classes/class.ilGroupXMLParser.php';
70 $xml_parser->startParsing();
71 $new_ref_id = $xml_parser->getObjectRefId();
73 return $new_ref_id ?:
"0";
79 public function updateGroup(
string $sid,
int $ref_id,
string $grp_xml)
90 $rbacsystem = $DIC[
'rbacsystem'];
92 if (!$rbacsystem->checkAccess(
'write', $ref_id,
'grp')) {
93 return $this->
raiseError(
'Check access failed. No permission to edit groups',
'Server');
96 include_once(
"./Modules/Group/classes/class.ilObjGroup.php");
100 return $this->
raiseError(
'Cannot create group instance!',
'CLIENT_OBJECT_NOT_FOUND');
104 return $this->
raiseError(
"Object with ID $ref_id has been deleted.",
'CLIENT_OBJECT_DELETED');
108 return $this->
raiseError(
'Reference id does not point to a group!',
'CLIENT_WRONG_TYPE');
111 include_once
'Modules/Group/classes/class.ilGroupXMLParser.php';
114 $xml_parser->startParsing();
115 $new_ref_id = $xml_parser->getObjectRefId();
117 return $new_ref_id ?:
"0";
134 'No title given. Please choose an title for the group in question.',
145 public function getGroup(
string $sid,
int $ref_id)
155 return $this->
raiseError(
"Parent with ID $ref_id has been deleted.",
'CLIENT_OBJECT_DELETED');
161 'No valid reference id given.',
166 include_once
'Modules/Group/classes/class.ilGroupXMLWriter.php';
168 $xml_writer->start();
170 return $xml_writer->getXML();
176 public function assignGroupMember(
string $sid,
int $group_id,
int $user_id,
string $type)
187 $rbacsystem = $DIC[
'rbacsystem'];
191 $group_id = end($ref_ids);
194 'Invalid group id. Object with id "' . $group_id .
'" is not of type "group"',
200 if (!$rbacsystem->checkAccess(
'manage_members', $group_id)) {
201 return $this->
raiseError(
'Check access failed. No permission to write to group',
'Server');
205 return $this->
raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
207 if ($type !==
'Admin' &&
208 $type !==
'Member') {
210 'Invalid type ' . $type .
' given. Parameter "type" must be "Admin","Member"',
217 return $this->
raiseError(
'Cannot create group instance!',
'Server');
222 return $this->
raiseError(
'Cannot create user instance!',
'Server');
225 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
243 public function excludeGroupMember(
string $sid,
int $group_id,
int $user_id)
254 $rbacsystem = $DIC[
'rbacsystem'];
258 $group_id = end($ref_ids);
261 'Invalid group id. Object with id "' . $group_id .
'" is not of type "group"',
268 return $this->
raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
273 return $this->
raiseError(
'Cannot create group instance!',
'Server');
276 if (!$rbacsystem->checkAccess(
'manage_members', $group_id)) {
277 return $this->
raiseError(
'Check access failed. No permission to write to group',
'Server');
280 $tmp_group->leave($user_id);
287 public function isAssignedToGroup(
string $sid,
int $group_id,
int $user_id)
298 $rbacsystem = $DIC[
'rbacsystem'];
302 $group_id = end($ref_ids);
305 'Invalid group id. Object with id "' . $group_id .
'" is not of type "group"',
312 return $this->
raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
317 return $this->
raiseError(
'Cannot create group instance!',
'Server');
320 if (!$rbacsystem->checkAccess(
'read', $group_id)) {
321 return $this->
raiseError(
'Check access failed. No permission to read group data',
'Server');
324 include_once(
'./Modules/Group/classes/class.ilGroupParticipants.php');
327 if ($participants->isAdmin($user_id)) {
330 if ($participants->isMember($user_id)) {
349 $rbacreview = $DIC[
'rbacreview'];
350 $ilObjDataCache = $DIC[
'ilObjDataCache'];
351 $tree = $DIC[
'tree'];
353 include_once
'webservice/soap/classes/class.ilXMLResultSetParser.php';
356 $parser->startParsing();
358 return $this->
raiseError($exception->getMessage(),
"Client");
360 $xmlResultSet = $parser->getXMLResultSet();
362 if (!$xmlResultSet->hasColumn(
"user_id")) {
363 return $this->
raiseError(
"parameter user_id is missing",
"Client");
366 if (!$xmlResultSet->hasColumn(
"status")) {
367 return $this->
raiseError(
"parameter status is missing",
"Client");
370 $user_id = (
int) $xmlResultSet->getValue(0,
"user_id");
371 $status = (
int) $xmlResultSet->getValue(0,
"status");
377 foreach ($rbacreview->assignedRoles($user_id) as $role_id) {
379 #echo $role->getType(); 380 if ($role->getType() !==
"role") {
387 $role_title = $role->getTitle();
395 if (ilSoapGroupAdministration::MEMBER == ($status & ilSoapGroupAdministration::MEMBER) && strpos(
400 } elseif (ilSoapGroupAdministration::ADMIN == ($status & ilSoapGroupAdministration::ADMIN) && strpos(
413 foreach ($owned_objects as $obj_id) {
416 foreach ($allrefs as $r) {
417 if ($tree->isDeleted($r)) {
420 if ($tree->isInTree($r)) {
424 if (count($refs) > 0) {
425 $ref_ids[] = array_pop($refs);
429 $ref_ids = array_unique($ref_ids);
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';
436 $xmlResultSet->addColumn(
"ref_id");
437 $xmlResultSet->addColumn(
"xml");
438 $xmlResultSet->addColumn(
"parent_ref_id");
440 foreach ($ref_ids as $group_id) {
444 $row->setValue(
"ref_id", $group_id);
446 $xmlWriter->setAttachUsers(
false);
448 $row->setValue(
"xml", $xmlWriter->getXML());
449 $row->setValue(
"parent_ref_id", $tree->getParentId($group_id));
450 $xmlResultSet->addRow($row);
454 $xmlResultSetWriter->start();
455 return $xmlResultSetWriter->getXML();
XML Writer for XMLResultSet.
addGroup(string $sid, int $target_id, string $grp_xml)
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 getTypeByRefId(int $ref_id, bool $stop_on_error=true)
get object type by reference id
static _lookupObjId(int $ref_id)
getGroupsForUser(string $sid, string $parameters)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static getObjectsForOwner(string $object_type, int $owner_id)
returns all objects of an owner, filtered by type, objects are not deleted!
groupExists(string $sid, string $title)
checkSession(string $sid)
static _isInTrash(int $ref_id)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference 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 ...
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static groupNameExists(string $a_group_name, ?int $a_id=null)
checks if group name already exists.
static _lookupType(int $id, bool $reference=false)
static __extractRefId(string $role_title)
extract ref id from role title, e.g.