ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSoapGroupAdministration Class Reference
+ Inheritance diagram for ilSoapGroupAdministration:
+ Collaboration diagram for ilSoapGroupAdministration:

Public Member Functions

 ilSoapGroupAdministration ()
 addGroup ($sid, $target_id, $grp_xml)
 updateGroup ($sid, $ref_id, $grp_xml)
 groupExists ($sid, $title)
 getGroup ($sid, $ref_id)
 assignGroupMember ($sid, $group_id, $user_id, $type)
 excludeGroupMember ($sid, $group_id, $user_id)
 isAssignedToGroup ($sid, $group_id, $user_id)
 getGroupsForUser ($sid, $parameters)
 get groups which belong to a specific user, fullilling the status
- Public Member Functions inherited from ilSoapAdministration
 ilSoapAdministration ($use_nusoap=true)
 __checkSession ($sid)
 initErrorWriter ()
 Overwrite error handler.
 __explodeSid ($sid)
 __setMessage ($a_str)
 __getMessage ()
 __appendMessage ($a_str)
 __setMessageCode ($a_code)
 __getMessageCode ()
 initAuth ($sid)
 initIlias ()
 __initAuthenticationObject ($a_auth_mode=AUTH_LOCAL)
 __raiseError ($a_message, $a_code)
 getNIC ($sid)
 get client information from current as xml result set
 isFault ($object)
 checkObjectAccess ($ref_id, $expected_type, $permission, $returnObject=false)
 check access for ref id: expected type, permission, return object instance if returnobject is true
 getInstallationInfoXML ()
 getClientInfoXML ($clientid)

Data Fields

const MEMBER = 1
const ADMIN = 2
const OWNER = 4
- Data Fields inherited from ilSoapAdministration
 $sauth = null
 $error_method = null

Additional Inherited Members

- Static Public Member Functions inherited from ilSoapAdministration
static return_bytes ($val)
 calculate bytes from K,M,G modifiers e.g: 8M = 8 * 1024 * 1024 bytes
- Protected Attributes inherited from ilSoapAdministration
 $soap_check = true

Detailed Description

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

Member Function Documentation

ilSoapGroupAdministration::addGroup (   $sid,
  $target_id,
  $grp_xml 
)

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

References $target_id, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_isInTrash(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!is_numeric($target_id))
{
return $this->__raiseError('No valid target id given. Please choose an existing reference id of an ILIAS category or group',
'Client');
}
global $rbacsystem;
if(!$rbacsystem->checkAccess('create',$target_id,'grp'))
{
return $this->__raiseError('Check access failed. No permission to create groups','Server');
}
{
return $this->__raiseError("Parent with ID $target_id has been deleted.", 'CLIENT_TARGET_DELETED');
}
// Start import
include_once("./Modules/Group/classes/class.ilObjGroup.php");
include_once 'Modules/Group/classes/class.ilGroupXMLParser.php';
$xml_parser = new ilGroupXMLParser($grp_xml,$target_id);
$new_ref_id = $xml_parser->startParsing();
return $new_ref_id ? $new_ref_id : "0";
}

+ Here is the call graph for this function:

ilSoapGroupAdministration::assignGroupMember (   $sid,
  $group_id,
  $user_id,
  $type 
)

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

References ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilGroupParticipants\_getInstanceByObjId(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilObjectFactory\getInstanceByObjId(), ilObjectFactory\getInstanceByRefId(), IL_GRP_ADMIN, IL_GRP_MEMBER, ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!is_numeric($group_id))
{
return $this->__raiseError('No valid group id given. Please choose an existing reference id of an ILIAS group',
'Client');
}
global $rbacsystem;
if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($group_id))) != 'grp')
{
$group_id = end($ref_ids = ilObject::_getAllReferences($group_id));
{
return $this->__raiseError('Invalid group id. Object with id "'. $group_id.'" is not of type "group"','Client');
}
}
if(!$rbacsystem->checkAccess('write',$group_id))
{
return $this->__raiseError('Check access failed. No permission to write to group','Server');
}
if(ilObject::_lookupType($user_id) != 'usr')
{
return $this->__raiseError('Invalid user id. User with id "'. $user_id.' does not exist','Client');
}
if($type != 'Admin' and
$type != 'Member')
{
return $this->__raiseError('Invalid type '.$type.' given. Parameter "type" must be "Admin","Member"','Client');
}
if(!$tmp_group = ilObjectFactory::getInstanceByRefId($group_id,false))
{
return $this->__raiseError('Cannot create group instance!','Server');
}
if(!$tmp_user = ilObjectFactory::getInstanceByObjId($user_id,false))
{
return $this->__raiseError('Cannot create user instance!','Server');
}
include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
$group_members = ilGroupParticipants::_getInstanceByObjId($tmp_group->getId());
switch($type)
{
case 'Admin':
$group_members->add($tmp_user->getId(),IL_GRP_ADMIN);
break;
case 'Member':
$group_members->add($tmp_user->getId(),IL_GRP_MEMBER);
break;
}
return true;
}

