예제 #1
0
 /**
  * Init 
  * @return 
  */
 private function init()
 {
     if (ilUserAccountSettings::getInstance()->isUserAccessRestricted()) {
         include_once './Services/User/classes/class.ilLocalUser.php';
         $this->folder_ids = ilLocalUser::_getFolderIds();
     }
 }
예제 #2
0
 function _getAllUserIds($a_filter = 0)
 {
     global $ilDB;
     switch ($a_filter) {
         case 0:
             if (ilLocalUser::_getFolderIds()) {
                 $where = "WHERE " . $ilDB->in("time_limit_owner", ilLocalUser::_getFolderIds(), false, "integer") . " ";
                 //$where .= '(';
                 //$where .= implode(",",ilUtil::quoteArray(ilLocalUser::_getFolderIds()));
                 //$where .= ')';
             } else {
                 //$where = "WHERE time_limit_owner IN ('')";
                 return array();
             }
             break;
         default:
             $where = "WHERE time_limit_owner = " . $ilDB->quote($a_filter, "integer") . " ";
             break;
     }
     $query = "SELECT usr_id FROM usr_data " . $where;
     $res = $ilDB->query($query);
     while ($row = $ilDB->fetchObject($res)) {
         $users[] = $row->usr_id;
     }
     return $users ? $users : array();
 }
예제 #3
0
 function assignSave()
 {
     global $rbacreview, $rbacadmin;
     if (!$this->ilAccess->checkAccess("cat_administrate_users", "", $_GET["ref_id"])) {
         ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
         $this->ctrl->redirect($this, "");
     }
     include_once './Services/User/classes/class.ilLocalUser.php';
     // check hack
     if (!isset($_GET['obj_id']) or !in_array($_REQUEST['obj_id'], ilLocalUser::_getAllUserIds())) {
         ilUtil::sendFailure('no_user_selected');
         $this->index();
         return true;
     }
     $roles = $this->__getAssignableRoles();
     // check minimum one global role
     if (!$this->__checkGlobalRoles($_POST['role_ids'])) {
         ilUtil::sendFailure($this->lng->txt('no_global_role_left'));
         $this->assignRolesObject();
         return false;
     }
     $new_role_ids = $_POST['role_ids'] ? $_POST['role_ids'] : array();
     $assigned_roles = $rbacreview->assignedRoles((int) $_REQUEST['obj_id']);
     foreach ($roles as $role) {
         if (in_array($role['obj_id'], $new_role_ids) and !in_array($role['obj_id'], $assigned_roles)) {
             $rbacadmin->assignUser($role['obj_id'], (int) $_REQUEST['obj_id']);
         }
         if (in_array($role['obj_id'], $assigned_roles) and !in_array($role['obj_id'], $new_role_ids)) {
             $rbacadmin->deassignUser($role['obj_id'], (int) $_REQUEST['obj_id']);
         }
     }
     ilUtil::sendSuccess($this->lng->txt('role_assignment_updated'));
     $this->assignRoles();
     return true;
 }
 function __buildFilterSelect($a_parent_ids)
 {
     $action[0] = $this->lng->txt('all_users');
     $action[$this->object->getRefId()] = $this->lng->txt('users') . ' (' . ilObject::_lookupTitle(ilObject::_lookupObjId($this->object->getRefId())) . ')';
     foreach ($a_parent_ids as $parent) {
         if ($parent == $this->object->getRefId()) {
             continue;
         }
         switch ($parent) {
             case ilLocalUser::_getUserFolderId():
                 $action[ilLocalUser::_getUserFolderId()] = $this->lng->txt('global_user');
                 break;
             default:
                 $action[$parent] = $this->lng->txt('users') . ' (' . ilObject::_lookupTitle(ilObject::_lookupObjId($parent)) . ')';
                 break;
         }
     }
     return ilUtil::formSelect($_SESSION['filtered_users'][$this->object->getRefId()], "filter", $action, false, true);
 }
