/**
  * Displays all BackendUsers
  * - Switch session to different user
  *
  * @param \TYPO3\CMS\Beuser\Domain\Model\Demand $demand
  * @return void
  */
 public function indexAction(\TYPO3\CMS\Beuser\Domain\Model\Demand $demand = null)
 {
     if ($demand === null) {
         $demand = $this->moduleData->getDemand();
     } else {
         $this->moduleData->setDemand($demand);
     }
     // Switch user until logout
     $switchUser = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('SwitchUser');
     if ($switchUser > 0) {
         $this->switchUser($switchUser);
     }
     $compareUserList = $this->moduleData->getCompareUserList();
     // Create online user list for easy parsing
     $onlineUsers = $this->backendUserSessionRepository->findAllActive();
     $onlineBackendUsers = array();
     if (is_array($onlineUsers)) {
         foreach ($onlineUsers as $onlineUser) {
             $onlineBackendUsers[$onlineUser['ses_userid']] = true;
         }
     }
     $this->view->assign('onlineBackendUsers', $onlineBackendUsers);
     $this->view->assign('demand', $demand);
     $this->view->assign('returnUrl', rawurlencode(BackendUtility::getModuleUrl('system_BeuserTxBeuser')));
     $this->view->assign('dateFormat', $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']);
     $this->view->assign('timeFormat', $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm']);
     $this->view->assign('backendUsers', $this->backendUserRepository->findDemanded($demand));
     $this->view->assign('backendUserGroups', array_merge(array(''), $this->backendUserGroupRepository->findAll()->toArray()));
     $this->view->assign('compareUserList', !empty($compareUserList) ? $this->backendUserRepository->findByUidList($compareUserList) : '');
 }
 /**
  * Find Backend Users matching to Demand object properties
  *
  * @param \TYPO3\CMS\Beuser\Domain\Model\Demand $demand
  * @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult<\TYPO3\CMS\Beuser\Domain\Model\BackendUser>
  */
 public function findDemanded(\TYPO3\CMS\Beuser\Domain\Model\Demand $demand)
 {
     /** @var \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult $queryResult */
     $objects = parent::findDemanded($demand);
     // Do not list system low level users for non admins.
     if ($this->getBackendUserAuthentication()->isAdmin() === false && $objects instanceof \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult) {
         /** @var TYPO3\CMS\Extbase\Persistence\Generic\Query $query */
         $query = $objects->getQuery();
         $query->matching($query->logicalAnd($query->getConstraint(), $query->logicalNot($query->in('username', static::$systemUsers))));
         return $query->execute();
     }
     return $objects;
 }
 /**
  * Displays all BackendUsers
  * - Switch session to different user
  *
  * @param \TYPO3\CMS\Beuser\Domain\Model\Demand $demand
  * @return void
  */
 public function indexAction(\TYPO3\CMS\Beuser\Domain\Model\Demand $demand = NULL)
 {
     if ($demand === NULL) {
         $demand = $this->moduleData->getDemand();
     } else {
         $this->moduleData->setDemand($demand);
     }
     // Switch user permanently or only until logout
     if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('SwitchUser')) {
         $this->switchUser(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('SwitchUser'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('switchBackUser'));
     }
     $compareUserList = $this->moduleData->getCompareUserList();
     $this->view->assign('demand', $demand);
     $this->view->assign('returnUrl', rawurlencode(BackendUtility::getModuleUrl('system_BeuserTxBeuser')));
     $this->view->assign('dateFormat', $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']);
     $this->view->assign('timeFormat', $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm']);
     $this->view->assign('backendUsers', $this->backendUserRepository->findDemanded($demand));
     $this->view->assign('backendUserGroups', array_merge(array(''), $this->backendUserGroupRepository->findAll()->toArray()));
     $this->view->assign('compareUserList', !empty($compareUserList) ? $this->backendUserRepository->findByUidList($compareUserList) : '');
 }