+ Here is the call graph for this function:

ilSoapGroupAdministration::excludeGroupMember (   $sid,
  $group_id,
  $user_id 
)

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

References ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!is_numeric($group_id))
{
return $this->__raiseError('No valid group id given. Please choose an existing reference id of an ILIAS group',
'Client');
}
global $rbacsystem;
if(($type = ilObject::_lookupType(ilObject::_lookupObjId($group_id))) != 'grp')
{
$group_id = end($ref_ids = ilObject::_getAllReferences($group_id));
{
return $this->__raiseError('Invalid group id. Object with id "'. $group_id.'" is not of type "group"','Client');
}
}
if(ilObject::_lookupType($user_id) != 'usr')
{
return $this->__raiseError('Invalid user id. User with id "'. $user_id.' does not exist','Client');
}
if(!$tmp_group = ilObjectFactory::getInstanceByRefId($group_id,false))
{
return $this->__raiseError('Cannot create group instance!','Server');
}
if(!$rbacsystem->checkAccess('write',$group_id))
{
return $this->__raiseError('Check access failed. No permission to write to group','Server');
}
$tmp_group->leave($user_id);
return true;
}

+ Here is the call graph for this function:

ilSoapGroupAdministration::getGroup (   $sid,
  $ref_id 
)

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

References $ref_id, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_isInTrash(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
{
return $this->__raiseError("Parent with ID $ref_id has been deleted.", 'CLIENT_OBJECT_DELETED');
}
{
return $this->__raiseError('No valid reference id given.',
'Client');
}
include_once 'Modules/Group/classes/class.ilGroupXMLWriter.php';
$xml_writer = new ilGroupXMLWriter($grp_obj);
$xml_writer->start();
$xml = $xml_writer->getXML();
return strlen($xml) ? $xml : '';
}

+ Here is the call graph for this function:

ilSoapGroupAdministration::getGroupsForUser (   $sid,
  $parameters 
)

get groups which belong to a specific user, fullilling the status

Parameters
string$sid
string$parametersfollowing xmlresultset, columns (user_id, status with values 1 = "MEMBER", 2 = "TUTOR", 4 = "ADMIN", 8 = "OWNER" and any xor operation e.g. 1 + 4 = 5 = ADMIN and TUTOR, 7 = ADMIN and TUTOR and MEMBER)
stringXMLResultSet, columns (ref_id, xml, parent_ref_id)

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

References $ref_id, $row, ilSoapAdministration\__checkSession(), ilUtil\__extractRefId(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_exists(), ilObject\_getAllReferences(), ilObject\_isInTrash(), ADMIN, ilSoapAdministration\checkObjectAccess(), ilObjectFactory\getInstanceByObjId(), ilObjectFactory\getObjectsForOwner(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), MEMBER, and OWNER.

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
global $rbacreview, $ilObjDataCache, $tree;
include_once 'webservice/soap/classes/class.ilXMLResultSetParser.php';
$parser = new ilXMLResultSetParser($parameters);
try {
$parser->startParsing();
} catch (ilSaxParserException $exception) {
return $this->__raiseError($exception->getMessage(), "Client");
}
$xmlResultSet = $parser->getXMLResultSet();
if (!$xmlResultSet->hasColumn ("user_id"))
return $this->__raiseError("parameter user_id is missing", "Client");
if (!$xmlResultSet->hasColumn ("status"))
return $this->__raiseError("parameter status is missing", "Client");
$user_id = (int) $xmlResultSet->getValue (0, "user_id");
$status = (int) $xmlResultSet->getValue (0, "status");
$ref_ids = array();
// get roles
#var_dump($xmlResultSet);
#echo "uid:".$user_id;
#echo "status:".$status;
foreach($rbacreview->assignedRoles($user_id) as $role_id)
{
if($role = ilObjectFactory::getInstanceByObjId($role_id,false))
{
#echo $role->getType();
if ($role->getType() != "role")
continue;
if ($role->getParent() == ROLE_FOLDER_ID)
{
continue;
}
$role_title = $role->getTitle();
if ($ref_id = ilUtil::__extractRefId($role_title))
{
continue;
#echo $role_title;
if (ilSoapGroupAdministration::MEMBER == ($status & ilSoapGroupAdministration::MEMBER) && strpos($role_title, "member") !== false)
{
$ref_ids [] = $ref_id;
} elseif (ilSoapGroupAdministration::ADMIN == ($status & ilSoapGroupAdministration::ADMIN) && strpos($role_title, "admin") !== false)
{
$ref_ids [] = $ref_id;
}
}
}
}
if (($status & ilSoapGroupAdministration::OWNER) == ilSoapGroupAdministration::OWNER)
{
$owned_objects = ilObjectFactory::getObjectsForOwner("grp", $user_id);
foreach ($owned_objects as $obj_id) {
$allrefs = ilObject::_getAllReferences($obj_id);
$refs = array();
foreach($allrefs as $r)
{
if($tree->isDeleted($r))
{
continue;
}
if ($tree->isInTree($r))
{
$refs[] = $r;
}
}
if (count($refs) > 0)
$ref_ids[] = array_pop($refs);
}
}
$ref_ids = array_unique($ref_ids);
#print_r($ref_ids);
include_once 'webservice/soap/classes/class.ilXMLResultSetWriter.php';
include_once 'Modules/Group/classes/class.ilObjGroup.php';
include_once 'Modules/Group/classes/class.ilGroupXMLWriter.php';
$xmlResultSet = new ilXMLResultSet();
$xmlResultSet->addColumn("ref_id");
$xmlResultSet->addColumn("xml");
$xmlResultSet->addColumn("parent_ref_id");
foreach ($ref_ids as $group_id) {
$group_obj = $this->checkObjectAccess($group_id,"grp","write", true);
if ($group_obj instanceof ilObjGroup) {
$row->setValue("ref_id", $group_id);
$xmlWriter = new ilGroupXMLWriter($group_obj);
$xmlWriter->setAttachUsers(false);
$xmlWriter->start();
$row->setValue("xml", $xmlWriter->getXML());
$row->setValue("parent_ref_id", $tree->getParentId($group_id));
$xmlResultSet->addRow($row);
}
}
$xmlResultSetWriter = new ilXMLResultSetWriter($xmlResultSet);
$xmlResultSetWriter->start();
return $xmlResultSetWriter->getXML();
}

