/**
  * Parse Search entries
  *
  * @access public
  * @param array array of search entries
  * 
  */
 public function parse($entries)
 {
     global $rbacreview;
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     foreach ($entries as $entry) {
         $tmp_arr['id'] = $entry['obj_id'];
         $tmp_arr['title'] = ilObjRole::_getTranslation(ilObject::_lookupTitle($entry['obj_id']));
         $tmp_arr['description'] = ilObject::_lookupDescription($entry['obj_id']);
         $tmp_arr['context'] = ilObject::_lookupTitle($rbacreview->getObjectOfRole($entry['obj_id']));
         $records_arr[] = $tmp_arr;
     }
     $this->setData($records_arr ? $records_arr : array());
 }
 function start()
 {
     global $rbacreview;
     if (!is_array($this->roles)) {
         return false;
     }
     $this->__buildHeader();
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     include_once './webservice/soap/classes/class.ilObjectXMLWriter.php';
     foreach ($this->roles as $role) {
         // if role type is not empty and does not match, then continue;
         if (!empty($this->role_type) && strcasecmp($this->role_type, $role["role_type"]) != 0) {
             continue;
         }
         if ($rbacreview->isRoleDeleted($role["obj_id"])) {
             continue;
         }
         $attrs = array('role_type' => ucwords($role["role_type"]), 'id' => "il_" . IL_INST_ID . "_role_" . $role["obj_id"]);
         // open tag
         $this->xmlStartTag("Role", $attrs);
         $this->xmlElement('Title', null, $role["title"]);
         $this->xmlElement('Description', null, $role["description"]);
         $this->xmlElement('Translation', null, ilObjRole::_getTranslation($role["title"]));
         if ($ref_id = ilUtil::__extractRefId($role["title"])) {
             $ownerObj = IlObjectFactory::getInstanceByRefId($ref_id, false);
             if (is_object($ownerObj)) {
                 $attrs = array("obj_id" => "il_" . IL_INST_ID . "_" . $ownerObj->getType() . "_" . $ownerObj->getId(), "ref_id" => $ownerObj->getRefId(), "type" => $ownerObj->getType());
                 $this->xmlStartTag('AssignedObject', $attrs);
                 $this->xmlElement('Title', null, $ownerObj->getTitle());
                 $this->xmlElement('Description', null, $ownerObj->getDescription());
                 ilObjectXMLWriter::appendPathToObject($this, $ref_id);
                 $this->xmlEndTag('AssignedObject', $attrs);
             }
         }
         $this->xmlEndTag("Role");
     }
     $this->__buildFooter();
     return true;
 }
 /**
  * Constructor
  *
  * @access public
  * @param object parent gui object
  * @return void
  */
 public function __construct($a_parent_obj)
 {
     global $lng, $ilCtrl;
     $this->lng = $lng;
     $this->lng->loadLanguageModule('crs');
     $this->ctrl = $ilCtrl;
     $this->container = $a_parent_obj;
     include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
     $this->privacy = ilPrivacySettings::_getInstance();
     $this->participants = ilCourseParticipants::_getInstanceByObjId($a_parent_obj->object->getId());
     parent::__construct($a_parent_obj, 'editMembers');
     $this->setFormName('participants');
     $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
     $this->addColumn($this->lng->txt('lastname'), 'lastname', '20%');
     $this->addColumn($this->lng->txt('login'), 'login', '25%');
     if ($this->privacy->enabledCourseAccessTimes()) {
         $this->addColumn($this->lng->txt('last_access'), 'access_time');
     }
     $this->addColumn($this->lng->txt('crs_passed'), 'passed');
     $this->addColumn($this->lng->txt('crs_blocked'), 'blocked');
     $this->addColumn($this->lng->txt('crs_notification'), 'notification');
     $this->addColumn($this->lng->txt('objs_role'), 'roles');
     $this->addCommandButton('updateMembers', $this->lng->txt('save'));
     $this->addCommandButton('members', $this->lng->txt('cancel'));
     $this->setRowTemplate("tpl.edit_participants_row.html", "Modules/Course");
     $this->disable('sort');
     $this->enable('header');
     $this->enable('numinfo');
     $this->disable('select_all');
     // Performance improvement: We read the local course roles
     // only once, instead of reading them for each row in method fillRow().
     $this->localCourseRoles = array();
     foreach ($this->container->object->getLocalCourseRoles(false) as $title => $role_id) {
         $this->localCourseRoles[ilObjRole::_getTranslation($title)] = array('role_id' => $role_id, 'title' => $title);
     }
 }
 /**
  * display permissions
  * 
  * @access	public
  */
 function permObject()
 {
     global $rbacadmin, $rbacreview, $rbacsystem, $objDefinition;
     if (!$rbacsystem->checkAccess('write', $this->rolf_ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_perm"), $this->ilias->error_obj->WARNING);
         exit;
     }
     $to_filter = $objDefinition->getSubobjectsToFilter();
     $tpl_filter = array();
     $internal_tpl = false;
     if ($internal_tpl = $this->object->isInternalTemplate()) {
         $tpl_filter = $this->object->getFilterOfInternalTemplate();
     }
     $operation_info = $rbacreview->getOperationAssignment();
     foreach ($operation_info as $info) {
         if ($objDefinition->getDevMode($info['type'])) {
             continue;
         }
         // FILTER SUBOJECTS OF adm OBJECT
         if (in_array($info['type'], $to_filter)) {
             continue;
         }
         if ($internal_tpl and $tpl_filter and !in_array($info['type'], $tpl_filter)) {
             continue;
         }
         $rbac_objects[$info['typ_id']] = array("obj_id" => $info['typ_id'], "type" => $info['type']);
         $txt = $objDefinition->isPlugin($info['type']) ? ilPlugin::lookupTxt("rep_robj", $info['type'], $info['type'] . "_" . $info['operation']) : $this->lng->txt($info['type'] . "_" . $info['operation']);
         if (substr($info['operation'], 0, 7) == "create_" && $objDefinition->isPlugin(substr($info['operation'], 7))) {
             $txt = ilPlugin::lookupTxt("rep_robj", substr($info['operation'], 7), $info['type'] . "_" . $info['operation']);
         } elseif (substr($info['operation'], 0, 6) == 'create') {
             $txt = $this->lng->txt('rbac_' . $info['operation']);
         }
         $rbac_operations[$info['typ_id']][$info['ops_id']] = array("ops_id" => $info['ops_id'], "title" => $info['operation'], "name" => $txt);
     }
     foreach ($rbac_objects as $key => $obj_data) {
         if ($objDefinition->isPlugin($obj_data["type"])) {
             $rbac_objects[$key]["name"] = ilPlugin::lookupTxt("rep_robj", $obj_data["type"], "obj_" . $obj_data["type"]);
         } else {
             $rbac_objects[$key]["name"] = $this->lng->txt("obj_" . $obj_data["type"]);
         }
         $rbac_objects[$key]["ops"] = $rbac_operations[$key];
     }
     sort($rbac_objects);
     foreach ($rbac_objects as $key => $obj_data) {
         sort($rbac_objects[$key]["ops"]);
     }
     // sort by (translated) name of object type
     $rbac_objects = ilUtil::sortArray($rbac_objects, "name", "asc");
     // BEGIN CHECK_PERM
     foreach ($rbac_objects as $key => $obj_data) {
         $arr_selected = $rbacreview->getOperationsOfRole($this->object->getId(), $obj_data["type"], $this->rolf_ref_id);
         $arr_checked = array_intersect($arr_selected, array_keys($rbac_operations[$obj_data["obj_id"]]));
         foreach ($rbac_operations[$obj_data["obj_id"]] as $operation) {
             $checked = in_array($operation["ops_id"], $arr_checked);
             $disabled = false;
             // Es wird eine 2-dim Post Variable �bergeben: perm[rol_id][ops_id]
             $box = ilUtil::formCheckBox($checked, "template_perm[" . $obj_data["type"] . "][]", $operation["ops_id"], $disabled);
             $output["perm"][$obj_data["obj_id"]][$operation["ops_id"]] = $box;
         }
     }
     // END CHECK_PERM
     $output["col_anz"] = count($rbac_objects);
     $output["txt_save"] = $this->lng->txt("save");
     $output["check_protected"] = ilUtil::formCheckBox($rbacreview->isProtected($this->rolf_ref_id, $this->object->getId()), "protected", 1);
     $output["text_protected"] = $this->lng->txt("role_protect_permissions");
     /************************************/
     /*		adopt permissions form		*/
     /************************************/
     $output["message_middle"] = $this->lng->txt("adopt_perm_from_template");
     // send message for system role
     if ($this->object->getId() == SYSTEM_ROLE_ID) {
         $output["adopt"] = array();
         ilUtil::sendFailure($this->lng->txt("msg_sysrole_not_editable"));
     } else {
         // BEGIN ADOPT_PERMISSIONS
         $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id, true);
         // sort output for correct color changing
         ksort($parent_role_ids);
         foreach ($parent_role_ids as $key => $par) {
             if ($par["obj_id"] != SYSTEM_ROLE_ID) {
                 $radio = ilUtil::formRadioButton(0, "adopt", $par["obj_id"]);
                 $output["adopt"][$key]["css_row_adopt"] = ilUtil::switchColor($key, "tblrow1", "tblrow2");
                 $output["adopt"][$key]["check_adopt"] = $radio;
                 $output["adopt"][$key]["type"] = $par["type"] == 'role' ? 'Role' : 'Template';
                 $output["adopt"][$key]["role_name"] = $par["title"];
             }
         }
         $output["formaction_adopt"] = $this->ctrl->getFormAction($this);
         // END ADOPT_PERMISSIONS
     }
     $output["formaction"] = $this->ctrl->getFormAction($this);
     $this->data = $output;
     /************************************/
     /*			generate output			*/
     /************************************/
     $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
     $this->tpl->addBlockFile("LOCATOR", "locator", "tpl.locator.html", "Services/Locator");
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.adm_perm_role.html", "Services/AccessControl");
     foreach ($rbac_objects as $obj_data) {
         // BEGIN object_operations
         $this->tpl->setCurrentBlock("object_operations");
         foreach ($obj_data["ops"] as $operation) {
             $ops_ids[] = $operation["ops_id"];
             $css_row = ilUtil::switchColor($key, "tblrow1", "tblrow2");
             $this->tpl->setVariable("CSS_ROW", $css_row);
             $this->tpl->setVariable("PERMISSION", $operation["name"]);
             $this->tpl->setVariable("CHECK_PERMISSION", $this->data["perm"][$obj_data["obj_id"]][$operation["ops_id"]]);
             $this->tpl->parseCurrentBlock();
         }
         // END object_operations
         // BEGIN object_type
         $this->tpl->setCurrentBlock("object_type");
         $this->tpl->setVariable("TXT_OBJ_TYPE", $obj_data["name"]);
         // TODO: move this if in a function and query all objects that may be disabled or inactive
         if ($this->objDefinition->getDevMode($obj_data["type"])) {
             $this->tpl->setVariable("TXT_NOT_IMPL", "(" . $this->lng->txt("not_implemented_yet") . ")");
         } else {
             if ($obj_data["type"] == "icrs" and !$this->ilias->getSetting("ilinc_active")) {
                 $this->tpl->setVariable("TXT_NOT_IMPL", "(" . $this->lng->txt("not_enabled_or_configured") . ")");
             }
         }
         // js checkbox toggles
         $this->tpl->setVariable("JS_VARNAME", "template_perm_" . $obj_data["type"]);
         $this->tpl->setVariable("JS_ONCLICK", ilUtil::array_php2js($ops_ids));
         $this->tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
         $this->tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
         $this->tpl->parseCurrentBlock();
         // END object_type
     }
     /* 
     // BEGIN ADOPT PERMISSIONS
     foreach ($this->data["adopt"] as $key => $value)
     {			
     	$this->tpl->setCurrentBlock("ADOPT_PERM_ROW");
     	$this->tpl->setVariable("CSS_ROW_ADOPT",$value["css_row_adopt"]);
     	$this->tpl->setVariable("CHECK_ADOPT",$value["check_adopt"]);
     	$this->tpl->setVariable("TYPE",$value["type"]);
     	$this->tpl->setVariable("ROLE_NAME",$value["role_name"]);
     	$this->tpl->parseCurrentBlock();
     }
     
     $this->tpl->setCurrentBlock("ADOPT_PERM_FORM");
     $this->tpl->setVariable("MESSAGE_MIDDLE",$this->data["message_middle"]);
     $this->tpl->setVariable("FORMACTION_ADOPT",$this->data["formaction_adopt"]);
     $this->tpl->setVariable("ADOPT",$this->lng->txt('copy'));
     $this->tpl->parseCurrentBlock();
     // END ADOPT PERMISSIONS 		
     */
     $this->tpl->setCurrentBlock("tblfooter_protected");
     $this->tpl->setVariable("COL_ANZ", 3);
     $this->tpl->setVariable("CHECK_BOTTOM", $this->data["check_protected"]);
     $this->tpl->setVariable("MESSAGE_TABLE", $this->data["text_protected"]);
     $this->tpl->parseCurrentBlock();
     $this->tpl->setVariable("COL_ANZ_PLUS", 4);
     $this->tpl->setVariable("TXT_SAVE", $this->data["txt_save"]);
     $this->tpl->setCurrentBlock("adm_content");
     $this->tpl->setVariable("TBL_TITLE_IMG", ilUtil::getImagePath("icon_" . $this->object->getType() . ".png"));
     $this->tpl->setVariable("TBL_TITLE_IMG_ALT", $this->lng->txt($this->object->getType()));
     $this->tpl->setVariable("TBL_HELP_IMG", ilUtil::getImagePath("icon_help.png"));
     $this->tpl->setVariable("TBL_HELP_LINK", "tbl_help.php");
     $this->tpl->setVariable("TBL_HELP_IMG_ALT", $this->lng->txt("help"));
     // compute additional information in title
     if (substr($this->object->getTitle(), 0, 3) == "il_") {
         $desc = $this->lng->txt("predefined_template");
         //$this->lng->txt("obj_".$parent_node['type'])." (".$parent_node['obj_id'].") : ".$parent_node['title'];
     }
     $description = "<br/>&nbsp;<span class=\"small\">" . $desc . "</span>";
     // translation for autogenerated roles
     if (substr($this->object->getTitle(), 0, 3) == "il_") {
         include_once './Services/AccessControl/classes/class.ilObjRole.php';
         $title = ilObjRole::_getTranslation($this->object->getTitle()) . " (" . $this->object->getTitle() . ")";
     } else {
         $title = $this->object->getTitle();
     }
     $this->tpl->setVariable("TBL_TITLE", $title . $description);
     $this->tpl->setVariable("TXT_PERMISSION", $this->data["txt_permission"]);
     $this->tpl->setVariable("FORMACTION", $this->data["formaction"]);
     $this->tpl->parseCurrentBlock();
 }
