Esempio n. 1
0
 /**
  * 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());
     }
 }
 /**
  * Read role properties and write them to form
  * @return 
  * @param object $role
  */
 protected function readRoleProperties(ilObjRole $role)
 {
     global $rbacreview;
     include_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
     $data['title'] = $role->getTitle();
     $data['desc'] = $role->getDescription();
     $data['reg'] = $role->getAllowRegister();
     $data['la'] = $role->getAssignUsersStatus();
     if (ilDiskQuotaActivationChecker::_isActive()) {
         $data['disk_quota'] = $role->getDiskQuota() / pow(ilFormat::_getSizeMagnitude(), 2);
     }
     if (ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive()) {
         $data['wsp_disk_quota'] = $role->getPersonalWorkspaceDiskQuota() / pow(ilFormat::_getSizeMagnitude(), 2);
     }
     $data['pro'] = $rbacreview->isProtected($this->rolf_ref_id, $role->getId());
     $this->form->setValuesByArray($data);
 }