33 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
49 if (!$this->__checkSession($sid)) {
55 'No valid target id given. Please choose an existing reference id of an ILIAS category or group',
62 $rbacsystem = $DIC[
'rbacsystem'];
64 if (!$rbacsystem->checkAccess(
'create',
$target_id,
'grp')) {
65 return $this->
__raiseError(
'Check access failed. No permission to create groups',
'Server');
69 return $this->
__raiseError(
"Parent with ID $target_id has been deleted.",
'CLIENT_TARGET_DELETED');
74 $newObj->setTitle(
'dummy');
75 $newObj->setDescription(
"");
76 $newObj->create(
true);
79 include_once(
"./Modules/Group/classes/class.ilObjGroup.php");
80 include_once
'Modules/Group/classes/class.ilGroupXMLParser.php';
82 $new_ref_id = $xml_parser->startParsing();
84 return $new_ref_id ? $new_ref_id :
"0";
94 if (!$this->__checkSession($sid)) {
100 if (!is_numeric($ref_id)) {
102 'No valid target id given. Please choose an existing reference id of an ILIAS category or group',
109 $rbacsystem = $DIC[
'rbacsystem'];
111 if (!$rbacsystem->checkAccess(
'write', $ref_id,
'grp')) {
112 return $this->
__raiseError(
'Check access failed. No permission to edit groups',
'Server');
116 include_once(
"./Modules/Group/classes/class.ilObjGroup.php");
119 return $this->
__raiseError(
'Cannot create group instance!',
'CLIENT_OBJECT_NOT_FOUND');
123 return $this->
__raiseError(
"Object with ID $ref_id has been deleted.",
'CLIENT_OBJECT_DELETED');
128 return $this->
__raiseError(
'Reference id does not point to a group!',
'CLIENT_WRONG_TYPE');
132 include_once
'Modules/Group/classes/class.ilGroupXMLParser.php';
135 $new_ref_id = $xml_parser->startParsing();
137 return $new_ref_id ? $new_ref_id :
"0";
146 if (!$this->__checkSession($sid)) {
152 'No title given. Please choose an title for the group in question.',
165 if (!$this->__checkSession($sid)) {
170 return $this->
__raiseError(
"Parent with ID $ref_id has been deleted.",
'CLIENT_OBJECT_DELETED');
176 'No valid reference id given.',
182 include_once
'Modules/Group/classes/class.ilGroupXMLWriter.php';
185 $xml_writer->start();
187 $xml = $xml_writer->getXML();
198 if (!$this->__checkSession($sid)) {
202 if (!is_numeric($group_id)) {
204 'No valid group id given. Please choose an existing reference id of an ILIAS group',
211 $rbacsystem = $DIC[
'rbacsystem'];
216 return $this->
__raiseError(
'Invalid group id. Object with id "' . $group_id .
'" is not of type "group"',
'Client');
220 if (!$rbacsystem->checkAccess(
'manage_members', $group_id)) {
221 return $this->
__raiseError(
'Check access failed. No permission to write to group',
'Server');
226 return $this->
__raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
230 return $this->
__raiseError(
'Invalid type ' .
$type .
' given. Parameter "type" must be "Admin","Member"',
'Client');
234 return $this->
__raiseError(
'Cannot create group instance!',
'Server');
238 return $this->
__raiseError(
'Cannot create user instance!',
'Server');
242 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
262 if (!$this->__checkSession($sid)) {
265 if (!is_numeric($group_id)) {
267 'No valid group id given. Please choose an existing reference id of an ILIAS group',
274 $rbacsystem = $DIC[
'rbacsystem'];
279 return $this->
__raiseError(
'Invalid group id. Object with id "' . $group_id .
'" is not of type "group"',
'Client');
284 return $this->
__raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
288 return $this->
__raiseError(
'Cannot create group instance!',
'Server');
291 if (!$rbacsystem->checkAccess(
'manage_members', $group_id)) {
292 return $this->
__raiseError(
'Check access failed. No permission to write to group',
'Server');
295 $tmp_group->leave($user_id);
305 if (!$this->__checkSession($sid)) {
308 if (!is_numeric($group_id)) {
310 'No valid group id given. Please choose an existing id of an ILIAS group',
316 $rbacsystem = $DIC[
'rbacsystem'];
321 return $this->
__raiseError(
'Invalid group id. Object with id "' . $group_id .
'" is not of type "group"',
'Client');
326 return $this->
__raiseError(
'Invalid user id. User with id "' . $user_id .
' does not exist',
'Client');
330 return $this->
__raiseError(
'Cannot create group instance!',
'Server');
333 if (!$rbacsystem->checkAccess(
'read', $group_id)) {
334 return $this->
__raiseError(
'Check access failed. No permission to read group data',
'Server');
337 include_once(
'./Modules/Group/classes/class.ilGroupParticipants.php');
340 if ($participants->isAdmin($user_id)) {
343 if ($participants->isMember($user_id)) {
363 if (!$this->__checkSession($sid)) {
368 $rbacreview = $DIC[
'rbacreview'];
369 $ilObjDataCache = $DIC[
'ilObjDataCache'];
370 $tree = $DIC[
'tree'];
372 include_once
'webservice/soap/classes/class.ilXMLResultSetParser.php';
377 return $this->
__raiseError($exception->getMessage(),
"Client");
379 $xmlResultSet =
$parser->getXMLResultSet();
381 if (!$xmlResultSet->hasColumn(
"user_id")) {
382 return $this->
__raiseError(
"parameter user_id is missing",
"Client");
385 if (!$xmlResultSet->hasColumn(
"status")) {
386 return $this->
__raiseError(
"parameter status is missing",
"Client");
389 $user_id = (int) $xmlResultSet->getValue(0,
"user_id");
390 $status = (int) $xmlResultSet->getValue(0,
"status");
395 #var_dump($xmlResultSet); 396 #echo "uid:".$user_id; 397 #echo "status:".$status; 400 foreach ($rbacreview->assignedRoles($user_id) as $role_id) {
402 #echo $role->getType(); 403 if ($role->getType() !=
"role") {
407 if ($role->getParent() == ROLE_FOLDER_ID) {
410 $role_title = $role->getTitle();
418 if (ilSoapGroupAdministration::MEMBER == ($status & ilSoapGroupAdministration::MEMBER) && strpos($role_title,
"member") !==
false) {
419 $ref_ids [] = $ref_id;
420 } elseif (ilSoapGroupAdministration::ADMIN == ($status & ilSoapGroupAdministration::ADMIN) && strpos($role_title,
"admin") !==
false) {
421 $ref_ids [] = $ref_id;
430 foreach ($owned_objects as $obj_id) {
433 foreach ($allrefs as
$r) {
434 if (
$tree->isDeleted($r)) {
437 if (
$tree->isInTree($r)) {
441 if (count($refs) > 0) {
442 $ref_ids[] = array_pop($refs);
446 $ref_ids = array_unique($ref_ids);
450 include_once
'webservice/soap/classes/class.ilXMLResultSetWriter.php';
451 include_once
'Modules/Group/classes/class.ilObjGroup.php';
452 include_once
'Modules/Group/classes/class.ilGroupXMLWriter.php';
455 $xmlResultSet->addColumn(
"ref_id");
456 $xmlResultSet->addColumn(
"xml");
457 $xmlResultSet->addColumn(
"parent_ref_id");
459 foreach ($ref_ids as $group_id) {
463 $row->setValue(
"ref_id", $group_id);
465 $xmlWriter->setAttachUsers(
false);
467 $row->setValue(
"xml", $xmlWriter->getXML());
468 $row->setValue(
"parent_ref_id",
$tree->getParentId($group_id));
469 $xmlResultSet->addRow(
$row);
473 $xmlResultSetWriter->start();
474 return $xmlResultSetWriter->getXML();
excludeGroupMember($sid, $group_id, $user_id)
getGroupsForUser($sid, $parameters)
get groups which belong to a specific user, fullilling the status
XML Writer for XMLResultSet.
checkObjectAccess($ref_id, $expected_type, $permission, $returnObject=false)
check access for ref id: expected type, permission, return object instance if returnobject is true ...
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
assignGroupMember($sid, $group_id, $user_id, $type)
static groupNameExists($a_group_name, $a_id=0)
checks if group name already exists.
static _isInTrash($a_ref_id)
checks wether object is in trash
SaxParserException thrown by ilSaxParser if property throwException is set.
static _getAllReferences($a_id)
get all reference ids of object
getObjectsForOwner($object_type, $owner_id)
returns all objects of an owner, filtered by type, objects are not deleted!
updateGroup($sid, $ref_id, $grp_xml)
static __extractRefId($role_title)
extract ref id from role title, e.g.
isAssignedToGroup($sid, $group_id, $user_id)
static _lookupObjId($a_id)
__raiseError($a_message, $a_code)
groupExists($sid, $title)
static getTypeByRefId($a_ref_id, $stop_on_error=true)
get object type by reference id
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _lookupType($a_id, $a_reference=false)
lookup object type
initAuth($sid)
Init authentication.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
addGroup($sid, $target_id, $grp_xml)