Esempio n. 5
0
 /**
  * return translated title for autogenerated roles
  * @return 
  */
 public function getPresentationTitle()
 {
     return ilObjRole::_getTranslation($this->getTitle());
 }
 /**
  * Shoew add role
  * @global type $rbacreview
  * @global type $objDefinition
  * @return ilPropertyFormGUI 
  */
 protected function initRoleForm()
 {
     global $rbacreview, $objDefinition;
     include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt('role_new'));
     $form->addCommandButton('addrole', $this->lng->txt('role_new'));
     $form->addCommandButton('perm', $this->lng->txt('cancel'));
     $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $title->setValidationRegexp('/^(?!il_).*$/');
     $title->setValidationFailureMessage($this->lng->txt('msg_role_reserved_prefix'));
     $title->setSize(40);
     $title->setMaxLength(70);
     $title->setRequired(true);
     $form->addItem($title);
     $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'desc');
     $desc->setCols(40);
     $desc->setRows(3);
     $form->addItem($desc);
     $pro = new ilCheckboxInputGUI($this->lng->txt('role_protect_permissions'), 'pro');
     $pro->setInfo($this->lng->txt('role_protect_permissions_desc'));
     $pro->setValue(1);
     $form->addItem($pro);
     $pd = new ilCheckboxInputGUI($this->lng->txt('rbac_role_add_to_desktop'), 'desktop');
     $pd->setInfo($this->lng->txt('rbac_role_add_to_desktop_info'));
     $pd->setValue(1);
     $form->addItem($pd);
     if (!$this->isInAdministration()) {
         $rights = new ilRadioGroupInputGUI($this->lng->txt("rbac_role_rights_copy"), 'rights');
         $option = new ilRadioOption($this->lng->txt("rbac_role_rights_copy_empty"), 0);
         $rights->addOption($option);
         $parent_role_ids = $rbacreview->getParentRoleIds($this->gui_obj->object->getRefId(), true);
         $ids = array();
         foreach ($parent_role_ids as $id => $tmp) {
             $ids[] = $id;
         }
         // Sort ids
         $sorted_ids = ilUtil::_sortIds($ids, 'object_data', 'type DESC,title', 'obj_id');
         // Sort roles by title
         $sorted_roles = ilUtil::sortArray(array_values($parent_role_ids), 'title', ASC);
         $key = 0;
         foreach ($sorted_ids as $id) {
             $par = $parent_role_ids[$id];
             if ($par["obj_id"] != SYSTEM_ROLE_ID) {
                 include_once './Services/AccessControl/classes/class.ilObjRole.php';
                 $option = new ilRadioOption(($par["type"] == 'role' ? $this->lng->txt('obj_role') : $this->lng->txt('obj_rolt')) . ": " . ilObjRole::_getTranslation($par["title"]), $par["obj_id"]);
                 $option->setInfo($par["desc"]);
                 $rights->addOption($option);
             }
             $key++;
         }
         $form->addItem($rights);
     }
     // Local policy only for containers
     if ($objDefinition->isContainer($this->getCurrentObject()->getType())) {
         $check = new ilCheckboxInputGui($this->lng->txt("rbac_role_rights_copy_change_existing"), 'existing');
         $check->setInfo($this->lng->txt('rbac_change_existing_objects_desc_new_role'));
         $form->addItem($check);
     }
     return $form;
 }
 /**
  * Get all roles that are available in the pool
  *
  * @return array Array with the roles and their id's and title's
  */
 public function getParentRoles()
 {
     $roles = $this->rbacreview->getParentRoleIds($_GET['ref_id']);
     $global_roles = array();
     foreach ($roles as $role) {
         $role_id = $role['rol_id'];
         $role_type = $role['role_type'];
         $role_title = $role['title'];
         if ($role_type == "local") {
             $transl_role_title = ilObjRole::_getTranslation($role['title']);
             $object_id_of_role = $this->rbacreview->getObjectOfRole($role_id);
             $object_title_of_role = ilObject::_lookupTitle($object_id_of_role);
             $role_and_group_title = $transl_role_title . " von \"" . $object_title_of_role . "\"";
             $global_roles[] = array('id' => $role_id, 'title' => $role_and_group_title);
         } else {
             $global_roles[] = array('id' => $role_id, 'title' => $role_title);
         }
     }
     return $global_roles;
 }
 public function mailMembersObject()
 {
     global $rbacreview, $ilObjDataCache;
     include_once 'Services/AccessControl/classes/class.ilObjRole.php';
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_members.html', 'Services/Contact');
     $this->__setSubTabs('members');
     include_once "./Services/Link/classes/class.ilLink.php";
     $link_to_seminar = ilLink::_getLink($this->object->getRefId());
     include_once 'Services/Mail/classes/class.ilMail.php';
     require_once 'Services/Mail/classes/class.ilMailFormCall.php';
     $this->tpl->setVariable("MAILACTION", ilMailFormCall::getLinkTarget($this, 'mailMembers', array(), array('type' => 'role')));
     $this->tpl->setVariable('ADDITIONAL_MESSAGE_TEXT', $link_to_seminar);
     $this->tpl->setVariable('IMG_ARROW', ilUtil::getImagePath('arrow_downright.png'));
     $this->tpl->setVariable('OK', $this->lng->txt('ok'));
     $role_folder = $rbacreview->getRoleFolderOfObject($this->object->getRefId());
     $role_ids = $rbacreview->getRolesOfRoleFolder($role_folder['ref_id'], false);
     foreach ($role_ids as $role_id) {
         $this->tpl->setCurrentBlock('mailbox_row');
         $role_addr = $rbacreview->getRoleMailboxAddress($role_id);
         $this->tpl->setVariable('CHECK_MAILBOX', ilUtil::formCheckbox(1, 'roles[]', htmlspecialchars($role_addr)));
         if (ilMail::_usePearMail()) {
             // if pear mail is enabled, mailbox addresses are already localized in the language of the user
             $this->tpl->setVariable('MAILBOX', $role_addr);
         } else {
             // if pear mail is not enabled, we need to localize mailbox addresses in the language of the user
             $this->tpl->setVariable('MAILBOX', ilObjRole::_getTranslation($ilObjDataCache->lookupTitle($role_id)) . ' (' . $role_addr . ')');
         }
         $this->tpl->parseCurrentBlock();
     }
 }
 /**
  * Available Roles Table Data
  * @return array
  */
 function getAvailableRolesTableData()
 {
     global $tree;
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     $path = array_reverse($tree->getPathId($this->object->getRefId()));
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     $counter = 0;
     foreach ($this->valid_roles as $role) {
         $result_set[$counter]["img"] = in_array($role['obj_id'], $this->user_roles) ? self::IMG_OK : self::IMG_NOT_OK;
         $result_set[$counter]["role"] = str_replace(" ", "&nbsp;", ilObjRole::_getTranslation($role["title"]));
         if ($role['role_type'] != "linked") {
             $result_set[$counter]["effective_from"] = "";
         } else {
             $rolfs = $this->rbacreview->getFoldersAssignedToRole($role["obj_id"]);
             // ok, try to match the next rolf in path
             foreach ($path as $node) {
                 if ($node == 1) {
                     break;
                 }
                 if (in_array($node, $rolfs)) {
                     $nodedata = $tree->getNodeData($node);
                     $result_set[$counter]["effective_from"] = $nodedata["title"];
                     $result_set[$counter]["effective_from_ref_id"] = $node;
                     break;
                 }
             }
         }
         if (in_array($role['obj_id'], $this->global_roles)) {
             $result_set[$counter]["original_position"] = $this->lng->txt("global");
             $result_set[$counter]["original_position_ref_id"] = false;
         } else {
             $rolf = $this->rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
             $parent_node = $tree->getNodeData($rolf[0]);
             $result_set[$counter]["original_position"] = $parent_node["title"];
             $result_set[$counter]["original_position_ref_id"] = $parent_node["ref_id"];
         }
         ++$counter;
     }
     return $result_set;
 }
 /**
  * Form for mail to group members
  */
 function mailMembersObject()
 {
     global $rbacreview, $ilObjDataCache, $ilias;
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     $this->lng->loadLanguageModule('mail');
     if (!isset($_GET['returned_from_mail'])) {
         ilUtil::sendInfo($this->lng->txt('mail_select_recipients'));
     }
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_members.html', 'Services/Contact');
     $this->setSubTabs('members');
     $this->tabs_gui->setTabActive('members');
     require_once 'Services/Mail/classes/class.ilMailFormCall.php';
     $this->tpl->setVariable("MAILACTION", ilMailFormCall::getLinkTarget($this, 'mailMembers', array(), array('type' => 'role', 'sig' => $this->createMailSignature())));
     $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath('arrow_downright.png'));
     $this->tpl->setVariable("TXT_MARKED_ENTRIES", $this->lng->txt('marked_entries'));
     $this->tpl->setVariable("OK", $this->lng->txt('next'));
     // Get role mailbox addresses
     $role_folder = $rbacreview->getRoleFolderOfObject($this->object->getRefId());
     $role_ids = $rbacreview->getRolesOfRoleFolder($role_folder['ref_id'], false);
     $role_addrs = array();
     // Sort by relevance
     $sorted_role_ids = array();
     $counter = 2;
     foreach ($role_ids as $role_id) {
         switch (substr(ilObject::_lookupTitle($role_id), 0, 8)) {
             case 'il_grp_a':
                 $sorted_role_ids[1] = $role_id;
                 break;
             case 'il_grp_m':
                 $sorted_role_ids[0] = $role_id;
                 break;
             default:
                 $sorted_role_ids[$counter++] = $role_id;
                 break;
         }
     }
     ksort($sorted_role_ids, SORT_NUMERIC);
     foreach ((array) $sorted_role_ids as $role_id) {
         $this->tpl->setCurrentBlock("mailbox_row");
         $role_addr = $rbacreview->getRoleMailboxAddress($role_id);
         // check if role title is unique. if not force use pear mail for roles
         $ids_for_role_title = ilObject::_getIdsForTitle(ilObject::_lookupTitle($role_id), 'role');
         if (count($ids_for_role_title) >= 2) {
             $ilias->setSetting('pear_mail_enable', 1);
         }
         $this->tpl->setVariable("CHECK_MAILBOX", ilUtil::formCheckbox(1, 'roles[]', htmlspecialchars($role_addr)));
         if (ilMail::_usePearMail()) {
             // if pear mail is enabled, mailbox addresses are already localized in the language of the user
             $this->tpl->setVariable("MAILBOX", $role_addr);
         } else {
             // if pear mail is not enabled, we need to localize mailbox addresses in the language of the user
             $this->tpl->setVariable("MAILBOX", ilObjRole::_getTranslation($ilObjDataCache->lookupTitle($role_id)) . " (" . $role_addr . ")");
         }
         $this->tpl->parseCurrentBlock();
     }
 }
 function mailMembersObject()
 {
     global $rbacreview, $ilErr, $ilAccess, $ilObjDataCache, $ilias;
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     $this->lng->loadLanguageModule('mail');
     if (!isset($_GET['returned_from_mail'])) {
         ilUtil::sendInfo($this->lng->txt('mail_select_recipients'));
     }
     $is_admin = (bool) $ilAccess->checkAccess("write", "", $this->object->getRefId());
     if (!$is_admin && $this->object->getShowMembers() == $this->object->SHOW_MEMBERS_DISABLED) {
         $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
     }
     $this->setSubTabs('members');
     $this->tabs_gui->setTabActive('members');
     $this->tabs_gui->setSubTabActive('mail_members');
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.mail_members.html', 'Services/Contact');
     require_once 'Services/Mail/classes/class.ilMailFormCall.php';
     $this->tpl->setVariable("MAILACTION", ilMailFormCall::getLinkTarget($this, 'mailMembers', array(), array('type' => 'role', 'sig' => $this->createMailSignature())));
     $this->tpl->setVariable("SELECT_ACTION", 'ilias.php?baseClass=ilmailgui&view=my_courses&search_crs=' . $this->object->getId());
     $this->tpl->setVariable("MAIL_SELECTED", $this->lng->txt('send_mail_selected'));
     $this->tpl->setVariable("MAIL_MEMBERS", $this->lng->txt('send_mail_members'));
     $this->tpl->setVariable("MAIL_TUTOR", $this->lng->txt('send_mail_tutors'));
     $this->tpl->setVariable("MAIL_ADMIN", $this->lng->txt('send_mail_admins'));
     $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath('arrow_downright.png'));
     $this->tpl->setVariable("OK", $this->lng->txt('next'));
     // Display roles with user friendly mailbox addresses
     $role_folder = $rbacreview->getRoleFolderOfObject($this->object->getRefId());
     $role_ids = $rbacreview->getRolesOfRoleFolder($role_folder['ref_id'], false);
     // Sort by relevance
     $sorted_role_ids = array();
     $counter = 3;
     foreach ($role_ids as $role_id) {
         switch (substr(ilObject::_lookupTitle($role_id), 0, 8)) {
             case 'il_crs_a':
                 $sorted_role_ids[2] = $role_id;
                 break;
             case 'il_crs_t':
                 $sorted_role_ids[1] = $role_id;
                 break;
             case 'il_crs_m':
                 $sorted_role_ids[0] = $role_id;
                 break;
             default:
                 $sorted_role_ids[$counter++] = $role_id;
                 break;
         }
     }
     ksort($sorted_role_ids, SORT_NUMERIC);
     foreach ((array) $sorted_role_ids as $role_id) {
         $this->tpl->setCurrentBlock("mailbox_row");
         $role_addr = $rbacreview->getRoleMailboxAddress($role_id);
         // check if role title is unique. if not force use pear mail for roles
         $ids_for_role_title = ilObject::_getIdsForTitle(ilObject::_lookupTitle($role_id), 'role');
         if (count($ids_for_role_title) >= 2) {
             $ilias->setSetting('pear_mail_enable', 1);
         }
         $this->tpl->setVariable("CHECK_MAILBOX", ilUtil::formCheckbox(1, 'roles[]', htmlspecialchars($role_addr)));
         if (ilMail::_usePearMail()) {
             // if pear mail is enabled, mailbox addresses are already localized in the language of the user
             $this->tpl->setVariable("MAILBOX", $role_addr);
         } else {
             // if pear mail is not enabled, we need to localize mailbox addresses in the language of the user
             $this->tpl->setVariable("MAILBOX", ilObjRole::_getTranslation($ilObjDataCache->lookupTitle($role_id)) . " (" . $role_addr . ")");
         }
         $this->tpl->parseCurrentBlock();
     }
 }