+ Here is the call graph for this function:

ilSoapGroupAdministration::groupExists (   $sid,
  $title 
)

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

References $title, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilUtil\groupNameExists(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!$title)
{
return $this->__raiseError('No title given. Please choose an title for the group in question.',
'Client');
}
}

+ Here is the call graph for this function:

ilSoapGroupAdministration::ilSoapGroupAdministration ( )

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

References ilSoapAdministration\ilSoapAdministration().

+ Here is the call graph for this function:

ilSoapGroupAdministration::isAssignedToGroup (   $sid,
  $group_id,
  $user_id 
)

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

References ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_getAllReferences(), ilGroupParticipants\_getInstanceByObjId(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!is_numeric($group_id))
{
return $this->__raiseError('No valid group id given. Please choose an existing id of an ILIAS group',
'Client');
}
global $rbacsystem;
if(($type = ilObject::_lookupType(ilObject::_lookupObjId($group_id))) != 'grp')
{
$group_id = end($ref_ids = ilObject::_getAllReferences($group_id));
{
return $this->__raiseError('Invalid group id. Object with id "'. $group_id.'" is not of type "group"','Client');
}
}
if(ilObject::_lookupType($user_id) != 'usr')
{
return $this->__raiseError('Invalid user id. User with id "'. $user_id.' does not exist','Client');
}
if(!$tmp_group = ilObjectFactory::getInstanceByRefId($group_id,false))
{
return $this->__raiseError('Cannot create group instance!','Server');
}
if(!$rbacsystem->checkAccess('read',$group_id))
{
return $this->__raiseError('Check access failed. No permission to read group data','Server');
}
include_once('./Modules/Group/classes/class.ilGroupParticipants.php');
if($participants->isAdmin($user_id))
{
return 1;
}
if($participants->isMember($user_id))
{
return 2;
}
return 0;
}

+ Here is the call graph for this function:

ilSoapGroupAdministration::updateGroup (   $sid,
  $ref_id,
  $grp_xml 
)

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

References $ref_id, ilGroupXMLParser\$UPDATE, ilSoapAdministration\__checkSession(), ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_isInTrash(), ilObjectFactory\getInstanceByRefId(), ilObjectFactory\getTypeByRefId(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
if(!is_numeric($ref_id))
{
return $this->__raiseError('No valid target id given. Please choose an existing reference id of an ILIAS category or group',
'Client');
}
global $rbacsystem;
if(!$rbacsystem->checkAccess('write',$ref_id,'grp'))
{
return $this->__raiseError('Check access failed. No permission to edit groups','Server');
}
// Start import
include_once("./Modules/Group/classes/class.ilObjGroup.php");
{
return $this->__raiseError('Cannot create group instance!','CLIENT_OBJECT_NOT_FOUND');
}
{
return $this->__raiseError("Object with ID $ref_id has been deleted.", 'CLIENT_OBJECT_DELETED');
}
{
return $this->__raiseError('Reference id does not point to a group!','CLIENT_WRONG_TYPE');
}
include_once 'Modules/Group/classes/class.ilGroupXMLParser.php';
$xml_parser = new ilGroupXMLParser($grp_xml, -1);
$xml_parser->setMode(ilGroupXMLParser::$UPDATE);
$xml_parser->setGroup($grp);
$new_ref_id = $xml_parser->startParsing();
return $new_ref_id ? $new_ref_id : "0";
}

+ Here is the call graph for this function:

Field Documentation

const ilSoapGroupAdministration::ADMIN = 2

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

Referenced by getGroupsForUser().

const ilSoapGroupAdministration::MEMBER = 1

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

Referenced by getGroupsForUser().

const ilSoapGroupAdministration::OWNER = 4

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

Referenced by getGroupsForUser().


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