예제 #5
0
 /**
  * Init filter
  */
 function initFilter()
 {
     global $lng, $rbacreview, $ilUser, $ilCtrl;
     // Show context filter
     if ($this->getMode() == self::MODE_LOCAL_USER) {
         include_once './Services/User/classes/class.ilLocalUser.php';
         $parent_ids = ilLocalUser::_getFolderIds();
         if (count($parent_ids) > 1) {
             include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
             $co = new ilSelectInputGUI($lng->txt('context'), 'time_limit_owner');
             $ref_id = $this->getUserFolderId();
             $opt[0] = $this->lng->txt('all_users');
             $opt[$this->getUserFolderId()] = $lng->txt('users') . ' (' . ilObject::_lookupTitle(ilObject::_lookupObjId($this->getUserFolderId())) . ')';
             foreach ($parent_ids as $parent_id) {
                 if ($parent_id == $this->getUserFolderId()) {
                     continue;
                 }
                 switch ($parent_id) {
                     case USER_FOLDER_ID:
                         $opt[USER_FOLDER_ID] = $lng->txt('global_user');
                         break;
                     default:
                         $opt[$parent_id] = $lng->txt('users') . ' (' . ilObject::_lookupTitle(ilObject::_lookupObjId($parent_id)) . ')';
                         break;
                 }
             }
             $co->setOptions($opt);
             $this->addFilterItem($co);
             $co->readFromSession();
             $this->filter['time_limit_owner'] = $co->getValue();
         }
     }
     // User name, login, email filter
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     $ul = new ilTextInputGUI($lng->txt("login") . "/" . $lng->txt("email") . "/" . $lng->txt("name"), "query");
     $ul->setDataSource($ilCtrl->getLinkTarget($this->getParentObject(), "addUserAutoComplete", "", true));
     $ul->setSize(20);
     $ul->setSubmitFormOnEnter(true);
     $this->addFilterItem($ul);
     $ul->readFromSession();
     $this->filter["query"] = $ul->getValue();
     /*
     include_once("./Services/Form/classes/class.ilTextInputGUI.php");
     $ti = new ilTextInputGUI($lng->txt("login")."/".$lng->txt("email")."/".$lng->txt("name"), "query");
     $ti->setMaxLength(64);
     $ti->setSize(20);
     $ti->setSubmitFormOnEnter(true);
     $this->addFilterItem($ti);
     $ti->readFromSession();
     $this->filter["query"] = $ti->getValue();
     */
     // activation
     include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
     $options = array("" => $lng->txt("user_all"), "active" => $lng->txt("active"), "inactive" => $lng->txt("inactive"));
     $si = new ilSelectInputGUI($this->lng->txt("user_activation"), "activation");
     $si->setOptions($options);
     $this->addFilterItem($si);
     $si->readFromSession();
     $this->filter["activation"] = $si->getValue();
     // limited access
     include_once "./Services/Form/classes/class.ilCheckboxInputGUI.php";
     $cb = new ilCheckboxInputGUI($this->lng->txt("user_limited_access"), "limited_access");
     $this->addFilterItem($cb);
     $cb->readFromSession();
     $this->filter["limited_access"] = $cb->getChecked();
     // last login
     include_once "./Services/Form/classes/class.ilDateTimeInputGUI.php";
     $di = new ilDateTimeInputGUI($this->lng->txt("user_last_login_before"), "last_login");
     $default_date = new ilDateTime(time(), IL_CAL_UNIX);
     $default_date->increment(IL_CAL_DAY, 1);
     $di->setDate($default_date);
     $this->addFilterItem($di);
     $di->readFromSession();
     $this->filter["last_login"] = $di->getDate();
     if ($this->getMode() == self::MODE_USER_FOLDER) {
         // no assigned courses
         include_once "./Services/Form/classes/class.ilCheckboxInputGUI.php";
         $cb = new ilCheckboxInputGUI($this->lng->txt("user_no_courses"), "no_courses");
         $this->addFilterItem($cb);
         $cb->readFromSession();
         $this->filter["no_courses"] = $cb->getChecked();
         // no assigned groups
         include_once "./Services/Form/classes/class.ilCheckboxInputGUI.php";
         $ng = new ilCheckboxInputGUI($this->lng->txt("user_no_groups"), "no_groups");
         $this->addFilterItem($ng);
         $ng->readFromSession();
         $this->filter['no_groups'] = $ng->getChecked();
         // course/group members
         include_once "./Services/Form/classes/class.ilRepositorySelectorInputGUI.php";
         $rs = new ilRepositorySelectorInputGUI($lng->txt("user_member_of_course_group"), "course_group");
         $rs->setSelectText($lng->txt("user_select_course_group"));
         $rs->setHeaderMessage($lng->txt("user_please_select_course_group"));
         $rs->setClickableTypes(array("crs", "grp"));
         $this->addFilterItem($rs);
         $rs->readFromSession();
         $this->filter["course_group"] = $rs->getValue();
     }
     // global roles
     $options = array("" => $lng->txt("user_any"));
     $roles = $rbacreview->getRolesByFilter(2, $ilUser->getId());
     foreach ($roles as $role) {
         $options[$role["rol_id"]] = $role["title"];
     }
     $si = new ilSelectInputGUI($this->lng->txt("user_global_role"), "global_role");
     $si->setOptions($options);
     $this->addFilterItem($si);
     $si->readFromSession();
     $this->filter["global_role"] = $si->getValue();
 }