Esempio n. 12
0
 /**
  * returns all local roles [role_id] => title
  * @return array
  */
 protected function getLocalRoles()
 {
     $local_roles = $this->object->getLocalGroupRoles(false);
     $grp_member = $this->object->getDefaultMemberRole();
     $grp_roles = array();
     //put the group member role to the top of the crs_roles array
     if (in_array($grp_member, $local_roles)) {
         $grp_roles[$grp_member] = ilObjRole::_getTranslation(array_search($grp_member, $local_roles));
         unset($local_roles[$grp_roles[$grp_member]]);
     }
     foreach ($local_roles as $title => $role_id) {
         $grp_roles[$role_id] = ilObjRole::_getTranslation($title);
     }
     return $grp_roles;
 }
Esempio n. 13
0
 /**
  * display roleassignment panel
  *
  * @access	public
  */
 function roleassignmentObject()
 {
     global $rbacreview, $rbacsystem, $ilUser, $ilTabs;
     $ilTabs->activateTab("role_assignment");
     if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"), $this->ilias->error_obj->MESSAGE);
     }
     $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
     if ($_SESSION['filtered_roles'] > 5) {
         $_SESSION['filtered_roles'] = 0;
     }
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.usr_role_assignment.html', 'Services/User');
     if (false) {
         $this->tpl->setCurrentBlock("filter");
         $this->tpl->setVariable("FILTER_TXT_FILTER", $this->lng->txt('filter'));
         $this->tpl->setVariable("SELECT_FILTER", $this->__buildFilterSelect());
         $this->tpl->setVariable("FILTER_ACTION", $this->ctrl->getFormAction($this));
         $this->tpl->setVariable("FILTER_NAME", 'roleassignment');
         $this->tpl->setVariable("FILTER_VALUE", $this->lng->txt('apply_filter'));
         $this->tpl->parseCurrentBlock();
     }
     // init table
     include_once "./Services/User/classes/class.ilRoleAssignmentTableGUI.php";
     $tab = new ilRoleAssignmentTableGUI($this, "roleassignment");
     // now get roles depending on filter settings
     $role_list = $rbacreview->getRolesByFilter($tab->filter["role_filter"], $this->object->getId());
     $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
     $counter = 0;
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     $records = array();
     foreach ($role_list as $role) {
         // fetch context path of role
         $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
         // only list roles that are not set to status "deleted"
         if ($rbacreview->isDeleted($rolf[0])) {
             continue;
         }
         // build context path
         $path = "";
         if ($this->tree->isInTree($rolf[0])) {
             if ($rolf[0] == ROLE_FOLDER_ID) {
                 $path = $this->lng->txt("global");
             } else {
                 $tmpPath = $this->tree->getPathFull($rolf[0]);
                 // count -1, to exclude the role folder itself
                 /*for ($i = 1; $i < (count($tmpPath)-1); $i++)
                 				    {
                 					    if ($path != "")
                 					    {
                 						    $path .= " > ";
                 					    }
                 
                 					    $path .= $tmpPath[$i]["title"];
                 				    }*/
                 $path = $tmpPath[count($tmpPath) - 1]["title"];
             }
         } else {
             $path = "<b>Rolefolder " . $rolf[0] . " not found in tree! (Role " . $role["obj_id"] . ")</b>";
         }
         $disabled = false;
         // disable checkbox for system role for the system user
         if ($this->object->getId() == SYSTEM_USER_ID and $role["obj_id"] == SYSTEM_ROLE_ID or !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId())) and $role["obj_id"] == SYSTEM_ROLE_ID) {
             $disabled = true;
         }
         // protected admin role
         if ($role['obj_id'] == SYSTEM_ROLE_ID && !$rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
             include_once './Services/PrivacySecurity/classes/class.ilSecuritySettings.php';
             if (ilSecuritySettings::_getInstance()->isAdminRoleProtected()) {
                 $disabled = true;
             }
         }
         if (substr($role["title"], 0, 3) == "il_") {
             if (!$assignable) {
                 $rolf_arr = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
                 $rolf2 = $rolf_arr[0];
             } else {
                 $rolf2 = $rolf;
             }
             $parent_node = $this->tree->getNodeData($rolf2);
             $role["description"] = $this->lng->txt("obj_" . $parent_node["type"]) . "&nbsp;(#" . $parent_node["obj_id"] . ")";
         }
         $role_ids[$counter] = $role["obj_id"];
         $result_set[$counter][] = $checkbox = ilUtil::formCheckBox(in_array($role["obj_id"], $assigned_roles), "role_id[]", $role["obj_id"], $disabled) . "<input type=\"hidden\" name=\"role_id_ctrl[]\" value=\"" . $role["obj_id"] . "\"/>";
         $this->ctrl->setParameterByClass("ilobjrolegui", "ref_id", $rolf[0]);
         $this->ctrl->setParameterByClass("ilobjrolegui", "obj_id", $role["obj_id"]);
         $result_set[$counter][] = $link = "<a href=\"" . $this->ctrl->getLinkTargetByClass("ilobjrolegui", "perm") . "\">" . ilObjRole::_getTranslation($role["title"]) . "</a>";
         $title = ilObjRole::_getTranslation($role["title"]);
         $result_set[$counter][] = $role["description"];
         // Add link to objector local Rores
         if ($role["role_type"] == "local") {
             // Get Object to the role
             $obj_id = ilRbacReview::getObjectOfRole($role["rol_id"]);
             $obj_type = ilObject::_lookupType($obj_id);
             $ref_ids = ilObject::_getAllReferences($obj_id);
             foreach ($ref_ids as $ref_id) {
             }
             require_once "./Services/Link/classes/class.ilLink.php";
             $result_set[$counter][] = $context = "<a href='" . ilLink::_getLink($ref_id, ilObject::_lookupType($obj_id)) . "' target='_top'>" . $path . "</a>";
         } else {
             $result_set[$counter][] = $path;
             $context = $path;
         }
         $records[] = array("path" => $path, "description" => $role["description"], "context" => $context, "checkbox" => $checkbox, "role" => $link, "title" => $title);
         ++$counter;
     }
     if (true) {
         $tab->setData($records);
         $this->tpl->setVariable("ROLES_TABLE", $tab->getHTML());
         return;
     }
 }
