Public Member Functions

ilSoapGroupAdministration Class Reference

Inheritance diagram for ilSoapGroupAdministration:
Collaboration diagram for ilSoapGroupAdministration:

Public Member Functions

 ilSoapGroupAdministration ()
 addGroup ($sid, $target_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)

Detailed Description

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


Member Function Documentation

ilSoapGroupAdministration::addGroup ( sid,
target_id,
grp_xml 
)

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

References $rbacsystem, $target_id, ilSoapAdministration::__checkSession(), and ilSoapAdministration::__raiseError().

        {
                
                if(!$this->__checkSession($sid))
                {
                        return $this->__raiseError($this->sauth->getMessage(),$this->sauth->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 course',
                                                                           'Client');
                }

                // Include main header
                include_once './include/inc.header.php';
                global $rbacsystem;

                if(!$rbacsystem->checkAccess('create',$target_id,'grp'))
                {
                        return $this->__raiseError('Check access failed. No permission to create groups','Server');
                }

                // Start import
                include_once("classes/class.ilObjGroup.php");
                include_once 'classes/class.ilGroupImportParser.php';
                $xml_parser = new ilGroupImportParser($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 122 of file class.ilSoapGroupAdministration.php.

References $rbacsystem, $tmp_user, $type, $user_id, ilSoapAdministration::__checkSession(), ilSoapAdministration::__raiseError(), ilObject::_getAllReferences(), ilObject::_lookupObjId(), ilObject::_lookupType(), ilObjectFactory::getInstanceByObjId(), and ilObjectFactory::getInstanceByRefId().

        {
                if(!$this->__checkSession($sid))
                {
                        return $this->__raiseError($this->sauth->getMessage(),$this->sauth->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');
                }

                // Include main header
                include_once './include/inc.header.php';
                global $rbacsystem;
                
                if(($obj_type = ilObject::_lookupType(ilObject::_lookupObjId($group_id))) != 'grp')
                {
                        $group_id = end($ref_ids = ilObject::_getAllReferences($group_id));
                        if(ilObject::_lookupType(ilObject::_lookupObjId($group_id)) != 'grp')
                        {
                                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');
                }


                switch($type)
                {
                        case 'Admin':
                                return $tmp_group->addMember($user_id,$tmp_group->getDefaultAdminRole());

                        case 'Member':
                                return $tmp_group->addMember($user_id,$tmp_group->getDefaultMemberRole());
                                break;
                }

                return true;
        }

Here is the call graph for this function:

ilSoapGroupAdministration::excludeGroupMember ( sid,
group_id,
user_id 
)

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

References $rbacsystem, $type, $user_id, ilSoapAdministration::__checkSession(), ilSoapAdministration::__raiseError(), ilObject::_getAllReferences(), ilObject::_lookupObjId(), ilObject::_lookupType(), and ilObjectFactory::getInstanceByRefId().

        {
                if(!$this->__checkSession($sid))
                {
                        return $this->__raiseError($this->sauth->getMessage(),$this->sauth->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');
                }

                // Include main header
                include_once './include/inc.header.php';
                global $rbacsystem;

                if(($type = ilObject::_lookupType(ilObject::_lookupObjId($group_id))) != 'grp')
                {
                        $group_id = end($ref_ids = ilObject::_getAllReferences($group_id));
                        if(ilObject::_lookupType(ilObject::_lookupObjId($group_id)) != 'grp')
                        {
                                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 95 of file class.ilSoapGroupAdministration.php.

References $ref_id, ilSoapAdministration::__checkSession(), ilSoapAdministration::__raiseError(), and ilObjectFactory::getInstanceByRefId().

        {
                if(!$this->__checkSession($sid))
                {
                        return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
                }                       

                // Include main header
                include_once './include/inc.header.php';

                if(!$grp_obj =& ilObjectFactory::getInstanceByRefId($ref_id,false))
                {
                        return $this->__raiseError('No valid reference id given.',
                                                                           'Client');
                }

                include_once '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::groupExists ( sid,
title 
)

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

References $title, ilSoapAdministration::__checkSession(), ilSoapAdministration::__raiseError(), and ilUtil::groupNameExists().

        {
                if(!$this->__checkSession($sid))
                {
                        return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
                }                       

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

                // Include main header
                include_once './include/inc.header.php';

                return ilUtil::groupNameExists($title);
        }

Here is the call graph for this function:

ilSoapGroupAdministration::ilSoapGroupAdministration (  ) 

Definition at line 37 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 233 of file class.ilSoapGroupAdministration.php.

References $rbacsystem, $type, $user_id, ilSoapAdministration::__checkSession(), ilSoapAdministration::__raiseError(), ilObject::_getAllReferences(), ilObject::_lookupObjId(), ilObject::_lookupType(), and ilObjectFactory::getInstanceByRefId().

        {
                if(!$this->__checkSession($sid))
                {
                        return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
                }                       
                if(!is_numeric($group_id))
                {
                        return $this->__raiseError('No valid group id given. Please choose an existing id of an ILIAS group',
                                                                           'Client');
                }
                // Include main header
                include_once './include/inc.header.php';
                global $rbacsystem;

                if(($type = ilObject::_lookupType(ilObject::_lookupObjId($group_id))) != 'grp')
                {
                        $group_id = end($ref_ids = ilObject::_getAllReferences($group_id));
                        if(ilObject::_lookupType(ilObject::_lookupObjId($group_id)) != 'grp')
                        {
                                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');
                }


                if($tmp_group->isAdmin($user_id))
                {
                        return 1;
                }
                if($tmp_group->isMember($user_id))
                {
                        return 2;
                }
                return "0";
        }

Here is the call graph for this function:


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