当前位置: 首页>>代码示例>>PHP>>正文


PHP ilObjRole::setImportId方法代码示例

本文整理汇总了PHP中ilObjRole::setImportId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjRole::setImportId方法的具体用法?PHP ilObjRole::setImportId怎么用?PHP ilObjRole::setImportId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilObjRole的用法示例。


在下文中一共展示了ilObjRole::setImportId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createRole

 /**
  * creates a local role in current rolefolder (this object)
  * 
  * @access	public
  * @param	string	title
  * @param	string	description
  * @return	object	role object
  */
 function createRole($a_title, $a_desc, $a_import_id = 0)
 {
     global $rbacadmin, $rbacreview;
     include_once "./Services/AccessControl/classes/class.ilObjRole.php";
     $roleObj = new ilObjRole();
     $roleObj->setTitle($a_title);
     $roleObj->setDescription($a_desc);
     //echo "aaa-1-";
     if ($a_import_id != "") {
         //echo "aaa-2-".$a_import_id."-";
         $roleObj->setImportId($a_import_id);
     }
     $roleObj->create();
     // ...and put the role into local role folder...
     $rbacadmin->assignRoleToFolder($roleObj->getId(), $this->getRefId(), "y");
     return $roleObj;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:25,代码来源:class.ilObjRoleFolder.php

示例2: copyLocalRoles

 /**
  * Copy local roles
  * This method creates a copy of all local role.
  * Note: auto generated roles are excluded
  *
  * @access public
  * @param int source id of object (not role folder)
  * @param int target id of object
  * 
  */
 public function copyLocalRoles($a_source_id, $a_target_id)
 {
     global $rbacreview, $ilLog, $ilObjDataCache;
     $real_local = array();
     foreach ($rbacreview->getRolesOfRoleFolder($a_source_id, false) as $role_data) {
         $title = $ilObjDataCache->lookupTitle($role_data);
         if (substr($title, 0, 3) == 'il_') {
             continue;
         }
         $real_local[] = $role_data;
     }
     if (!count($real_local)) {
         return true;
     }
     // Create role folder
     foreach ($real_local as $role) {
         include_once "./Services/AccessControl/classes/class.ilObjRole.php";
         $orig = new ilObjRole($role);
         $orig->read();
         $ilLog->write(__METHOD__ . ': Start copying of role ' . $orig->getTitle());
         $roleObj = new ilObjRole();
         $roleObj->setTitle($orig->getTitle());
         $roleObj->setDescription($orig->getDescription());
         $roleObj->setImportId($orig->getImportId());
         $roleObj->create();
         $this->assignRoleToFolder($roleObj->getId(), $a_target_id, "y");
         $this->copyRolePermissions($role, $a_source_id, $a_target_id, $roleObj->getId(), true);
         $ilLog->write(__METHOD__ . ': Added new local role, id ' . $roleObj->getId());
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:40,代码来源:class.ilRbacAdmin.php

示例3: addRoleFromTemplate

 function addRoleFromTemplate($sid, $target_id, $role_xml, $template_id)
 {
     $this->initAuth($sid);
     $this->initIlias();
     if (!$this->__checkSession($sid)) {
         return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
     }
     global $rbacreview, $objDefinition, $rbacsystem, $rbacadmin, $ilAccess;
     if (!($tmp_obj =& ilObjectFactory::getInstanceByRefId($target_id, false))) {
         return $this->__raiseError('No valid ref id given. Please choose an existing reference id of an ILIAS object', 'Client');
     }
     if (ilObject::_lookupType($template_id) != 'rolt') {
         return $this->__raiseError('No valid template id given. Please choose an existing object id of an ILIAS role template', 'Client');
     }
     if (ilObject::_isInTrash($target_id)) {
         return $this->__raiseError("Parent with ID {$target_id} has been deleted.", 'CLIENT_TARGET_DELETED');
     }
     if (!$ilAccess->checkAccess('edit_permission', '', $target_id)) {
         return $this->__raiseError('Check access failed. No permission to create roles', 'Server');
     }
     include_once 'webservice/soap/classes/class.ilObjectXMLParser.php';
     $xml_parser =& new ilObjectXMLParser($role_xml);
     $xml_parser->startParsing();
     foreach ($xml_parser->getObjectData() as $object_data) {
         // check if role title has il_ prefix
         if (substr($object_data['title'], 0, 3) == "il_") {
             return $this->__raiseError('Rolenames are not allowed to start with "il_" ', 'Client');
         }
         include_once './Services/AccessControl/classes/class.ilObjRole.php';
         $role = new ilObjRole();
         $role->setTitle($object_data['title']);
         $role->setDescription($object_data['description']);
         $role->setImportId($object_data['import_id']);
         $role->create();
         $GLOBALS['rbacadmin']->assignRoleToFolder($role->getId(), $target_id);
         // Copy permssions
         $rbacadmin->copyRoleTemplatePermissions($template_id, ROLE_FOLDER_ID, $target_id, $role->getId());
         // Set object permissions according to role template
         $ops = $rbacreview->getOperationsOfRole($role->getId(), $tmp_obj->getType(), $target_id);
         $rbacadmin->grantPermission($role->getId(), $ops, $target_id);
         $new_roles[] = $role->getId();
     }
     // CREATE ADMIN ROLE
     return $new_roles ? $new_roles : array();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:45,代码来源:class.ilSoapRBACAdministration.php


注:本文中的ilObjRole::setImportId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。