Esempio n. 14
0
 protected function adoptPermObject()
 {
     global $rbacreview;
     $output = array();
     $parent_role_ids = $rbacreview->getParentRoleIds($this->obj_ref_id, true);
     $ids = array();
     foreach ($parent_role_ids as $id => $tmp) {
         $ids[] = $id;
     }
     // Sort ids
     $sorted_ids = ilUtil::_sortIds($ids, 'object_data', 'type,title', 'obj_id');
     $key = 0;
     foreach ($sorted_ids as $id) {
         $par = $parent_role_ids[$id];
         if ($par["obj_id"] != SYSTEM_ROLE_ID && $this->object->getId() != $par["obj_id"]) {
             $output[$key]["role_id"] = $par["obj_id"];
             $output[$key]["type"] = $par["type"] == 'role' ? $this->lng->txt('obj_role') : $this->lng->txt('obj_rolt');
             $output[$key]["role_name"] = ilObjRole::_getTranslation($par["title"]);
             $output[$key]["role_desc"] = $par["desc"];
             $key++;
         }
     }
     include_once './Services/AccessControl/classes/class.ilRoleAdoptPermissionTableGUI.php';
     $tbl = new ilRoleAdoptPermissionTableGUI($this, "adoptPerm");
     $tbl->setTitle($this->lng->txt("adopt_perm_from_template"));
     $tbl->setData($output);
     $this->tpl->setContent($tbl->getHTML());
 }
 /**
  * Create (linked) title
  * @param array $role
  * @return 
  */
 protected function createTitle($role)
 {
     global $ilCtrl;
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     $role['title'] = ilObjRole::_getTranslation($role['title']);
     // No local policies
     if ($role['parent'] != $this->getRefId()) {
         return $role['title'];
     }
     $ilCtrl->setParameterByClass('ilobjrolegui', 'obj_id', $role['obj_id']);
     return '<a class="tblheader" href="' . $ilCtrl->getLinkTargetByClass('ilobjrolegui', '') . '" >' . $role['title'] . '</a>';
 }
