示例#1
0
$roleObj->setTitle('il_xvit_admin');
$roleObj->setDescription('Administrator template for vitero groups');
$roleObj->create();
$GLOBALS['rbacadmin']->assignRoleToFolder($roleObj->getId(), ROLE_FOLDER_ID, 'n');
$GLOBALS['rbacadmin']->setRolePermission($roleObj->getId(), 'xvit', array_keys($ops), ROLE_FOLDER_ID);
?>
<#6>
<?php 
$query = 'SELECT ops_id FROM rbac_operations ' . 'WHERE ' . $ilDB->in('operation', array('visible', 'read'), false, 'text');
$res = $ilDB->query($query);
$ops = array();
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
    $ops[$row->ops_id] = $operation;
}
include_once "./Services/AccessControl/classes/class.ilObjRoleTemplate.php";
$roleObj = new ilObjRoleTemplate();
$roleObj->setTitle('il_xvit_member');
$roleObj->setDescription('Member template for vitero groups');
$roleObj->create();
$GLOBALS['rbacadmin']->assignRoleToFolder($roleObj->getId(), ROLE_FOLDER_ID, 'n');
$GLOBALS['rbacadmin']->setRolePermission($roleObj->getId(), 'xvit', array_keys($ops), ROLE_FOLDER_ID);
?>

<#7>
<?php 
$ilDB->createTable('rep_robj_xvit_excl', array('excl_id' => array('type' => 'integer', 'length' => 4, 'notnull' => TRUE), 'book_id' => array('type' => 'integer', 'length' => 4, 'notnull' => TRUE), 'excl_date' => array('type' => 'date', 'notnull' => FALSE)));
$ilDB->addPrimaryKey('rep_robj_xvit_excl', array('excl_id'));
$ilDB->addIndex('rep_robj_xvit_excl', array('book_id'), 'i1');
$ilDB->createSequence('rep_robj_xvit_excl');
?>
<#8>
 /**
  * save a new role template object
  *
  * @access	public
  */
 function saveObject()
 {
     global $rbacsystem, $rbacadmin, $rbacreview;
     // CHECK ACCESS 'write' to role folder
     // TODO: check for create role permission should be better
     if (!$rbacsystem->checkAccess("create_rolt", $this->rolf_ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_create_rolt"), $this->ilias->error_obj->WARNING);
     }
     // check required fields
     if (empty($_POST["Fobject"]["title"])) {
         $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields"), $this->ilias->error_obj->MESSAGE);
     }
     // check if role title has il_ prefix
     if (substr($_POST["Fobject"]["title"], 0, 3) == "il_") {
         $this->ilias->raiseError($this->lng->txt("msg_role_reserved_prefix"), $this->ilias->error_obj->MESSAGE);
     }
     // create new rolt object
     include_once "./Services/AccessControl/classes/class.ilObjRoleTemplate.php";
     $roltObj = new ilObjRoleTemplate();
     $roltObj->setTitle(ilUtil::stripSlashes($_POST["Fobject"]["title"]));
     $roltObj->setDescription(ilUtil::stripSlashes($_POST["Fobject"]["desc"]));
     $roltObj->create();
     $rbacadmin->assignRoleToFolder($roltObj->getId(), $this->rolf_ref_id, 'n');
     $rbacadmin->setProtected($this->rolf_ref_id, $roltObj->getId(), ilUtil::tf2yn($_POST["Fobject"]["protect_permissions"]));
     ilUtil::sendSuccess($this->lng->txt("rolt_added"), true);
     $this->ctrl->returnToParent($this);
 }
 /**
  * save a new role template object
  *
  * @access	public
  */
 public function saveObject()
 {
     global $rbacsystem, $rbacadmin, $rbacreview;
     if (!$rbacsystem->checkAccess("create_rolt", $this->rolf_ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_create_rolt"), $this->ilias->error_obj->WARNING);
     }
     $form = $this->initFormRoleTemplate();
     if ($form->checkInput()) {
         include_once "./Services/AccessControl/classes/class.ilObjRoleTemplate.php";
         $roltObj = new ilObjRoleTemplate();
         $roltObj->setTitle($form->getInput('title'));
         $roltObj->setDescription($form->getInput('desc'));
         $roltObj->create();
         $rbacadmin->assignRoleToFolder($roltObj->getId(), $this->rolf_ref_id, 'n');
         $rbacadmin->setProtected($this->rolf_ref_id, $roltObj->getId(), $form->getInput('protected') ? 'y' : 'n');
         ilUtil::sendSuccess($this->lng->txt("rolt_added"), true);
         // redirect to permission screen
         $this->ctrl->setParameter($this, 'obj_id', $roltObj->getId());
         $this->ctrl->redirect($this, 'perm');
     }
     $form->setValuesByPost();
     $this->createObject($form);
 }