Esempio n. 16
0
 protected function adoptPermObject()
 {
     global $rbacreview;
     $output = array();
     $parent_role_ids = $rbacreview->getParentRoleIds($this->rolf_ref_id, true);
     $ids = array();
     foreach ($parent_role_ids as $id => $tmp) {
         $ids[] = $id;
     }
     // Sort ids
     $sorted_ids = ilUtil::_sortIds($ids, 'object_data', 'type,title', 'obj_id');
     $key = 0;
     foreach ($sorted_ids as $id) {
         $par = $parent_role_ids[$id];
         if ($par["obj_id"] != SYSTEM_ROLE_ID && $this->object->getId() != $par["obj_id"]) {
             $radio = ilUtil::formRadioButton(0, "adopt", $par["obj_id"]);
             $output["adopt"][$key]["css_row_adopt"] = $key % 2 == 0 ? "tblrow1" : "tblrow2";
             $output["adopt"][$key]["check_adopt"] = $radio;
             $output["adopt"][$key]["role_id"] = $par["obj_id"];
             $output["adopt"][$key]["type"] = $par["type"] == 'role' ? $this->lng->txt('obj_role') : $this->lng->txt('obj_rolt');
             $output["adopt"][$key]["role_name"] = ilObjRole::_getTranslation($par["title"]);
             $output["adopt"][$key]["role_desc"] = $par["desc"];
             $key++;
         }
     }
     $output["formaction_adopt"] = $this->ctrl->getFormAction($this);
     $output["message_middle"] = $this->lng->txt("adopt_perm_from_template");
     $tpl = new ilTemplate("tpl.adm_copy_role.html", true, true, "Services/AccessControl");
     $tpl->setCurrentBlock("ADOPT_PERM_ROW");
     foreach ($output["adopt"] as $key => $value) {
         $tpl->setVariable("CSS_ROW_ADOPT", $value["css_row_adopt"]);
         $tpl->setVariable("CHECK_ADOPT", $value["check_adopt"]);
         $tpl->setVariable("LABEL_ID", $value["role_id"]);
         $tpl->setVariable("TYPE", $value["type"]);
         $tpl->setVariable("ROLE_NAME", $value["role_name"]);
         if (strlen($value['role_desc'])) {
             $tpl->setVariable('ROLE_DESC', $value['role_desc']);
         }
         $tpl->parseCurrentBlock();
     }
     $tpl->setVariable("TPLPATH", $this->tpl->tplPath);
     $tpl->setVariable("MESSAGE_MIDDLE", $output["message_middle"]);
     $tpl->setVariable("FORMACTION_ADOPT", $output["formaction_adopt"]);
     $tpl->setVariable("ADOPT", $this->lng->txt('copy'));
     $tpl->setVariable("CANCEL", $this->lng->txt('cancel'));
     $tpl->setVariable('HEAD_ROLE', $this->lng->txt('title'));
     $tpl->setVariable('HEAD_TYPE', $this->lng->txt('type'));
     $this->tpl->setContent($tpl->get());
 }
    /**
     * get group member status
     * @access	public
     * @param	integer	user_id
     * @return	returns string of role titles
     */
    function getMemberRolesTitle($a_user_id)
    {
        global $ilDB, $ilBench;
        include_once './Services/AccessControl/classes/class.ilObjRole.php';
        $str_member_roles = "";
        $data_types = array();
        $data_values = array();
        $query = 'SELECT title FROM object_data
					LEFT JOIN rbac_ua ON object_data.obj_id = rbac_ua.rol_id
					WHERE object_data.type = %s
					AND rbac_ua.usr_id = %s
					AND rbac_ua.rol_id IN';
        array_push($data_types, 'text', 'integer');
        array_push($data_values, 'role', $a_user_id);
        $local_roles = $this->getLocalRoles();
        $cnt_local_roles = count($local_roles);
        if (is_array($local_roles) && $cnt_local_roles > 0) {
            $in = '(';
            $counter = 0;
            foreach ($local_roles as $local_role) {
                array_push($data_values, $local_role);
                array_push($data_types, 'integer');
                if ($counter > 0) {
                    $in .= ',';
                }
                $in .= '%s';
                ++$counter;
            }
            $in .= ')';
            $query .= $in;
        }
        $cnt_data_values = count($data_values);
        $cnt_data_types = count($data_types);
        $r = $ilDB->queryf($query, $data_types, $data_values);
        while ($row = $r->fetchRow(DB_FETCHMODE_ASSOC)) {
            // display human readable role names for autogenerated roles
            $str_member_roles .= ilObjRole::_getTranslation($row["title"]) . ", ";
        }
        return substr($str_member_roles, 0, -2);
    }
 /**
  * Parse role list
  * @param array $role_list
  */
 public function parse($role_folder_id)
 {
     global $rbacreview, $ilUser;
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     if ($this->getType() == self::TYPE_VIEW) {
         $filter_orig = $filter = $this->getFilterItemByPostVar('role_title')->getValue();
         $type = $this->getFilterItemByPostVar('role_type')->getValue();
     } else {
         $filter_orig = $filter = $this->getRoleTitleFilter();
         $type = ilRbacReview::FILTER_ALL;
     }
     // the translation must be filtered
     if ($type == ilRbacReview::FILTER_INTERNAL or $type == ilRbacReview::FILTER_ALL) {
         // roles like il_crs_... are filtered manually
         $filter = '';
     }
     $role_list = $rbacreview->getRolesByFilter($type, 0, $filter);
     $counter = 0;
     $rows = array();
     foreach ((array) $role_list as $role) {
         if ($role['parent'] and $GLOBALS['tree']->isDeleted($role['parent'])) {
             continue;
         }
         $title = ilObjRole::_getTranslation($role['title']);
         if ($type == ilRbacReview::FILTER_INTERNAL or $type == ilRbacReview::FILTER_ALL) {
             if (strlen($filter_orig)) {
                 if (stristr($title, $filter_orig) == FALSE) {
                     continue;
                 }
             }
         }
         $rows[$counter]['title_orig'] = $role['title'];
         $rows[$counter]['title'] = $title;
         $rows[$counter]['description'] = $role['description'];
         $rows[$counter]['obj_id'] = $role['obj_id'];
         $rows[$counter]['parent'] = $role['parent'];
         $rows[$counter]['type'] = $role['type'];
         $auto = substr($role['title'], 0, 3) == 'il_' ? true : false;
         // Role templates
         if ($role['type'] == 'rolt') {
             $rows[$counter]['rtype'] = $auto ? self::TYPE_ROLT_AU : self::TYPE_ROLT_UD;
         } else {
             // Roles
             if ($role['parent'] == ROLE_FOLDER_ID) {
                 if ($role['obj_id'] == ANONYMOUS_ROLE_ID or $role['obj_id'] == SYSTEM_ROLE_ID) {
                     $rows[$counter]['rtype'] = self::TYPE_GLOBAL_AU;
                 } else {
                     $rows[$counter]['rtype'] = self::TYPE_GLOBAL_UD;
                 }
             } else {
                 $rows[$counter]['rtype'] = $auto ? self::TYPE_LOCAL_AU : self::TYPE_LOCAL_UD;
             }
         }
         ++$counter;
     }
     $this->setMaxCount(count($rows));
     $this->setData($rows);
 }
 function getRoleAssignmentInfo()
 {
     global $lng, $rbacreview, $tree;
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     // icon handlers
     $icon_ok = "<img src=\"" . ilUtil::getImagePath("icon_ok.png") . "\" alt=\"" . $lng->txt("info_assigned") . "\" title=\"" . $lng->txt("info_assigned") . "\" border=\"0\" vspace=\"0\"/>";
     $icon_not_ok = "<img src=\"" . ilUtil::getImagePath("icon_not_ok.png") . "\" alt=\"" . $lng->txt("info_not_assigned") . "\" title=\"" . $lng->txt("info_not_assigned") . "\" border=\"0\" vspace=\"0\"/>";
     $path = array_reverse($tree->getPathId($this->object->getRefId()));
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     $counter = 0;
     foreach ($this->valid_roles as $role) {
         $result_set[$counter][] = in_array($role['obj_id'], $this->user_roles) ? $icon_ok : $icon_not_ok;
         $result_set[$counter][] = str_replace(" ", "&nbsp;", ilObjRole::_getTranslation($role["title"]));
         if ($role['role_type'] != "linked") {
             $result_set[$counter][] = "";
         } else {
             $rolfs = $rbacreview->getFoldersAssignedToRole($role["obj_id"]);
             // ok, try to match the next rolf in path
             foreach ($path as $node) {
                 if ($node == 1) {
                     break;
                 }
                 $rolf = $rbacreview->getRoleFolderOfObject($node);
                 if (in_array($rolf['ref_id'], $rolfs)) {
                     $nodedata = $tree->getNodeData($node);
                     $result_set[$counter][] = $nodedata["title"];
                     break;
                 }
             }
         }
         if (in_array($role['obj_id'], $this->global_roles)) {
             $result_set[$counter][] = $lng->txt("global");
         } else {
             $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"], true);
             $parent_node = $tree->getParentNodeData($rolf[0]);
             $result_set[$counter][] = $parent_node["title"];
         }
         ++$counter;
     }
     return $this->__showRolesTable($result_set);
 }
 function getRolesWithContribute($a_node_id)
 {
     global $rbacreview;
     include_once "Services/AccessControl/classes/class.ilObjRole.php";
     $contr_op_id = ilRbacReview::_getOperationIdByName("contribute");
     $contr_role_id = $this->getLocalContributorRole($a_node_id);
     $res = array();
     foreach ($rbacreview->getParentRoleIds($a_node_id) as $role_id => $role) {
         if ($role_id != $contr_role_id && in_array($contr_op_id, $rbacreview->getActiveOperationsOfRole($a_node_id, $role_id))) {
             $res[$role_id] = ilObjRole::_getTranslation($role["title"]);
         }
     }
     return $res;
 }
Esempio n. 21
0
 /**
  * returns all local roles [role_id] => title
  * @return array localroles
  */
 protected function getLocalRoles()
 {
     $crs_admin = $this->object->getDefaultAdminRole();
     $crs_member = $this->object->getDefaultMemberRole();
     $local_roles = $this->object->getLocalCourseRoles(false);
     $crs_roles = array();
     //put the course member role to the top of the crs_roles array
     if (in_array($crs_member, $local_roles)) {
         $crs_roles[$crs_member] = ilObjRole::_getTranslation(array_search($crs_member, $local_roles));
         unset($local_roles[$crs_roles[$crs_member]]);
     }
     foreach ($local_roles as $title => $role_id) {
         if ($role_id == $crs_admin && !$this->hasAdminPermission()) {
             continue;
         }
         $crs_roles[$role_id] = ilObjRole::_getTranslation($title);
     }
     return $crs_roles;
 }
Esempio n. 22
0
 /**
  * get ALL local roles of course, also those created and defined afterwards
  * only fetch data once from database. info is stored in object variable
  * @access	public
  * @return	return array [title|id] of roles...
  */
 public function getLocalCourseRoles($a_translate = false)
 {
     global $rbacadmin, $rbacreview;
     if (empty($this->local_roles)) {
         $this->local_roles = array();
         $role_arr = $rbacreview->getRolesOfRoleFolder($this->getRefId());
         foreach ($role_arr as $role_id) {
             if ($rbacreview->isAssignable($role_id, $this->getRefId()) == true) {
                 $role_Obj = $this->ilias->obj_factory->getInstanceByObjId($role_id);
                 if ($a_translate) {
                     $role_name = ilObjRole::_getTranslation($role_Obj->getTitle());
                 } else {
                     $role_name = $role_Obj->getTitle();
                 }
                 $this->local_roles[$role_name] = $role_Obj->getId();
             }
         }
     }
     return $this->local_roles;
 }
 /**
  * Confirm deletion of roles
  */
 protected function confirmDeleteObject()
 {
     global $ilCtrl;
     if (!count($_POST['roles'])) {
         ilUtil::sendFailure($this->lng->txt('select_one'), true);
         $ilCtrl->redirect($this, 'view');
     }
     $question = $this->lng->txt('rbac_role_delete_qst');
     include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
     $confirm = new ilConfirmationGUI();
     $confirm->setHeaderText($question);
     $confirm->setFormAction($ilCtrl->getFormAction($this));
     $confirm->setHeaderText($this->lng->txt("info_delete_sure"));
     $confirm->setConfirm($this->lng->txt('delete'), 'deleteRole');
     $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     foreach ($_POST['roles'] as $role_id) {
         $confirm->addItem('roles[]', $role_id, ilObjRole::_getTranslation(ilObject::_lookupTitle($role_id)));
     }
     $this->tpl->setContent($confirm->getHTML());
 }