first commit
This commit is contained in:
commit
1218dd1517
12716 files changed
+989233
No files matched your search
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
namespace TYPO3\CMS\Beuser\ContextMenu;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Backend\ContextMenu\ItemProviders\PageProvider;
|
||||
|
||||
/**
|
||||
* @internal This class is a TYPO3 core-internal hook implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class ItemProvider extends PageProvider
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $itemsConfiguration = [
|
||||
'permissions' => [
|
||||
'type' => 'item',
|
||||
'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:CM_perms',
|
||||
'iconIdentifier' => 'actions-lock',
|
||||
'callbackAction' => 'openPermissionsModule'
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @param string $itemName
|
||||
* @param string $type
|
||||
* @return bool
|
||||
*/
|
||||
protected function canRender(string $itemName, string $type): bool
|
||||
{
|
||||
if (in_array($itemName, $this->disabledItems, true)) {
|
||||
return false;
|
||||
}
|
||||
return $this->canShowPermissionsModule();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $items
|
||||
* @return array
|
||||
*/
|
||||
public function addItems(array $items): array
|
||||
{
|
||||
$this->initDisabledItems();
|
||||
$localItems = $this->prepareItems($this->itemsConfiguration);
|
||||
if (isset($items['more']['childItems'])) {
|
||||
$items['more']['childItems'] = $items['more']['childItems'] + $localItems;
|
||||
} else {
|
||||
$items += $localItems;
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* This priority should be lower than priority of the PageProvider, so it's evaluated after the PageProvider
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPriority(): int
|
||||
{
|
||||
return 60;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $itemName
|
||||
* @return array
|
||||
*/
|
||||
protected function getAdditionalAttributes(string $itemName): array
|
||||
{
|
||||
return ['data-callback-module' => 'TYPO3/CMS/Beuser/ContextMenuActions'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the page is allowed to show permission module
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function canShowPermissionsModule(): bool
|
||||
{
|
||||
return $this->canBeEdited() && $this->backendUser->check('modules', 'system_BeuserTxPermission');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,344 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Controller;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
|
||||
use TYPO3\CMS\Core\Compatibility\PublicMethodDeprecationTrait;
|
||||
use TYPO3\CMS\Core\Session\Backend\HashableSessionBackendInterface;
|
||||
use TYPO3\CMS\Core\Session\Backend\SessionBackendInterface;
|
||||
use TYPO3\CMS\Core\Session\SessionManager;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
||||
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
|
||||
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
|
||||
|
||||
/**
|
||||
* Backend module user administration controller
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class BackendUserController extends ActionController
|
||||
{
|
||||
use PublicMethodDeprecationTrait;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $deprecatedPublicMethods = [
|
||||
'initializeView' => 'Using BackendUserController::initializeView() is deprecated and will not be possible anymore in TYPO3 v10.0.',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const RECENT_USERS_LIMIT = 3;
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Beuser\Domain\Model\ModuleData
|
||||
*/
|
||||
protected $moduleData;
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Beuser\Service\ModuleDataStorageService
|
||||
*/
|
||||
protected $moduleDataStorageService;
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Beuser\Domain\Repository\BackendUserRepository
|
||||
*/
|
||||
protected $backendUserRepository;
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository
|
||||
*/
|
||||
protected $backendUserGroupRepository;
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Beuser\Domain\Repository\BackendUserSessionRepository
|
||||
*/
|
||||
protected $backendUserSessionRepository;
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Beuser\Service\ModuleDataStorageService $moduleDataStorageService
|
||||
*/
|
||||
public function injectModuleDataStorageService(\TYPO3\CMS\Beuser\Service\ModuleDataStorageService $moduleDataStorageService)
|
||||
{
|
||||
$this->moduleDataStorageService = $moduleDataStorageService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Beuser\Domain\Repository\BackendUserRepository $backendUserRepository
|
||||
*/
|
||||
public function injectBackendUserRepository(\TYPO3\CMS\Beuser\Domain\Repository\BackendUserRepository $backendUserRepository)
|
||||
{
|
||||
$this->backendUserRepository = $backendUserRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository $backendUserGroupRepository
|
||||
*/
|
||||
public function injectBackendUserGroupRepository(\TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository $backendUserGroupRepository)
|
||||
{
|
||||
$this->backendUserGroupRepository = $backendUserGroupRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Beuser\Domain\Repository\BackendUserSessionRepository $backendUserSessionRepository
|
||||
*/
|
||||
public function injectBackendUserSessionRepository(\TYPO3\CMS\Beuser\Domain\Repository\BackendUserSessionRepository $backendUserSessionRepository)
|
||||
{
|
||||
$this->backendUserSessionRepository = $backendUserSessionRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and persist module data
|
||||
*
|
||||
* @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request
|
||||
* @param \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response
|
||||
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
|
||||
*/
|
||||
public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)
|
||||
{
|
||||
$this->moduleData = $this->moduleDataStorageService->loadModuleData();
|
||||
// We "finally" persist the module data.
|
||||
try {
|
||||
parent::processRequest($request, $response);
|
||||
$this->moduleDataStorageService->persistModuleData($this->moduleData);
|
||||
} catch (\TYPO3\CMS\Extbase\Mvc\Exception\StopActionException $e) {
|
||||
$this->moduleDataStorageService->persistModuleData($this->moduleData);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign default variables to view
|
||||
* @param ViewInterface $view
|
||||
*/
|
||||
protected function initializeView(ViewInterface $view)
|
||||
{
|
||||
$view->assignMultiple([
|
||||
'shortcutLabel' => 'backendUsers',
|
||||
'dateFormat' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],
|
||||
'timeFormat' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all BackendUsers
|
||||
* - Switch session to different user
|
||||
*
|
||||
* @param \TYPO3\CMS\Beuser\Domain\Model\Demand $demand
|
||||
*/
|
||||
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)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 = [];
|
||||
if (is_array($onlineUsers)) {
|
||||
foreach ($onlineUsers as $onlineUser) {
|
||||
$onlineBackendUsers[$onlineUser['ses_userid']] = true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->assignMultiple([
|
||||
'onlineBackendUsers' => $onlineBackendUsers,
|
||||
'demand' => $demand,
|
||||
'backendUsers' => $this->backendUserRepository->findDemanded($demand),
|
||||
'backendUserGroups' => array_merge([''], $this->backendUserGroupRepository->findAll()->toArray()),
|
||||
'compareUserUidList' => array_combine($compareUserList, $compareUserList),
|
||||
'currentUserUid' => $this->getBackendUserAuthentication()->user['uid'],
|
||||
'compareUserList' => !empty($compareUserList) ? $this->backendUserRepository->findByUidList($compareUserList) : '',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Views all currently logged in BackendUsers and their sessions
|
||||
*/
|
||||
public function onlineAction()
|
||||
{
|
||||
$onlineUsersAndSessions = [];
|
||||
$onlineUsers = $this->backendUserRepository->findOnline();
|
||||
foreach ($onlineUsers as $onlineUser) {
|
||||
$onlineUsersAndSessions[] = [
|
||||
'backendUser' => $onlineUser,
|
||||
'sessions' => $this->backendUserSessionRepository->findByBackendUser($onlineUser)
|
||||
];
|
||||
}
|
||||
|
||||
$currentSessionId = $this->getBackendUserAuthentication()->getSessionId();
|
||||
$sessionBackend = $this->getSessionBackend();
|
||||
if ($sessionBackend instanceof HashableSessionBackendInterface) {
|
||||
$currentSessionId = $sessionBackend->hash($currentSessionId);
|
||||
}
|
||||
$this->view->assignMultiple([
|
||||
'shortcutLabel' => 'onlineUsers',
|
||||
'onlineUsersAndSessions' => $onlineUsersAndSessions,
|
||||
'currentSessionId' => $currentSessionId,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare backend users from demand
|
||||
*/
|
||||
public function compareAction()
|
||||
{
|
||||
$compareUserList = $this->moduleData->getCompareUserList();
|
||||
if (empty($compareUserList)) {
|
||||
$this->redirect('index');
|
||||
}
|
||||
|
||||
$this->view->assignMultiple([
|
||||
'shortcutLabel' => 'compareUsers',
|
||||
'compareUserList' => $this->backendUserRepository->findByUidList($compareUserList),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches one backend user to the compare list
|
||||
*
|
||||
* @param int $uid
|
||||
*/
|
||||
public function addToCompareListAction($uid)
|
||||
{
|
||||
$this->moduleData->attachUidCompareUser($uid);
|
||||
$this->moduleDataStorageService->persistModuleData($this->moduleData);
|
||||
$this->forward('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes given backend user to the compare list
|
||||
*
|
||||
* @param int $uid
|
||||
*/
|
||||
public function removeFromCompareListAction($uid)
|
||||
{
|
||||
$this->moduleData->detachUidCompareUser($uid);
|
||||
$this->moduleDataStorageService->persistModuleData($this->moduleData);
|
||||
$this->forward('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Terminate BackendUser session and logout corresponding client
|
||||
* Redirects to onlineAction with message
|
||||
*
|
||||
* @param \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser
|
||||
* @param string $sessionId
|
||||
*/
|
||||
protected function terminateBackendUserSessionAction(\TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser, $sessionId)
|
||||
{
|
||||
// terminating value of persisted session ID (probably hashed value)
|
||||
$sessionBackend = $this->getSessionBackend();
|
||||
$success = $sessionBackend->remove($sessionId);
|
||||
|
||||
if ($success) {
|
||||
$this->addFlashMessage(LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:terminateSessionSuccess', 'beuser'));
|
||||
}
|
||||
$this->forward('online');
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches to a given user (SU-mode) and then redirects to the start page of the backend to refresh the navigation etc.
|
||||
*
|
||||
* @param string $switchUser BE-user record that will be switched to
|
||||
*/
|
||||
protected function switchUser($switchUser)
|
||||
{
|
||||
$targetUser = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('be_users', $switchUser);
|
||||
if (is_array($targetUser) && $this->getBackendUserAuthentication()->isAdmin()) {
|
||||
// Set backend user listing module as starting module for switchback
|
||||
$this->getBackendUserAuthentication()->uc['startModuleOnFirstLogin'] = 'system_BeuserTxBeuser';
|
||||
$this->getBackendUserAuthentication()->uc['recentSwitchedToUsers'] = $this->generateListOfMostRecentSwitchedUsers($targetUser['uid']);
|
||||
$this->getBackendUserAuthentication()->writeUC();
|
||||
|
||||
$this->getSessionBackend()->update(
|
||||
$this->getBackendUserAuthentication()->getSessionId(),
|
||||
[
|
||||
'ses_userid' => (int)$targetUser['uid'],
|
||||
'ses_backuserid' => (int)$this->getBackendUserAuthentication()->user['uid']
|
||||
]
|
||||
);
|
||||
|
||||
$this->emitSwitchUserSignal($targetUser);
|
||||
|
||||
$redirectUrl = 'index.php' . ($GLOBALS['TYPO3_CONF_VARS']['BE']['interfaces'] ? '' : '?commandLI=1');
|
||||
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($redirectUrl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a list of users to whom where switched in the past. This is limited by RECENT_USERS_LIMIT.
|
||||
*
|
||||
* @param int $targetUserUid
|
||||
* @return int[]
|
||||
*/
|
||||
protected function generateListOfMostRecentSwitchedUsers(int $targetUserUid): array
|
||||
{
|
||||
$latestUserUids = [];
|
||||
$backendUser = $this->getBackendUserAuthentication();
|
||||
|
||||
if (isset($backendUser->uc['recentSwitchedToUsers']) && is_array($backendUser->uc['recentSwitchedToUsers'])) {
|
||||
$latestUserUids = $backendUser->uc['recentSwitchedToUsers'];
|
||||
}
|
||||
|
||||
// Remove potentially existing user in that list
|
||||
$index = array_search($targetUserUid, $latestUserUids, true);
|
||||
if ($index !== false) {
|
||||
unset($latestUserUids[$index]);
|
||||
}
|
||||
|
||||
array_unshift($latestUserUids, $targetUserUid);
|
||||
$latestUserUids = array_slice($latestUserUids, 0, static::RECENT_USERS_LIMIT);
|
||||
|
||||
return $latestUserUids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Emit a signal when using the "switch to user" functionality
|
||||
*
|
||||
* @param array $targetUser
|
||||
*/
|
||||
protected function emitSwitchUserSignal(array $targetUser)
|
||||
{
|
||||
$this->signalSlotDispatcher->dispatch(__CLASS__, 'switchUser', [$targetUser]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BackendUserAuthentication
|
||||
*/
|
||||
protected function getBackendUserAuthentication(): BackendUserAuthentication
|
||||
{
|
||||
return $GLOBALS['BE_USER'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SessionBackendInterface
|
||||
*/
|
||||
protected function getSessionBackend()
|
||||
{
|
||||
$loginType = $this->getBackendUserAuthentication()->getLoginType();
|
||||
return GeneralUtility::makeInstance(SessionManager::class)->getSessionBackend($loginType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Controller;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
||||
|
||||
/**
|
||||
* Backend module user group administration controller
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class BackendUserGroupController extends ActionController
|
||||
{
|
||||
/**
|
||||
* @var \TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository
|
||||
*/
|
||||
protected $backendUserGroupRepository;
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository $backendUserGroupRepository
|
||||
*/
|
||||
public function injectBackendUserGroupRepository(\TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository $backendUserGroupRepository)
|
||||
{
|
||||
$this->backendUserGroupRepository = $backendUserGroupRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all BackendUserGroups
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->assignMultiple(
|
||||
[
|
||||
'shortcutLabel' => 'backendUserGroupsMenu',
|
||||
'backendUserGroups' => $this->backendUserGroupRepository->findAll(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,316 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Controller;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
||||
use TYPO3\CMS\Core\DataHandling\DataHandler;
|
||||
use TYPO3\CMS\Core\Http\HtmlResponse;
|
||||
use TYPO3\CMS\Core\Imaging\Icon;
|
||||
use TYPO3\CMS\Core\Imaging\IconFactory;
|
||||
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Fluid\View\StandaloneView;
|
||||
|
||||
/**
|
||||
* This class extends the permissions module in the TYPO3 Backend to provide
|
||||
* convenient methods of editing of page permissions (including page ownership
|
||||
* (user and group)) via new AjaxRequestHandler facility
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class PermissionAjaxController
|
||||
{
|
||||
/**
|
||||
* The local configuration array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $conf;
|
||||
|
||||
/**
|
||||
* @var IconFactory
|
||||
*/
|
||||
protected $iconFactory;
|
||||
|
||||
/**
|
||||
* The constructor of this class
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
|
||||
$this->getLanguageService()->includeLLFile('EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf');
|
||||
}
|
||||
|
||||
/**
|
||||
* The main dispatcher function. Collect data and prepare HTML output.
|
||||
*
|
||||
* @param ServerRequestInterface $request
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function dispatch(ServerRequestInterface $request): ResponseInterface
|
||||
{
|
||||
$parsedBody = $request->getParsedBody();
|
||||
$this->conf = [
|
||||
'page' => $parsedBody['page'] ?? null,
|
||||
'who' => $parsedBody['who'] ?? null,
|
||||
'mode' => $parsedBody['mode'] ?? null,
|
||||
'bits' => (int)($parsedBody['bits'] ?? 0),
|
||||
'permissions' => (int)($parsedBody['permissions'] ?? 0),
|
||||
'action' => $parsedBody['action'] ?? null,
|
||||
'ownerUid' => (int)($parsedBody['ownerUid'] ?? 0),
|
||||
'username' => $parsedBody['username'] ?? null,
|
||||
'groupUid' => (int)($parsedBody['groupUid'] ?? 0),
|
||||
'groupname' => $parsedBody['groupname'] ?? '',
|
||||
'editLockState' => (int)($parsedBody['editLockState'] ?? 0),
|
||||
'new_owner_uid' => (int)($parsedBody['newOwnerUid'] ?? 0),
|
||||
'new_group_uid' => (int)($parsedBody['newGroupUid'] ?? 0),
|
||||
];
|
||||
|
||||
$extPath = ExtensionManagementUtility::extPath('beuser');
|
||||
|
||||
$view = GeneralUtility::makeInstance(StandaloneView::class);
|
||||
$view->setPartialRootPaths(['default' => ExtensionManagementUtility::extPath('beuser') . 'Resources/Private/Partials']);
|
||||
$view->assign('pageId', $this->conf['page']);
|
||||
|
||||
$response = new HtmlResponse('');
|
||||
|
||||
// Basic test for required value
|
||||
if ($this->conf['page'] <= 0) {
|
||||
$response->getBody()->write('This script cannot be called directly');
|
||||
return $response->withStatus(500);
|
||||
}
|
||||
|
||||
$content = '';
|
||||
// Init TCE for execution of update
|
||||
$tce = GeneralUtility::makeInstance(DataHandler::class);
|
||||
// Determine the scripts to execute
|
||||
switch ($this->conf['action']) {
|
||||
case 'show_change_owner_selector':
|
||||
$content = $this->renderUserSelector($this->conf['page'], $this->conf['ownerUid'], $this->conf['username']);
|
||||
break;
|
||||
case 'change_owner':
|
||||
$userId = $this->conf['new_owner_uid'];
|
||||
if (is_int($userId)) {
|
||||
// Prepare data to change
|
||||
$data = [];
|
||||
$data['pages'][$this->conf['page']]['perms_userid'] = $userId;
|
||||
// Execute TCE Update
|
||||
$tce->start($data, []);
|
||||
$tce->process_datamap();
|
||||
|
||||
$view->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/PermissionAjax/ChangeOwner.html');
|
||||
$view->assign('userId', $userId);
|
||||
$usernameArray = BackendUtility::getUserNames('username', ' AND uid = ' . $userId);
|
||||
$view->assign('username', $usernameArray[$userId]['username']);
|
||||
$content = $view->render();
|
||||
} else {
|
||||
$response->getBody()->write('An error occurred: No page owner uid specified');
|
||||
$response = $response->withStatus(500);
|
||||
}
|
||||
break;
|
||||
case 'show_change_group_selector':
|
||||
$content = $this->renderGroupSelector($this->conf['page'], $this->conf['groupUid'], $this->conf['groupname']);
|
||||
break;
|
||||
case 'change_group':
|
||||
$groupId = $this->conf['new_group_uid'];
|
||||
if (is_int($groupId)) {
|
||||
// Prepare data to change
|
||||
$data = [];
|
||||
$data['pages'][$this->conf['page']]['perms_groupid'] = $groupId;
|
||||
// Execute TCE Update
|
||||
$tce->start($data, []);
|
||||
$tce->process_datamap();
|
||||
|
||||
$view->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/PermissionAjax/ChangeGroup.html');
|
||||
$view->assign('groupId', $groupId);
|
||||
$groupnameArray = BackendUtility::getGroupNames('title', ' AND uid = ' . $groupId);
|
||||
$view->assign('groupname', $groupnameArray[$groupId]['title']);
|
||||
$content = $view->render();
|
||||
} else {
|
||||
$response->getBody()->write('An error occurred: No page group uid specified');
|
||||
$response = $response->withStatus(500);
|
||||
}
|
||||
break;
|
||||
case 'toggle_edit_lock':
|
||||
// Prepare data to change
|
||||
$data = [];
|
||||
$data['pages'][$this->conf['page']]['editlock'] = $this->conf['editLockState'] === 1 ? 0 : 1;
|
||||
// Execute TCE Update
|
||||
$tce->start($data, []);
|
||||
$tce->process_datamap();
|
||||
$content = $this->renderToggleEditLock($this->conf['page'], $data['pages'][$this->conf['page']]['editlock']);
|
||||
break;
|
||||
default:
|
||||
if ($this->conf['mode'] === 'delete') {
|
||||
$this->conf['permissions'] = (int)($this->conf['permissions'] - $this->conf['bits']);
|
||||
} else {
|
||||
$this->conf['permissions'] = (int)($this->conf['permissions'] + $this->conf['bits']);
|
||||
}
|
||||
// Prepare data to change
|
||||
$data = [];
|
||||
$data['pages'][$this->conf['page']]['perms_' . $this->conf['who']] = $this->conf['permissions'];
|
||||
// Execute TCE Update
|
||||
$tce->start($data, []);
|
||||
$tce->process_datamap();
|
||||
|
||||
$view->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/PermissionAjax/ChangePermission.html');
|
||||
$view->assign('permission', $this->conf['permissions']);
|
||||
$view->assign('scope', $this->conf['who']);
|
||||
$content = $view->render();
|
||||
}
|
||||
$response->getBody()->write($content);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the user selector element
|
||||
*
|
||||
* @param int $page The page id to change the user for
|
||||
* @param int $ownerUid The page owner uid
|
||||
* @param string $username The username to display
|
||||
* @return string The html select element
|
||||
*/
|
||||
protected function renderUserSelector($page, $ownerUid, $username = '')
|
||||
{
|
||||
$page = (int)$page;
|
||||
$ownerUid = (int)$ownerUid;
|
||||
// Get usernames
|
||||
$beUsers = BackendUtility::getUserNames();
|
||||
// Owner selector:
|
||||
$options = '';
|
||||
// Loop through the users
|
||||
foreach ($beUsers as $uid => $row) {
|
||||
$uid = (int)$uid;
|
||||
$selected = $uid === $ownerUid ? ' selected="selected"' : '';
|
||||
$options .= '<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['username']) . '</option>';
|
||||
}
|
||||
$elementId = 'o_' . $page;
|
||||
$options = '<option value="0"></option>' . $options;
|
||||
$selector = '<select name="new_page_owner" id="new_page_owner">' . $options . '</select>';
|
||||
$saveButton = '<a class="saveowner btn btn-default" data-page="' . $page . '" data-owner="' . $ownerUid
|
||||
. '" data-element-id="' . $elementId . '" title="Change owner">'
|
||||
. $this->iconFactory->getIcon('actions-document-save', Icon::SIZE_SMALL)->render()
|
||||
. '</a>';
|
||||
$cancelButton = '<a class="restoreowner btn btn-default" data-page="' . $page . '" data-owner="' . $ownerUid
|
||||
. '" data-element-id="' . $elementId . '"'
|
||||
. (!empty($username) ? ' data-username="' . htmlspecialchars($username) . '"' : '')
|
||||
. ' title="Cancel">'
|
||||
. $this->iconFactory->getIcon('actions-close', Icon::SIZE_SMALL)->render()
|
||||
. '</a>';
|
||||
return '<span id="' . $elementId . '">'
|
||||
. $selector
|
||||
. '<span class="btn-group">'
|
||||
. $saveButton
|
||||
. $cancelButton
|
||||
. '</span>'
|
||||
. '</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the group selector element
|
||||
*
|
||||
* @param int $page The page id to change the user for
|
||||
* @param int $groupUid The page group uid
|
||||
* @param string $groupname The groupname to display
|
||||
* @return string The html select element
|
||||
*/
|
||||
protected function renderGroupSelector($page, $groupUid, $groupname = '')
|
||||
{
|
||||
$page = (int)$page;
|
||||
$groupUid = (int)$groupUid;
|
||||
|
||||
// Get group names
|
||||
$beGroupsO = $beGroups = BackendUtility::getGroupNames();
|
||||
// Group selector:
|
||||
$options = '';
|
||||
// flag: is set if the page-groupid equals one from the group-list
|
||||
$userset = 0;
|
||||
// Loop through the groups
|
||||
foreach ($beGroups as $uid => $row) {
|
||||
$uid = (int)$uid;
|
||||
if ($uid === $groupUid) {
|
||||
$userset = 1;
|
||||
$selected = ' selected="selected"';
|
||||
} else {
|
||||
$selected = '';
|
||||
}
|
||||
$options .= '<option value="' . $uid . '"' . $selected . '>' . htmlspecialchars($row['title']) . '</option>';
|
||||
}
|
||||
// If the group was not set AND there is a group for the page
|
||||
if (!$userset && $groupUid) {
|
||||
$options = '<option value="' . $groupUid . '" selected="selected">' .
|
||||
htmlspecialchars($beGroupsO[$groupUid]['title']) . '</option>' . $options;
|
||||
}
|
||||
$elementId = 'g_' . $page;
|
||||
$options = '<option value="0"></option>' . $options;
|
||||
$selector = '<select name="new_page_group" id="new_page_group">' . $options . '</select>';
|
||||
$saveButton = '<a class="savegroup btn btn-default" data-page="' . $page . '" data-group-id="' . $groupUid
|
||||
. '" data-element-id="' . $elementId . '" title="Change group">'
|
||||
. $this->iconFactory->getIcon('actions-document-save', Icon::SIZE_SMALL)->render()
|
||||
. '</a>';
|
||||
$cancelButton = '<a class="restoregroup btn btn-default" data-page="' . $page . '" data-group-id="' . $groupUid
|
||||
. '" data-element-id="' . $elementId . '"'
|
||||
. (!empty($groupname) ? ' data-groupname="' . htmlspecialchars($groupname) . '"' : '')
|
||||
. ' title="Cancel">'
|
||||
. $this->iconFactory->getIcon('actions-close', Icon::SIZE_SMALL)->render()
|
||||
. '</a>';
|
||||
return '<span id="' . $elementId . '">'
|
||||
. $selector
|
||||
. '<span class="btn-group">'
|
||||
. $saveButton
|
||||
. $cancelButton
|
||||
. '</span>'
|
||||
. '</span>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the string with the new edit lock state of a page record
|
||||
*
|
||||
* @param int $page The TYPO3 page id
|
||||
* @param string $editLockState The state of the TYPO3 page (locked, unlocked)
|
||||
* @return string The new edit lock string wrapped in HTML
|
||||
*/
|
||||
protected function renderToggleEditLock($page, $editLockState)
|
||||
{
|
||||
$page = (int)$page;
|
||||
if ($editLockState === 1) {
|
||||
$ret = '<span id="el_' . $page . '"><a class="editlock btn btn-default" data-page="' . $page
|
||||
. '" data-lockstate="1" title="The page and all content is locked for editing by all non-Admin users.">'
|
||||
. $this->iconFactory->getIcon('actions-lock', Icon::SIZE_SMALL)->render() . '</a></span>';
|
||||
} else {
|
||||
$ret = '<span id="el_' . $page . '"><a class="editlock btn btn-default" data-page="' . $page .
|
||||
'" data-lockstate="0" title="Enable the »Admin-only« edit lock for this page">'
|
||||
. $this->iconFactory->getIcon('actions-unlock', Icon::SIZE_SMALL)->render() . '</a></span>';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \TYPO3\CMS\Core\Localization\LanguageService
|
||||
*/
|
||||
protected function getLanguageService()
|
||||
{
|
||||
return $GLOBALS['LANG'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
|
||||
*/
|
||||
protected function getBackendUser()
|
||||
{
|
||||
return $GLOBALS['BE_USER'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,417 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Controller;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
|
||||
use TYPO3\CMS\Backend\Tree\View\PageTreeView;
|
||||
use TYPO3\CMS\Backend\Utility\BackendUtility;
|
||||
use TYPO3\CMS\Backend\View\BackendTemplateView;
|
||||
use TYPO3\CMS\Core\DataHandling\DataHandler;
|
||||
use TYPO3\CMS\Core\Imaging\Icon;
|
||||
use TYPO3\CMS\Core\Messaging\FlashMessage;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
||||
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
|
||||
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
|
||||
|
||||
/**
|
||||
* Backend module page permissions
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class PermissionController extends ActionController
|
||||
{
|
||||
/**
|
||||
* @var string prefix for session
|
||||
*/
|
||||
const SESSION_PREFIX = 'tx_Beuser_';
|
||||
|
||||
/**
|
||||
* @var int the current page id
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $returnUrl = '';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $depth;
|
||||
|
||||
/**
|
||||
* Number of levels to enable recursive settings for
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $getLevels = 10;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $pageInfo = [];
|
||||
|
||||
/**
|
||||
* Backend Template Container
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $defaultViewObjectName = BackendTemplateView::class;
|
||||
|
||||
/**
|
||||
* BackendTemplateContainer
|
||||
*
|
||||
* @var BackendTemplateView
|
||||
*/
|
||||
protected $view;
|
||||
|
||||
/**
|
||||
* Initialize action
|
||||
*/
|
||||
protected function initializeAction()
|
||||
{
|
||||
// determine depth parameter
|
||||
$this->depth = (int)GeneralUtility::_GP('depth') > 0
|
||||
? (int)GeneralUtility::_GP('depth')
|
||||
: (int)$this->getBackendUser()->getSessionData(self::SESSION_PREFIX . 'depth');
|
||||
if ($this->request->hasArgument('depth')) {
|
||||
$this->depth = (int)$this->request->getArgument('depth');
|
||||
}
|
||||
$this->getBackendUser()->setAndSaveSessionData(self::SESSION_PREFIX . 'depth', $this->depth);
|
||||
|
||||
// determine id parameter
|
||||
$this->id = (int)GeneralUtility::_GP('id');
|
||||
if ($this->request->hasArgument('id')) {
|
||||
$this->id = (int)$this->request->getArgument('id');
|
||||
}
|
||||
|
||||
if (!BackendUtility::getRecord('pages', $this->id)) {
|
||||
$this->id = 0;
|
||||
}
|
||||
|
||||
$this->returnUrl = GeneralUtility::_GP('returnUrl');
|
||||
if ($this->request->hasArgument('returnUrl')) {
|
||||
$this->returnUrl = $this->request->getArgument('returnUrl');
|
||||
}
|
||||
|
||||
$this->setPageInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes view
|
||||
*
|
||||
* @param ViewInterface $view The view to be initialized
|
||||
*/
|
||||
protected function initializeView(ViewInterface $view)
|
||||
{
|
||||
parent::initializeView($view);
|
||||
$this->setPageInfo();
|
||||
$view->assign(
|
||||
'previewUrl',
|
||||
BackendUtility::viewOnClick(
|
||||
(int)$this->pageInfo['uid'],
|
||||
'',
|
||||
BackendUtility::BEgetRootLine((int)$this->pageInfo['uid'])
|
||||
)
|
||||
);
|
||||
|
||||
// the view of the update action has a different view class
|
||||
if ($view instanceof BackendTemplateView) {
|
||||
$view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Beuser/Permissions');
|
||||
$view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Tooltip');
|
||||
|
||||
$this->registerDocHeaderButtons();
|
||||
$this->view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation($this->pageInfo);
|
||||
$this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the Icons into the docheader
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function registerDocHeaderButtons()
|
||||
{
|
||||
/** @var ButtonBar $buttonBar */
|
||||
$buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
|
||||
$currentRequest = $this->request;
|
||||
$moduleName = $currentRequest->getPluginName();
|
||||
$getVars = $this->request->getArguments();
|
||||
$lang = $this->getLanguageService();
|
||||
|
||||
$extensionName = $currentRequest->getControllerExtensionName();
|
||||
if (empty($getVars)) {
|
||||
$modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
|
||||
$getVars = ['id', 'route', $modulePrefix];
|
||||
}
|
||||
|
||||
if ($currentRequest->getControllerActionName() === 'edit') {
|
||||
// CLOSE button:
|
||||
if (!empty($this->returnUrl)) {
|
||||
$closeButton = $buttonBar->makeLinkButton()
|
||||
->setHref($this->returnUrl)
|
||||
->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:rm.closeDoc'))
|
||||
->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon(
|
||||
'actions-close',
|
||||
Icon::SIZE_SMALL
|
||||
));
|
||||
$buttonBar->addButton($closeButton);
|
||||
}
|
||||
|
||||
// SAVE button:
|
||||
$saveButton = $buttonBar->makeInputButton()
|
||||
->setTitle($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:rm.saveCloseDoc'))
|
||||
->setName('tx_beuser_system_beusertxpermission[submit]')
|
||||
->setValue('Save')
|
||||
->setForm('PermissionControllerEdit')
|
||||
->setIcon($this->view->getModuleTemplate()->getIconFactory()->getIcon(
|
||||
'actions-document-save',
|
||||
Icon::SIZE_SMALL
|
||||
))
|
||||
->setShowLabelText(true);
|
||||
|
||||
$buttonBar->addButton($saveButton);
|
||||
}
|
||||
|
||||
// SHORTCUT botton:
|
||||
$shortcutButton = $buttonBar->makeShortcutButton()
|
||||
->setModuleName($moduleName)
|
||||
->setGetVariables($getVars);
|
||||
$buttonBar->addButton($shortcutButton);
|
||||
}
|
||||
|
||||
/**
|
||||
* Index action
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
if (!$this->id) {
|
||||
$this->pageInfo = ['title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], 'uid' => 0, 'pid' => 0];
|
||||
}
|
||||
|
||||
if ($this->getBackendUser()->workspace != 0) {
|
||||
// Adding section with the permission setting matrix:
|
||||
$this->addFlashMessage(
|
||||
LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:WorkspaceWarningText', 'beuser'),
|
||||
LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:WorkspaceWarning', 'beuser'),
|
||||
FlashMessage::WARNING
|
||||
);
|
||||
}
|
||||
|
||||
// depth options
|
||||
$depthOptions = [];
|
||||
$url = $this->uriBuilder->reset()->setArguments([
|
||||
'action' => 'index',
|
||||
'depth' => '__DEPTH__',
|
||||
'id' => $this->id
|
||||
])->buildBackendUri();
|
||||
foreach ([1, 2, 3, 4, 10] as $depthLevel) {
|
||||
$levelLabel = $depthLevel === 1 ? 'level' : 'levels';
|
||||
$depthOptions[$depthLevel] = $depthLevel . ' ' . LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:' . $levelLabel, 'beuser');
|
||||
}
|
||||
$this->view->assign('currentId', $this->id);
|
||||
$this->view->assign('depthBaseUrl', $url);
|
||||
$this->view->assign('depth', $this->depth);
|
||||
$this->view->assign('depthOptions', $depthOptions);
|
||||
|
||||
$beUserArray = BackendUtility::getUserNames();
|
||||
$this->view->assign('beUsers', $beUserArray);
|
||||
$beGroupArray = BackendUtility::getGroupNames();
|
||||
$this->view->assign('beGroups', $beGroupArray);
|
||||
|
||||
/** @var PageTreeView $tree */
|
||||
$tree = GeneralUtility::makeInstance(PageTreeView::class);
|
||||
$tree->init();
|
||||
$tree->addField('perms_user', true);
|
||||
$tree->addField('perms_group', true);
|
||||
$tree->addField('perms_everybody', true);
|
||||
$tree->addField('perms_userid', true);
|
||||
$tree->addField('perms_groupid', true);
|
||||
$tree->addField('hidden');
|
||||
$tree->addField('fe_group');
|
||||
$tree->addField('starttime');
|
||||
$tree->addField('endtime');
|
||||
$tree->addField('editlock');
|
||||
|
||||
// Create the tree from $this->id
|
||||
if ($this->id) {
|
||||
$tree->tree[] = ['row' => $this->pageInfo, 'HTML' => $tree->getIcon($this->id)];
|
||||
} else {
|
||||
$tree->tree[] = ['row' => $this->pageInfo, 'HTML' => $tree->getRootIcon($this->pageInfo)];
|
||||
}
|
||||
$tree->getTree($this->id, $this->depth);
|
||||
$this->view->assign('viewTree', $tree->tree);
|
||||
|
||||
// CSH for permissions setting
|
||||
$this->view->assign('cshItem', BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module', null, '<span class="btn btn-default btn-sm">|</span>'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit action
|
||||
*/
|
||||
public function editAction()
|
||||
{
|
||||
$this->view->assign('id', $this->id);
|
||||
$this->view->assign('depth', $this->depth);
|
||||
|
||||
if (!$this->id) {
|
||||
$this->pageInfo = ['title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'], 'uid' => 0, 'pid' => 0];
|
||||
}
|
||||
if ($this->getBackendUser()->workspace != 0) {
|
||||
// Adding FlashMessage with the permission setting matrix:
|
||||
$this->addFlashMessage(
|
||||
LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:WorkspaceWarningText', 'beuser'),
|
||||
LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:WorkspaceWarning', 'beuser'),
|
||||
FlashMessage::WARNING
|
||||
);
|
||||
}
|
||||
// Get user names and group names
|
||||
$beGroupArray = BackendUtility::getGroupNames();
|
||||
$beUserArray = BackendUtility::getUserNames();
|
||||
|
||||
// Owner selector
|
||||
$beUserDataArray = [0 => LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectNone', 'beuser')];
|
||||
foreach ($beUserArray as $uid => &$row) {
|
||||
$beUserDataArray[$uid] = $row['username'];
|
||||
}
|
||||
$beUserDataArray[-1] = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectUnchanged', 'beuser');
|
||||
$this->view->assign('currentBeUser', $this->pageInfo['perms_userid']);
|
||||
$this->view->assign('beUserData', $beUserDataArray);
|
||||
|
||||
// Group selector
|
||||
$beGroupDataArray = [0 => LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectNone', 'beuser')];
|
||||
foreach ($beGroupArray as $uid => $row) {
|
||||
$beGroupDataArray[$uid] = $row['title'];
|
||||
}
|
||||
$beGroupDataArray[-1] = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:selectUnchanged', 'beuser');
|
||||
$this->view->assign('currentBeGroup', $this->pageInfo['perms_groupid']);
|
||||
$this->view->assign('beGroupData', $beGroupDataArray);
|
||||
$this->view->assign('pageInfo', $this->pageInfo);
|
||||
$this->view->assign('returnUrl', $this->returnUrl);
|
||||
$this->view->assign('recursiveSelectOptions', $this->getRecursiveSelectOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Update action
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $mirror
|
||||
*/
|
||||
protected function updateAction(array $data, array $mirror)
|
||||
{
|
||||
$dataHandlerInput = [];
|
||||
// Prepare the input data for data handler
|
||||
if (!empty($data['pages'])) {
|
||||
foreach ($data['pages'] as $pageUid => $properties) {
|
||||
// if the owner and group field shouldn't be touched, unset the option
|
||||
if ((int)$properties['perms_userid'] === -1) {
|
||||
unset($properties['perms_userid']);
|
||||
}
|
||||
if ((int)$properties['perms_groupid'] === -1) {
|
||||
unset($properties['perms_groupid']);
|
||||
}
|
||||
$dataHandlerInput[$pageUid] = $properties;
|
||||
if (!empty($mirror['pages'][$pageUid])) {
|
||||
$mirrorPages = GeneralUtility::intExplode(',', $mirror['pages'][$pageUid]);
|
||||
foreach ($mirrorPages as $mirrorPageUid) {
|
||||
$dataHandlerInput[$mirrorPageUid] = $properties;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$dataHandler = GeneralUtility::makeInstance(DataHandler::class);
|
||||
$dataHandler->start(
|
||||
[
|
||||
'pages' => $dataHandlerInput
|
||||
],
|
||||
[]
|
||||
);
|
||||
$dataHandler->process_datamap();
|
||||
|
||||
$this->redirectToUri($this->returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
|
||||
*/
|
||||
protected function getBackendUser()
|
||||
{
|
||||
return $GLOBALS['BE_USER'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Finding tree and offer setting of values recursively.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getRecursiveSelectOptions()
|
||||
{
|
||||
// Initialize tree object:
|
||||
$tree = GeneralUtility::makeInstance(PageTreeView::class);
|
||||
$tree->init();
|
||||
$tree->addField('perms_userid', true);
|
||||
$tree->makeHTML = 0;
|
||||
$tree->setRecs = 1;
|
||||
// Make tree:
|
||||
$tree->getTree($this->id, $this->getLevels, '');
|
||||
$options = [];
|
||||
$options[''] = '';
|
||||
// If there are a hierarchy of page ids, then...
|
||||
if ($this->getBackendUser()->user['uid'] && !empty($tree->orig_ids_hierarchy)) {
|
||||
// Init:
|
||||
$labelRecursive = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:recursive', 'beuser');
|
||||
$labelLevel = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:level', 'beuser');
|
||||
$labelLevels = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:levels', 'beuser');
|
||||
$labelPageAffected = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:page_affected', 'beuser');
|
||||
$labelPagesAffected = LocalizationUtility::translate('LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:pages_affected', 'beuser');
|
||||
$theIdListArr = [];
|
||||
// Traverse the number of levels we want to allow recursive
|
||||
// setting of permissions for:
|
||||
for ($a = $this->getLevels; $a > 0; $a--) {
|
||||
if (is_array($tree->orig_ids_hierarchy[$a])) {
|
||||
foreach ($tree->orig_ids_hierarchy[$a] as $theId) {
|
||||
$theIdListArr[] = $theId;
|
||||
}
|
||||
$lKey = $this->getLevels - $a + 1;
|
||||
$pagesCount = count($theIdListArr);
|
||||
$options[implode(',', $theIdListArr)] = $labelRecursive . ' ' . $lKey . ' ' . ($lKey === 1 ? $labelLevel : $labelLevels) .
|
||||
' (' . $pagesCount . ' ' . ($pagesCount === 1 ? $labelPageAffected : $labelPagesAffected) . ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if page record exists and set pageInfo
|
||||
*/
|
||||
protected function setPageInfo(): void
|
||||
{
|
||||
$this->pageInfo = BackendUtility::readPageAccess(BackendUtility::getRecord('pages', $this->id) ? $this->id : 0, ' 1=1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns LanguageService
|
||||
*
|
||||
* @return \TYPO3\CMS\Core\Localization\LanguageService
|
||||
*/
|
||||
protected function getLanguageService()
|
||||
{
|
||||
return $GLOBALS['LANG'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Domain\Model;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Model for backend user
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class BackendUser extends \TYPO3\CMS\Extbase\Domain\Model\BackendUser
|
||||
{
|
||||
/**
|
||||
* Comma separated list of uids in multi-select
|
||||
* Might retrieve the labels from TCA/DataMapper
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $allowedLanguages = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $dbMountPoints = '';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $fileMountPoints = '';
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Beuser\Domain\Model\BackendUserGroup>
|
||||
*/
|
||||
protected $backendUserGroups;
|
||||
|
||||
/**
|
||||
* @param string $allowedLanguages
|
||||
*/
|
||||
public function setAllowedLanguages($allowedLanguages)
|
||||
{
|
||||
$this->allowedLanguages = $allowedLanguages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAllowedLanguages()
|
||||
{
|
||||
return $this->allowedLanguages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $dbMountPoints
|
||||
*/
|
||||
public function setDbMountPoints($dbMountPoints)
|
||||
{
|
||||
$this->dbMountPoints = $dbMountPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDbMountPoints()
|
||||
{
|
||||
return $this->dbMountPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fileMountPoints
|
||||
*/
|
||||
public function setFileMountPoints($fileMountPoints)
|
||||
{
|
||||
$this->fileMountPoints = $fileMountPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFileMountPoints()
|
||||
{
|
||||
return $this->fileMountPoints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is active, not disabled
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isActive()
|
||||
{
|
||||
if ($this->getIsDisabled()) {
|
||||
return false;
|
||||
}
|
||||
$now = new \DateTime('now');
|
||||
return !$this->getStartDateAndTime() && !$this->getEndDateAndTime() || $this->getStartDateAndTime() <= $now && (!$this->getEndDateAndTime() || $this->getEndDateAndTime() > $now);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $backendUserGroups
|
||||
*/
|
||||
public function setBackendUserGroups($backendUserGroups)
|
||||
{
|
||||
$this->backendUserGroups = $backendUserGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
|
||||
*/
|
||||
public function getBackendUserGroups()
|
||||
{
|
||||
return $this->backendUserGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is currently logged in
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCurrentlyLoggedIn()
|
||||
{
|
||||
return $this->getUid() === (int)$this->getBackendUser()->user['uid'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the currently logged in backend user
|
||||
*
|
||||
* @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
|
||||
*/
|
||||
public function getBackendUser()
|
||||
{
|
||||
return $GLOBALS['BE_USER'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Domain\Model;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Extbase\Annotation as Extbase;
|
||||
|
||||
/**
|
||||
* Model for backend user group
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class BackendUserGroup extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $hidden;
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Beuser\Domain\Model\BackendUserGroup>
|
||||
* @Extbase\ORM\Lazy
|
||||
*/
|
||||
protected $subGroups;
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $description
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $hidden
|
||||
*/
|
||||
public function setHidden($hidden)
|
||||
{
|
||||
$this->hidden = $hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getHidden()
|
||||
{
|
||||
return $this->hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $subGroups
|
||||
*/
|
||||
public function setSubGroups($subGroups)
|
||||
{
|
||||
$this->subGroups = $subGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
|
||||
*/
|
||||
public function getSubGroups()
|
||||
{
|
||||
return $this->subGroups;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Domain\Model;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Demand filter for listings
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class Demand extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const ALL = 0;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const USERTYPE_ADMINONLY = 1;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const USERTYPE_USERONLY = 2;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const STATUS_ACTIVE = 1;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const STATUS_INACTIVE = 2;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const LOGIN_SOME = 1;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
const LOGIN_NONE = 2;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $userName = '';
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $userType = self::ALL;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $status = self::ALL;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $logins = 0;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $backendUserGroup = 0;
|
||||
|
||||
/**
|
||||
* @param string $userName
|
||||
*/
|
||||
public function setUserName($userName)
|
||||
{
|
||||
$this->userName = $userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUserName()
|
||||
{
|
||||
return $this->userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $userType
|
||||
*/
|
||||
public function setUserType($userType)
|
||||
{
|
||||
$this->userType = $userType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getUserType()
|
||||
{
|
||||
return $this->userType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $status
|
||||
*/
|
||||
public function setStatus($status)
|
||||
{
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $logins
|
||||
*/
|
||||
public function setLogins($logins)
|
||||
{
|
||||
$this->logins = $logins;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getLogins()
|
||||
{
|
||||
return $this->logins;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $backendUserGroup
|
||||
*/
|
||||
public function setBackendUserGroup($backendUserGroup)
|
||||
{
|
||||
$this->backendUserGroup = $backendUserGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getBackendUserGroup()
|
||||
{
|
||||
return $this->backendUserGroup;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Domain\Model;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module data object
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class ModuleData
|
||||
{
|
||||
/**
|
||||
* @var \TYPO3\CMS\Beuser\Domain\Model\Demand
|
||||
*/
|
||||
protected $demand;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $compareUserList = [];
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Beuser\Domain\Model\Demand $demand
|
||||
*/
|
||||
public function injectDemand(\TYPO3\CMS\Beuser\Domain\Model\Demand $demand)
|
||||
{
|
||||
$this->demand = $demand;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \TYPO3\CMS\Beuser\Domain\Model\Demand
|
||||
*/
|
||||
public function getDemand()
|
||||
{
|
||||
return $this->demand;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Beuser\Domain\Model\Demand $demand
|
||||
*/
|
||||
public function setDemand(\TYPO3\CMS\Beuser\Domain\Model\Demand $demand)
|
||||
{
|
||||
$this->demand = $demand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the compare list as array of user uis
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCompareUserList()
|
||||
{
|
||||
return array_keys($this->compareUserList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds one backend user (by uid) to the compare user list
|
||||
* Cannot be ObjectStorage, must be array
|
||||
*
|
||||
* @param int $uid
|
||||
*/
|
||||
public function attachUidCompareUser($uid)
|
||||
{
|
||||
$this->compareUserList[$uid] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Strip one backend user from the compare user list
|
||||
*
|
||||
* @param int $uid
|
||||
*/
|
||||
public function detachUidCompareUser($uid)
|
||||
{
|
||||
unset($this->compareUserList[$uid]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Domain\Repository;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Repository for \TYPO3\CMS\Beuser\Domain\Model\BackendUserGroup
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class BackendUserGroupRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
|
||||
{
|
||||
/**
|
||||
* @var array Default order is by title ascending
|
||||
*/
|
||||
protected $defaultOrderings = [
|
||||
'title' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
|
||||
];
|
||||
|
||||
/**
|
||||
* Overwrite createQuery to don't respect enable fields
|
||||
*
|
||||
* @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
|
||||
*/
|
||||
public function createQuery()
|
||||
{
|
||||
$query = parent::createQuery();
|
||||
$query->getQuerySettings()->setIgnoreEnableFields(true);
|
||||
return $query;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Domain\Repository;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Beuser\Domain\Model\Demand;
|
||||
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Session\Backend\SessionBackendInterface;
|
||||
use TYPO3\CMS\Core\Session\SessionManager;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Core\Utility\MathUtility;
|
||||
use TYPO3\CMS\Extbase\Domain\Repository\BackendUserGroupRepository;
|
||||
use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult;
|
||||
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
|
||||
|
||||
/**
|
||||
* Repository for \TYPO3\CMS\Beuser\Domain\Model\BackendUser
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class BackendUserRepository extends BackendUserGroupRepository
|
||||
{
|
||||
/**
|
||||
* Finds Backend Users on a given list of uids
|
||||
*
|
||||
* @param array $uidList
|
||||
* @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult<\TYPO3\CMS\Beuser\Domain\Model\BackendUser>
|
||||
*/
|
||||
public function findByUidList(array $uidList)
|
||||
{
|
||||
$query = $this->createQuery();
|
||||
$query->matching($query->in('uid', array_map('intval', $uidList)));
|
||||
/** @var QueryResult $result */
|
||||
$result = $query->execute();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find Backend Users matching to Demand object properties
|
||||
*
|
||||
* @param Demand $demand
|
||||
* @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult<\TYPO3\CMS\Beuser\Domain\Model\BackendUser>
|
||||
*/
|
||||
public function findDemanded(Demand $demand)
|
||||
{
|
||||
$constraints = [];
|
||||
$query = $this->createQuery();
|
||||
// Find invisible as well, but not deleted
|
||||
$constraints[] = $query->equals('deleted', 0);
|
||||
$query->setOrderings(['userName' => QueryInterface::ORDER_ASCENDING]);
|
||||
// Username
|
||||
if ($demand->getUserName() !== '') {
|
||||
$searchConstraints = [];
|
||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('be_users');
|
||||
foreach (['userName', 'realName'] as $field) {
|
||||
$searchConstraints[] = $query->like(
|
||||
$field,
|
||||
'%' . $queryBuilder->escapeLikeWildcards($demand->getUserName()) . '%'
|
||||
);
|
||||
}
|
||||
if (MathUtility::canBeInterpretedAsInteger($demand->getUserName())) {
|
||||
$searchConstraints[] = $query->equals('uid', (int)$demand->getUserName());
|
||||
}
|
||||
$constraints[] = $query->logicalOr($searchConstraints);
|
||||
}
|
||||
// Only display admin users
|
||||
if ($demand->getUserType() == Demand::USERTYPE_ADMINONLY) {
|
||||
$constraints[] = $query->equals('admin', 1);
|
||||
}
|
||||
// Only display non-admin users
|
||||
if ($demand->getUserType() == Demand::USERTYPE_USERONLY) {
|
||||
$constraints[] = $query->equals('admin', 0);
|
||||
}
|
||||
// Only display active users
|
||||
if ($demand->getStatus() == Demand::STATUS_ACTIVE) {
|
||||
$constraints[] = $query->equals('disable', 0);
|
||||
}
|
||||
// Only display in-active users
|
||||
if ($demand->getStatus() == Demand::STATUS_INACTIVE) {
|
||||
$constraints[] = $query->logicalOr($query->equals('disable', 1));
|
||||
}
|
||||
// Not logged in before
|
||||
if ($demand->getLogins() == Demand::LOGIN_NONE) {
|
||||
$constraints[] = $query->equals('lastlogin', 0);
|
||||
}
|
||||
// At least one login
|
||||
if ($demand->getLogins() == Demand::LOGIN_SOME) {
|
||||
$constraints[] = $query->logicalNot($query->equals('lastlogin', 0));
|
||||
}
|
||||
// In backend user group
|
||||
// @TODO: Refactor for real n:m relations
|
||||
if ($demand->getBackendUserGroup()) {
|
||||
$constraints[] = $query->logicalOr([
|
||||
$query->equals('usergroup', (int)$demand->getBackendUserGroup()),
|
||||
$query->like('usergroup', (int)$demand->getBackendUserGroup() . ',%'),
|
||||
$query->like('usergroup', '%,' . (int)$demand->getBackendUserGroup()),
|
||||
$query->like('usergroup', '%,' . (int)$demand->getBackendUserGroup() . ',%')
|
||||
]);
|
||||
}
|
||||
$query->matching($query->logicalAnd($constraints));
|
||||
/** @var QueryResult $result */
|
||||
$result = $query->execute();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find Backend Users currently online
|
||||
*
|
||||
* @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult<\TYPO3\CMS\Beuser\Domain\Model\BackendUser>
|
||||
*/
|
||||
public function findOnline()
|
||||
{
|
||||
$uids = [];
|
||||
foreach ($this->getSessionBackend()->getAll() as $sessionRecord) {
|
||||
if (isset($sessionRecord['ses_userid']) && !in_array($sessionRecord['ses_userid'], $uids, true)) {
|
||||
$uids[] = $sessionRecord['ses_userid'];
|
||||
}
|
||||
}
|
||||
|
||||
$query = $this->createQuery();
|
||||
$query->matching($query->in('uid', $uids));
|
||||
/** @var QueryResult $result */
|
||||
$result = $query->execute();
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrite createQuery to don't respect enable fields
|
||||
*
|
||||
* @return QueryInterface
|
||||
*/
|
||||
public function createQuery()
|
||||
{
|
||||
$query = parent::createQuery();
|
||||
$query->getQuerySettings()->setIgnoreEnableFields(true);
|
||||
$query->getQuerySettings()->setIncludeDeleted(true);
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SessionBackendInterface
|
||||
*/
|
||||
protected function getSessionBackend()
|
||||
{
|
||||
$loginType = $this->getBackendUserAuthentication()->getLoginType();
|
||||
return GeneralUtility::makeInstance(SessionManager::class)->getSessionBackend($loginType);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BackendUserAuthentication
|
||||
*/
|
||||
protected function getBackendUserAuthentication()
|
||||
{
|
||||
return $GLOBALS['BE_USER'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Domain\Repository;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Beuser\Domain\Model\BackendUser;
|
||||
use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
|
||||
use TYPO3\CMS\Core\Session\Backend\SessionBackendInterface;
|
||||
use TYPO3\CMS\Core\Session\SessionManager;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\Persistence\Repository;
|
||||
|
||||
/**
|
||||
* Repository for \TYPO3\CMS\Extbase\Domain\Model\BackendUser
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class BackendUserSessionRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Find all active sessions for all backend users
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function findAllActive()
|
||||
{
|
||||
$sessionBackend = $this->getSessionBackend();
|
||||
$allSessions = $sessionBackend->getAll();
|
||||
|
||||
// Map array to correct keys
|
||||
$allSessions = array_map(
|
||||
function ($session) {
|
||||
return [
|
||||
'id' => $session['ses_id'], // this is the hashed sessionId
|
||||
'ip' => $session['ses_iplock'],
|
||||
'timestamp' => $session['ses_tstamp'],
|
||||
'ses_userid' => $session['ses_userid']
|
||||
];
|
||||
},
|
||||
$allSessions
|
||||
);
|
||||
|
||||
// Sort by timestamp
|
||||
usort($allSessions, function ($session1, $session2) {
|
||||
return $session1['timestamp'] <=> $session2['timestamp'];
|
||||
});
|
||||
|
||||
return $allSessions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find Sessions for specific BackendUser
|
||||
*
|
||||
* @param BackendUser $backendUser
|
||||
* @return array
|
||||
*/
|
||||
public function findByBackendUser(BackendUser $backendUser)
|
||||
{
|
||||
$allActive = $this->findAllActive();
|
||||
|
||||
return array_filter(
|
||||
$allActive,
|
||||
function ($session) use ($backendUser) {
|
||||
return (int)$session['ses_userid'] === $backendUser->getUid();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update current session to move back to the original user.
|
||||
*
|
||||
* @param AbstractUserAuthentication $authentication
|
||||
*/
|
||||
public function switchBackToOriginalUser(AbstractUserAuthentication $authentication)
|
||||
{
|
||||
$sessionBackend = $this->getSessionBackend();
|
||||
$sessionId = $this->getBackendSessionId();
|
||||
$sessionBackend->update(
|
||||
$sessionId,
|
||||
[
|
||||
'ses_userid' => $authentication->user['ses_backuserid'],
|
||||
'ses_backuserid' => 0
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getBackendSessionId(): string
|
||||
{
|
||||
return $GLOBALS['BE_USER']->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SessionBackendInterface
|
||||
*/
|
||||
protected function getSessionBackend(): SessionBackendInterface
|
||||
{
|
||||
return GeneralUtility::makeInstance(SessionManager::class)->getSessionBackend('BE');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Core\Exception as CoreException;
|
||||
|
||||
/**
|
||||
* Generic Beuser exception
|
||||
* @internal
|
||||
*/
|
||||
class Exception extends CoreException
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Hook;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Backend\Controller\BackendController;
|
||||
use TYPO3\CMS\Core\Page\PageRenderer;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* This class adds Access-permission related JavaScript to the backend
|
||||
* @internal This class is a TYPO3 core-internal hook implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class BackendControllerHook
|
||||
{
|
||||
/**
|
||||
* Adds beuser permission specific JavaScript
|
||||
*
|
||||
* @param array $configuration
|
||||
* @param BackendController $backendController
|
||||
*/
|
||||
public function addJavaScript(array $configuration, BackendController $backendController)
|
||||
{
|
||||
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
|
||||
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
|
||||
$this->getPageRenderer()->addInlineSetting('AccessPermissions', 'moduleUrl', (string)$uriBuilder->buildUriFromRoute('system_BeuserTxPermission'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PageRenderer
|
||||
*/
|
||||
protected function getPageRenderer()
|
||||
{
|
||||
return GeneralUtility::makeInstance(PageRenderer::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Hook;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
|
||||
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Core\Utility\HttpUtility;
|
||||
|
||||
/**
|
||||
* Backend user switchback, for logoff_pre_processing hook within
|
||||
* \TYPO3\CMS\Core\Authentication\AbstractUserAuthentication class
|
||||
* @internal This class is a TYPO3 core-internal hook implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class SwitchBackUserHook
|
||||
{
|
||||
/**
|
||||
* Switch backend user session.
|
||||
*
|
||||
* @param array $params
|
||||
* @param AbstractUserAuthentication $authentication
|
||||
* @see AbstractUserAuthentication
|
||||
*/
|
||||
public function switchBack($params, AbstractUserAuthentication $authentication)
|
||||
{
|
||||
if ($this->isAHandledBackendSession($authentication)) {
|
||||
$objectManager = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
|
||||
$backendUserSessionRepository = $objectManager->get(\TYPO3\CMS\Beuser\Domain\Repository\BackendUserSessionRepository::class);
|
||||
$backendUserSessionRepository->switchBackToOriginalUser($authentication);
|
||||
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
|
||||
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
|
||||
HttpUtility::redirect((string)$uriBuilder->buildUriFromRoute('main'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given authentication object is a backend session and
|
||||
* contains all necessary information to allow switching.
|
||||
*
|
||||
* @param AbstractUserAuthentication $authentication
|
||||
* @return bool
|
||||
*/
|
||||
protected function isAHandledBackendSession(AbstractUserAuthentication $authentication)
|
||||
{
|
||||
return ($authentication instanceof BackendUserAuthentication)
|
||||
&& is_array($authentication->user)
|
||||
&& (int)$authentication->user['uid'] > 0
|
||||
&& (int)$authentication->user['ses_backuserid'] > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\Service;
|
||||
|
||||
use TYPO3\CMS\Beuser\Domain\Model\Demand;
|
||||
use TYPO3\CMS\Beuser\Domain\Model\ModuleData;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module data storage service.
|
||||
* Used to store and retrieve module state (eg. checkboxes, selections).
|
||||
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.
|
||||
*/
|
||||
class ModuleDataStorageService implements \TYPO3\CMS\Core\SingletonInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
const KEY = 'tx_beuser';
|
||||
|
||||
/**
|
||||
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
|
||||
*/
|
||||
protected $objectManager;
|
||||
|
||||
/**
|
||||
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
|
||||
*/
|
||||
public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
|
||||
{
|
||||
$this->objectManager = $objectManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads module data for user settings or returns a fresh object if module data is invalid or unset
|
||||
*
|
||||
* @return \TYPO3\CMS\Beuser\Domain\Model\ModuleData
|
||||
*/
|
||||
public function loadModuleData()
|
||||
{
|
||||
$moduleData = $GLOBALS['BE_USER']->getModuleData(self::KEY) ?? '';
|
||||
if ($moduleData !== '') {
|
||||
$moduleData = @unserialize($moduleData, ['allowed_classes' => [ModuleData::class, Demand::class]]);
|
||||
if ($moduleData instanceof ModuleData) {
|
||||
return $moduleData;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->objectManager->get(ModuleData::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Persists serialized module data to user settings
|
||||
*
|
||||
* @param \TYPO3\CMS\Beuser\Domain\Model\ModuleData $moduleData
|
||||
*/
|
||||
public function persistModuleData(\TYPO3\CMS\Beuser\Domain\Model\ModuleData $moduleData)
|
||||
{
|
||||
$GLOBALS['BE_USER']->pushModuleData(self::KEY, serialize($moduleData));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\ViewHelpers;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Beuser\Exception;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Get a value from an array by given key.
|
||||
* @internal
|
||||
*/
|
||||
class ArrayElementViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Initializes the arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('array', 'array', 'Array to search in', true);
|
||||
$this->registerArgument('key', 'string', 'Key to return its value', true);
|
||||
$this->registerArgument('subKey', 'string', 'If result of key access is an array, subkey can be used to fetch an element from this again', false, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array element by key. Accessed values must be scalar (string, int, float or double)
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @throws Exception
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
$array = $arguments['array'];
|
||||
$key = $arguments['key'];
|
||||
$subKey = $arguments['subKey'];
|
||||
$result = '';
|
||||
if (is_array($array) && isset($array[$key])) {
|
||||
$result = $array[$key];
|
||||
if (is_array($result) && $subKey && isset($result[$subKey])) {
|
||||
$result = $result[$subKey];
|
||||
}
|
||||
}
|
||||
if (!is_scalar($result)) {
|
||||
throw new Exception('Only scalar return values (string, int, float or double) are supported.', 1382284105);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\ViewHelpers\Display;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Core\Database\Connection;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Converts comma separated list of pages uids to html unordered list (<ul>) with speaking titles
|
||||
* @internal
|
||||
*/
|
||||
class PagesViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* As this ViewHelper renders HTML, the output must not be escaped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $escapeOutput = false;
|
||||
|
||||
/**
|
||||
* Initializes the arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('uids', 'string', '', false, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Render unordered list for pages
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
$uids = $arguments['uids'];
|
||||
if (!$uids) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$content = '';
|
||||
|
||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
|
||||
$queryBuilder->getRestrictions()->removeAll();
|
||||
|
||||
$res = $queryBuilder
|
||||
->select('uid', 'title')
|
||||
->from('pages')
|
||||
->where(
|
||||
$queryBuilder->expr()->in(
|
||||
'uid',
|
||||
$queryBuilder->createNamedParameter(
|
||||
GeneralUtility::intExplode(',', $uids),
|
||||
Connection::PARAM_INT_ARRAY
|
||||
)
|
||||
)
|
||||
)
|
||||
->orderBy('uid', 'ASC')
|
||||
->execute();
|
||||
|
||||
while ($row = $res->fetch()) {
|
||||
$content .= '<li>' . htmlspecialchars($row['title']) . ' [' . htmlspecialchars($row['uid']) . ']</li>';
|
||||
}
|
||||
return '<ul>' . $content . '</ul>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\ViewHelpers\Display;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Core\Database\Connection;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Converts comma separated list of sys_filemounts uids to html unordered list (<ul>) with speaking titles
|
||||
* @internal
|
||||
*/
|
||||
class SysFileMountsViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* As this ViewHelper renders HTML, the output must not be escaped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $escapeOutput = false;
|
||||
|
||||
/**
|
||||
* Initializes the arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('uids', 'string', '', false, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Render unordered list for sys_filemounts
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
$uids = $arguments['uids'];
|
||||
if (!$uids) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$content = '';
|
||||
|
||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_filemounts');
|
||||
$queryBuilder->getRestrictions()->removeAll();
|
||||
|
||||
$res = $queryBuilder
|
||||
->select('uid', 'title')
|
||||
->from('sys_filemounts')
|
||||
->where(
|
||||
$queryBuilder->expr()->in(
|
||||
'uid',
|
||||
$queryBuilder->createNamedParameter(
|
||||
GeneralUtility::intExplode(',', $uids),
|
||||
Connection::PARAM_INT_ARRAY
|
||||
)
|
||||
)
|
||||
)
|
||||
->orderBy('title', 'ASC')
|
||||
->execute();
|
||||
|
||||
while ($row = $res->fetch()) {
|
||||
$content .= '<li>' . htmlspecialchars($row['title']) . ' [' . htmlspecialchars($row['uid']) . ']</li>';
|
||||
}
|
||||
return '<ul>' . $content . '</ul>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\ViewHelpers\Display;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Core\Database\Connection;
|
||||
use TYPO3\CMS\Core\Database\ConnectionPool;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Converts comma separated list of sys_language uids to html unordered list (<ul>) with speaking titles
|
||||
* @internal
|
||||
*/
|
||||
class SysLanguageViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* As this ViewHelper renders HTML, the output must not be escaped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $escapeOutput = false;
|
||||
|
||||
/**
|
||||
* Initializes the arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('uids', 'string', '', false, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Render unordered list for sys_language
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
$uids = $arguments['uids'];
|
||||
if (!$uids) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$content = '';
|
||||
|
||||
$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_language');
|
||||
$queryBuilder->getRestrictions()->removeAll();
|
||||
|
||||
$res = $queryBuilder
|
||||
->select('uid', 'title', 'flag')
|
||||
->from('sys_language')
|
||||
->where(
|
||||
$queryBuilder->expr()->in(
|
||||
'uid',
|
||||
$queryBuilder->createNamedParameter(
|
||||
GeneralUtility::intExplode(',', $uids),
|
||||
Connection::PARAM_INT_ARRAY
|
||||
)
|
||||
)
|
||||
)
|
||||
->orderBy('sorting')
|
||||
->execute();
|
||||
|
||||
while ($row = $res->fetch()) {
|
||||
$content .= '<li>' . htmlspecialchars($row['title']) . ' [' . htmlspecialchars($row['uid']) . ']</li>';
|
||||
}
|
||||
return '<ul>' . $content . '</ul>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\ViewHelpers;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Render a link to DataHandler command
|
||||
* @internal
|
||||
*/
|
||||
class IssueCommandViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Initializes the arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('parameters', 'string', 'Is a set of GET params to send to route tce_db (SimpleDataHandlerController). Example: "&cmd[tt_content][123][move]=456" or "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World', true);
|
||||
$this->registerArgument('redirectUrl', 'string', 'Redirect URL if any other that \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv(\'REQUEST_URI\') is preferred', false, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a URL with a command to TYPO3 Core Engine - DataHandler (route tce_db)
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
*
|
||||
* @return string URL to tce_db + parameters
|
||||
* @see \TYPO3\CMS\Backend\Utility\BackendUtility::getLinkToDataHandlerAction()
|
||||
*/
|
||||
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
$urlParameters = [
|
||||
'redirect' => $arguments['redirectUrl'] ?: GeneralUtility::getIndpEnv('REQUEST_URI')
|
||||
];
|
||||
if (isset($arguments['parameters'])) {
|
||||
$parametersArray = GeneralUtility::explodeUrl2Array($arguments['parameters']);
|
||||
$urlParameters += $parametersArray;
|
||||
}
|
||||
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
|
||||
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
|
||||
return (string)$uriBuilder->buildUriFromRoute('tce_db', $urlParameters);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\ViewHelpers;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Render permission icon group (user / group / others) of the "Access" module.
|
||||
*
|
||||
* Most of that could be done in fluid directly, but this ViewHelper
|
||||
* is much better performance wise.
|
||||
* @internal
|
||||
*/
|
||||
class PermissionsViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* As this ViewHelper renders HTML, the output must not be escaped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $escapeOutput = false;
|
||||
|
||||
/**
|
||||
* @var array Cached labels for a single permission mask like "Delete page"
|
||||
*/
|
||||
protected static $permissionLabels = [];
|
||||
|
||||
/**
|
||||
* Initializes the arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('permission', 'int', 'Current permission', true);
|
||||
$this->registerArgument('scope', 'string', '"user" / "group" / "everybody"', true);
|
||||
$this->registerArgument('pageId', 'int', '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return permissions.
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
* @return string
|
||||
* @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception
|
||||
*/
|
||||
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
$masks = [1, 16, 2, 4, 8];
|
||||
|
||||
if (empty(static::$permissionLabels)) {
|
||||
foreach ($masks as $mask) {
|
||||
static::$permissionLabels[$mask] = LocalizationUtility::translate(
|
||||
'LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:' . $mask,
|
||||
'be_user'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$icon = '';
|
||||
foreach ($masks as $mask) {
|
||||
if ($arguments['permission'] & $mask) {
|
||||
$permissionClass = 'fa-check text-success';
|
||||
$mode = 'delete';
|
||||
} else {
|
||||
$permissionClass = 'fa-times text-danger';
|
||||
$mode = 'add';
|
||||
}
|
||||
|
||||
$label = static::$permissionLabels[$mask];
|
||||
$icon .= '<span style="cursor:pointer"'
|
||||
. ' title="' . htmlspecialchars($label) . '"'
|
||||
. ' data-toggle="tooltip"'
|
||||
. ' data-page="' . htmlspecialchars($arguments['pageId']) . '"'
|
||||
. ' data-permissions="' . htmlspecialchars($arguments['permission']) . '"'
|
||||
. ' data-who="' . htmlspecialchars($arguments['scope']) . '"'
|
||||
. ' data-bits="' . htmlspecialchars($mask) . '"'
|
||||
. ' data-mode="' . htmlspecialchars($mode) . '"'
|
||||
. ' class="t3-icon change-permission fa ' . htmlspecialchars($permissionClass) . '"></span>';
|
||||
}
|
||||
|
||||
return '<span id="' . htmlspecialchars($arguments['pageId'] . '_' . $arguments['scope']) . '">' . $icon . '</span>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\ViewHelpers;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Backend\Routing\UriBuilder;
|
||||
use TYPO3\CMS\Beuser\Domain\Model\BackendUser;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Renders 'Delete user' link
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class RemoveUserViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Initializes the arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('backendUser', BackendUser::class, 'Target backendUser to switch active session to', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the URL to remove a user.
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
$urlParameters = [
|
||||
'cmd[be_users][' . $arguments['backendUser']->getUid() . '][delete]' => 1,
|
||||
'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI')
|
||||
];
|
||||
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
|
||||
return (string)$uriBuilder->buildUriFromRoute('tce_db', $urlParameters);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\ViewHelpers;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Core\Imaging\Icon;
|
||||
use TYPO3\CMS\Core\Imaging\IconFactory;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\Domain\Model\BackendUser;
|
||||
use TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
|
||||
/**
|
||||
* Views sprite icon for a record (object)
|
||||
* @internal
|
||||
*/
|
||||
class SpriteIconForRecordViewHelper extends AbstractBackendViewHelper
|
||||
{
|
||||
/**
|
||||
* As this ViewHelper renders HTML, the output must not be escaped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $escapeOutput = false;
|
||||
|
||||
/**
|
||||
* Initializes the arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
parent::initializeArguments();
|
||||
$this->registerArgument('table', 'string', '', true);
|
||||
$this->registerArgument('object', 'object', '', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays spriteIcon for database table and object
|
||||
*
|
||||
* @return string
|
||||
* @see IconFactory::getIconForRecord()
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return static::renderStatic($this->arguments, $this->buildRenderChildrenClosure(), $this->renderingContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
*
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
$object = $arguments['object'];
|
||||
$table = $arguments['table'];
|
||||
|
||||
if (!is_object($object) || !method_exists($object, 'getUid')) {
|
||||
return '';
|
||||
}
|
||||
$row = [
|
||||
'uid' => $object->getUid(),
|
||||
'startTime' => false,
|
||||
'endTime' => false
|
||||
];
|
||||
if (method_exists($object, 'getIsDisabled')) {
|
||||
$row['disable'] = $object->getIsDisabled();
|
||||
}
|
||||
if (method_exists($object, 'getHidden')) {
|
||||
$row['hidden'] = $object->getHidden();
|
||||
}
|
||||
if ($table === 'be_users' && $object instanceof BackendUser) {
|
||||
$row['admin'] = $object->getIsAdministrator();
|
||||
}
|
||||
if (method_exists($object, 'getStartDateAndTime')) {
|
||||
$row['startTime'] = $object->getStartDateAndTime();
|
||||
}
|
||||
if (method_exists($object, 'getEndDateAndTime')) {
|
||||
$row['endTime'] = $object->getEndDateAndTime();
|
||||
}
|
||||
/** @var IconFactory $iconFactory */
|
||||
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
|
||||
return $iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace TYPO3\CMS\Beuser\ViewHelpers;
|
||||
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
use TYPO3\CMS\Beuser\Domain\Model\BackendUser;
|
||||
use TYPO3\CMS\Core\Imaging\Icon;
|
||||
use TYPO3\CMS\Core\Imaging\IconFactory;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
|
||||
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
||||
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* Displays 'SwitchUser' link with sprite icon to change current backend user to target (non-admin) backendUser
|
||||
* @internal
|
||||
*/
|
||||
class SwitchUserViewHelper extends AbstractViewHelper
|
||||
{
|
||||
use CompileWithRenderStatic;
|
||||
|
||||
/**
|
||||
* As this ViewHelper renders HTML, the output must not be escaped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $escapeOutput = false;
|
||||
|
||||
/**
|
||||
* Initializes the arguments
|
||||
*/
|
||||
public function initializeArguments()
|
||||
{
|
||||
$this->registerArgument('backendUser', BackendUser::class, 'Target backendUser to switch active session to', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render link with sprite icon to change current backend user to target
|
||||
*
|
||||
* @param array $arguments
|
||||
* @param \Closure $renderChildrenClosure
|
||||
* @param RenderingContextInterface $renderingContext
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
|
||||
{
|
||||
$backendUser = $arguments['backendUser'];
|
||||
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
|
||||
if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid'] || !$backendUser->isActive() || $GLOBALS['BE_USER']->user['ses_backuserid']) {
|
||||
return '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
|
||||
}
|
||||
$title = LocalizationUtility::translate('switchBackMode', 'beuser');
|
||||
return '<a class="btn btn-default" href="' .
|
||||
htmlspecialchars(GeneralUtility::linkThisScript(['SwitchUser' => $backendUser->getUid()])) .
|
||||
'" target="_top" title="' . htmlspecialchars($title) . '">' .
|
||||
$iconFactory->getIcon('actions-system-backend-user-switch', Icon::SIZE_SMALL)->render() . '</a>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Definitions for routes provided by EXT:beuser
|
||||
*/
|
||||
return [
|
||||
// Dispatch the permissions actions
|
||||
'user_access_permissions' => [
|
||||
'path' => '/users/access/permissions',
|
||||
'target' => \TYPO3\CMS\Beuser\Controller\PermissionAjaxController::class . '::dispatch'
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,36 @@
|
||||
// Model/table mapping
|
||||
config.tx_extbase.persistence.classes {
|
||||
TYPO3\CMS\Beuser\Domain\Model\BackendUser {
|
||||
mapping {
|
||||
tableName = be_users
|
||||
columns {
|
||||
allowed_languages.mapOnProperty = allowedLanguages
|
||||
file_mountpoints.mapOnProperty = fileMountPoints
|
||||
db_mountpoints.mapOnProperty = dbMountPoints
|
||||
usergroup.mapOnProperty = backendUserGroups
|
||||
}
|
||||
}
|
||||
}
|
||||
TYPO3\CMS\Beuser\Domain\Model\BackendUserGroup {
|
||||
mapping {
|
||||
tableName = be_groups
|
||||
columns {
|
||||
subgroup.mapOnProperty = subGroups
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.tx_beuser {
|
||||
persistence {
|
||||
storagePid = 0
|
||||
}
|
||||
|
||||
settings {
|
||||
// This is a dummy entry. It is used in \TYPO3\CMS\Beuser\Controller\BackendUserController
|
||||
// to test that some TypoScript configuration is set.
|
||||
// This entry can be removed if extbase setup is made frontend TS independent
|
||||
// or if there are other settings set.
|
||||
dummy = foo
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,345 @@
|
||||
Some icons used in the TYPO3 project are retrieved from the "Silk" icon set of
|
||||
Mark James, which can be found at http://famfamfam.com/lab/icons/silk/. This
|
||||
set is distributed under a Creative Commons Attribution 2.5 License. The
|
||||
license can be found at http://creativecommons.org/licenses/by/2.5/.
|
||||
---------------------------------
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
|
||||
<file t3:id="1415814783" source-language="en" datatype="plaintext" original="EXT:beuser/Resources/Private/Language/locallang.xlf" date="2012-07-16T10:11:32Z" product-name="beuser">
|
||||
<header/>
|
||||
<body>
|
||||
<trans-unit id="activeSessions" resname="activeSessions">
|
||||
<source>Active Sessions</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="userName" resname="userName">
|
||||
<source>Username</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="realName" resname="realName">
|
||||
<source>Real Name</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="lastAccess" resname="lastAccess">
|
||||
<source>Last access</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="ipAddress" resname="ipAddress">
|
||||
<source>IP address</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="backendUserListing" resname="backendUserListing">
|
||||
<source>Backend User Listing</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="subGroups" resname="subGroups">
|
||||
<source>Sub Groups</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="email" resname="email">
|
||||
<source>Email</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="admin" resname="admin">
|
||||
<source>Admin</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="users" resname="users">
|
||||
<source>Users</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="yes" resname="yes">
|
||||
<source>Yes</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="no" resname="no">
|
||||
<source>No</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="never" resname="never">
|
||||
<source>Never</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="delete" resname="delete">
|
||||
<source>Delete backend user (!)</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="disable" resname="disable">
|
||||
<source>Disable</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="disable_compare" resname="disable_compare">
|
||||
<source>Is active?</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="startDateAndTime" resname="startDateAndTime">
|
||||
<source>Start</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="endDateAndTime" resname="endDateAndTime">
|
||||
<source>Stop</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="lastLogin" resname="lastLogin">
|
||||
<source>Last login</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="allowedLanguages" resname="allowedLanguages">
|
||||
<source>Limit to languages</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="dbMountPoints" resname="dbMountPoints">
|
||||
<source>DB mountpoints</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="fileMounts" resname="fileMounts">
|
||||
<source>File mountpoints</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="disableIpLock" resname="disableIpLock">
|
||||
<source>Disable IP lock</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="compareBackendUsers" resname="compareBackendUsers">
|
||||
<source>Compare backend users</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="compareUserList" resname="compareUserList">
|
||||
<source>Compare user list</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="status" resname="status">
|
||||
<source>Status</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="both" resname="both">
|
||||
<source>Both</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="any" resname="any">
|
||||
<source>Any</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="adminOnly" resname="adminOnly">
|
||||
<source>Admin only</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="normalUserOnly" resname="normalUserOnly">
|
||||
<source>Normal users only</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="activeOnly" resname="activeOnly">
|
||||
<source>Active only</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="inactiveOnly" resname="inactiveOnly">
|
||||
<source>Inactive only</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="loginBefore" resname="loginBefore">
|
||||
<source>Logged in before</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="neverLoggedIn" resname="neverLoggedIn">
|
||||
<source>Never logged in</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="filter" resname="filter">
|
||||
<source>Filter</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="reallyLogout" resname="reallyLogout">
|
||||
<source>Really logout</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="endSession" resname="endSession">
|
||||
<source>End session</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="backendUsers" resname="backendUsers">
|
||||
<source>Backend users</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="compareUsers" resname="compareUsers">
|
||||
<source>Compare backend users</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="backendUserGroupsMenu" resname="backendUserGroupsMenu">
|
||||
<source>Backend user groups</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="onlineUsers" resname="onlineUsers">
|
||||
<source>Online users</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="backendUserAdministration" resname="backendUserAdministration">
|
||||
<source>Backend User Administration</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="backendUserGroup" resname="backendUserGroup">
|
||||
<source>User group</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="backendUserGroups" resname="backendUserGroups">
|
||||
<source>Member of groups</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="changeToMode" resname="changeToMode">
|
||||
<source>[change-to mode]</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="switchBackMode" resname="switchBackMode">
|
||||
<source>Switch to user</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="confirm" resname="confirm">
|
||||
<source>Are you sure you want to delete this backend user %s?</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="section.compare" resname="section.compare">
|
||||
<source>Compare</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="compare" resname="compare">
|
||||
<source>Compare</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="terminateSessionSuccess" resname="terminateSessionSuccess">
|
||||
<source>Session successfully terminated.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="backendUserGroupListing" resname="backendUserGroupListing">
|
||||
<source>Backend User Group Listing</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="online" resname="online">
|
||||
<source>online</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="visibility.hide" resname="visibility.hide">
|
||||
<source>hide</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="visibility.unhide" resname="visibility.unhide">
|
||||
<source>unhide</source>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
|
||||
<file t3:id="1415814784" source-language="en" datatype="plaintext" original="EXT:beuser/Resources/Private/Language/locallang_mod.xlf" date="2012-02-06T16:10:22Z" product-name="beuser">
|
||||
<header/>
|
||||
<body>
|
||||
<trans-unit id="mlang_labels_tablabel" resname="mlang_labels_tablabel">
|
||||
<source>Backend Users</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mlang_labels_tabdescr" resname="mlang_labels_tabdescr">
|
||||
<source>Admin backend users</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mlang_tabs_tab" resname="mlang_tabs_tab">
|
||||
<source>Backend users</source>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xliff version="1.0" xmlns:t3="http://typo3.org/schemas/xliff">
|
||||
<file t3:id="1415814882" source-language="en" datatype="plaintext" original="EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf" date="2011-10-17T20:22:34Z" product-name="lang">
|
||||
<header/>
|
||||
<body>
|
||||
<trans-unit id="permissions" resname="permissions">
|
||||
<source>Permissions</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="ch_permissions" resname="ch_permissions">
|
||||
<source>Change permissions</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="Legend" resname="Legend">
|
||||
<source>Legend</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="Owner" resname="Owner">
|
||||
<source>Owner</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="Group" resname="Group">
|
||||
<source>Group</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="Everybody" resname="Everybody">
|
||||
<source>Everybody</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="EditLock" resname="EditLock">
|
||||
<source>Lock</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="EditLock_descr" resname="EditLock_descr">
|
||||
<source>Disable the »Admin-only« edit lock for this page. Currently this page and all content is locked for editing by all non-Admin users.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="EditLock_descr2" resname="EditLock_descr2">
|
||||
<source>Enable the »Admin-only« edit lock for this page</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="Save" resname="Save">
|
||||
<source>Save</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="Abort" resname="Abort">
|
||||
<source>Abort</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="Edit" resname="Edit">
|
||||
<source>EDIT</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="recursive" resname="recursive">
|
||||
<source>Set recursively</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="page_affected" resname="page_affected">
|
||||
<source>page affected</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="pages_affected" resname="pages_affected">
|
||||
<source>pages affected</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="user_overview" resname="user_overview">
|
||||
<source>User overview</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="Mode" resname="Mode">
|
||||
<source>Mode</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="Depth" resname="Depth">
|
||||
<source>Depth</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="level" resname="level">
|
||||
<source>level</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="levels" resname="levels">
|
||||
<source>levels</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="User" resname="User">
|
||||
<source>User</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="def" resname="def">
|
||||
<source>Definition: 'content' is records from all tables on a page - except from records from the table 'pages' (Pages).</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="A_Granted" resname="A_Granted">
|
||||
<source>Access Granted</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="A_Denied" resname="A_Denied">
|
||||
<source>Access Denied</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="1" resname="1">
|
||||
<source>Show page</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="16" resname="16">
|
||||
<source>Edit content</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="2" resname="2">
|
||||
<source>Edit page</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="4" resname="4">
|
||||
<source>Delete page</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="8" resname="8">
|
||||
<source>New pages</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="1_t" resname="1_t">
|
||||
<source>Show/Copy page and content.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="16_t" resname="16_t">
|
||||
<source>Change/Add/Delete/Move content.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="2_t" resname="2_t">
|
||||
<source>Change page eg. change pagetitle etc.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="4_t" resname="4_t">
|
||||
<source>Delete/Move page and content.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="8_t" resname="8_t">
|
||||
<source>Create new pages under this page.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mlang_labels_tablabel" resname="mlang_labels_tablabel">
|
||||
<source>Page editing permissions</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mlang_labels_tabdescr" resname="mlang_labels_tabdescr">
|
||||
<source>Setting of page permissions is vital for controlling backend user access to pages. You can assign a user and a group as owners of a page and set access permissions for each.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="mlang_tabs_tab" resname="mlang_tabs_tab">
|
||||
<source>Access</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="WorkspaceWarning" resname="WorkspaceWarning">
|
||||
<source>Workspace Warning</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="WorkspaceWarningText" resname="WorkspaceWarningText">
|
||||
<source>Permissions you set in the workspace are effective on the elements only after they are published! If you need to set permissions which are effective right now, you must do so in the Live workspace. (Permissions are always evaluated on the Live workspace record/placeholder of a draft version)</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="notSet" resname="notSet">
|
||||
<source>not set</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="deleted" resname="deleted">
|
||||
<source>deleted</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="noGroups" resname="noGroups">
|
||||
<source>No user groups exist.</source>
|
||||
</trans-unit>
|
||||
<trans-unit id="selectNone" resname="selectNone">
|
||||
<source> - none - </source>
|
||||
</trans-unit>
|
||||
<trans-unit id="selectUnchanged" resname="selectUnchanged">
|
||||
<source> - leave unchanged - </source>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
@@ -0,0 +1,28 @@
|
||||
<html
|
||||
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
|
||||
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
|
||||
data-namespace-typo3-fluid="true">
|
||||
|
||||
<be:moduleLayout>
|
||||
<f:be.pageRenderer
|
||||
includeRequireJsModules="{
|
||||
0:'TYPO3/CMS/Backend/ContextMenu',
|
||||
1:'TYPO3/CMS/Backend/Modal',
|
||||
2:'TYPO3/CMS/Beuser/BackendUserListing'
|
||||
}"
|
||||
/>
|
||||
|
||||
<be:moduleLayout.menu identifier="BackendUserModuleMenu">
|
||||
<be:moduleLayout.menuItem label="{f:translate(id: 'backendUsers')}" uri="{f:uri.action(controller: 'BackendUser', action: 'index')}"/>
|
||||
<be:moduleLayout.menuItem label="{f:translate(id: 'backendUserGroupsMenu')}" uri="{f:uri.action(controller: 'BackendUserGroup', action: 'index')}"/>
|
||||
<be:moduleLayout.menuItem label="{f:translate(id: 'onlineUsers')}" uri="{f:uri.action(controller: 'BackendUser', action: 'online')}"/>
|
||||
</be:moduleLayout.menu>
|
||||
|
||||
<f:render section="Buttons" />
|
||||
<be:moduleLayout.button.shortcutButton displayName="{f:translate(id: shortcutLabel)}" />
|
||||
|
||||
<f:render section="Content" />
|
||||
|
||||
</be:moduleLayout>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,2 @@
|
||||
<f:render section="headline" />
|
||||
<f:render section="content" />
|
||||
@@ -0,0 +1,93 @@
|
||||
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
|
||||
xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
|
||||
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
|
||||
xmlns:bu="http://typo3.org/ns/TYPO3/CMS/Beuser/ViewHelpers">
|
||||
|
||||
<f:section name="list_row">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="#" class="t3js-contextmenutrigger" data-table="be_users" data-uid="{backendUser.uid}" title="{f:if(condition: '{backendUser.description}', then: '{backendUser.description} ')}(id={backendUser.uid})">
|
||||
<be:avatar backendUser="{backendUser.uid}" showIcon="TRUE" />
|
||||
</a>
|
||||
</td>
|
||||
<td class="col-title">
|
||||
<be:link.editRecord table="be_users" uid="{backendUser.uid}" title="edit">
|
||||
<b>{backendUser.userName}</b>
|
||||
</be:link.editRecord>
|
||||
<f:if condition="{bu:arrayElement(array: onlineBackendUsers, key: backendUser.uid)}">
|
||||
<span class="label label-success"><f:translate key="online" /></span>
|
||||
</f:if>
|
||||
<br />
|
||||
<f:if condition="{backendUser.realName}">
|
||||
<be:link.editRecord table="be_users" uid="{backendUser.uid}" title="edit">
|
||||
{backendUser.realName}
|
||||
</be:link.editRecord>
|
||||
</f:if>
|
||||
</td>
|
||||
<td>
|
||||
<f:if condition="{backendUser.lastLoginDateAndTime}">
|
||||
<f:then>
|
||||
<f:format.date format="{dateFormat} {timeFormat}">{backendUser.lastLoginDateAndTime}</f:format.date>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<f:translate key="never" />
|
||||
</f:else>
|
||||
</f:if>
|
||||
</td>
|
||||
<td class="col-control">
|
||||
<div class="btn-group" role="group">
|
||||
<be:link.editRecord class="btn btn-default" table="be_users" uid="{backendUser.uid}" title="edit" >
|
||||
<core:icon identifier="actions-open" />
|
||||
</be:link.editRecord>
|
||||
<f:if condition="{backendUser.currentlyLoggedIn} == 1">
|
||||
<f:then>
|
||||
<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<f:if condition="{backendUser.isDisabled} == 1">
|
||||
<f:then>
|
||||
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{backendUser.uid}][disable]=0', redirectUrl: redirectUrl)}" title="{f:translate(key:'visibility.unhide')}"><core:icon identifier="actions-edit-unhide" /></a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{backendUser.uid}][disable]=1', redirectUrl: redirectUrl)}" title="{f:translate(key:'visibility.hide')}"><core:icon identifier="actions-edit-hide" /></a>
|
||||
</f:else>
|
||||
</f:if>
|
||||
</f:else>
|
||||
</f:if>
|
||||
<f:if condition="{currentUserUid} == {backendUser.uid}">
|
||||
<f:then>
|
||||
<span class="btn btn-default disabled"><core:icon identifier="empty-empty" /></span>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<a class="btn btn-default t3js-modal-trigger" href="{bu:removeUser(backendUser:backendUser)}"
|
||||
title="{f:translate(key:'LLL:EXT:beuser/Resources/Private/Language/locallang.xlf:delete')}"
|
||||
data-severity="warning"
|
||||
data-title="{f:translate(key:'LLL:EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf:label.confirm.delete_record.title')}"
|
||||
data-content="{f:translate(key:'confirm',arguments:'{0:backendUser.userName}')}"
|
||||
data-button-close-text="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}">
|
||||
<core:icon identifier="actions-edit-delete" />
|
||||
</a>
|
||||
</f:else>
|
||||
</f:if>
|
||||
</div>
|
||||
<div class="btn-group" role="group">
|
||||
<a class="btn btn-default" href="#" onclick="top.TYPO3.InfoWindow.showItem('be_users', '{backendUser.uid}'); return false;"><core:icon identifier="actions-document-info" /></a>
|
||||
</div>
|
||||
<div class="btn-group" role="group">
|
||||
<f:if condition="{compareUserUidList.{backendUser.uid}}">
|
||||
<f:then>
|
||||
<f:link.action action="removeFromCompareList" arguments="{uid: backendUser.uid}" class="btn btn-default">
|
||||
<core:icon identifier="actions-remove" size="small"/>
|
||||
<f:translate key="compare" />
|
||||
</f:link.action>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<f:link.action action="addToCompareList" arguments="{uid: backendUser.uid}" class="btn btn-default"><core:icon identifier="actions-add" size="small"/> <f:translate key="compare" /></f:link.action>
|
||||
</f:else>
|
||||
</f:if>
|
||||
<bu:SwitchUser backendUser="{backendUser}" />
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</f:section>
|
||||
</html>
|
||||
@@ -0,0 +1,49 @@
|
||||
{namespace be=TYPO3\CMS\Backend\ViewHelpers}
|
||||
{namespace bu=TYPO3\CMS\Beuser\ViewHelpers}
|
||||
<f:for each="{onlineUser.sessions}" as="session" iteration="it">
|
||||
<tr>
|
||||
<f:if condition="{it.isFirst}">
|
||||
<f:then>
|
||||
<td>
|
||||
<a href="#" class="t3js-contextmenutrigger" data-table="be_users" data-uid="{onlineUser.backendUser.uid}" title="{f:if(condition: '{onlineUser.backendUser.description}', then: '{onlineUser.backendUser.description} ')}(id={onlineUser.backendUser.uid})">
|
||||
<be:avatar backendUser="{onlineUser.backendUser.uid}" showIcon="true" />
|
||||
</a>
|
||||
</td>
|
||||
<td class="col-title">
|
||||
<b>{onlineUser.backendUser.userName}</b>
|
||||
<span class="label label-success"><f:translate key="online" /></span><br />
|
||||
{onlineUser.backendUser.realName}
|
||||
</td>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<td></td>
|
||||
<td class="col-title"></td>
|
||||
</f:else>
|
||||
</f:if>
|
||||
<td>
|
||||
<f:format.date format="{dateFormat} {timeFormat}" date="{session.timestamp}" />
|
||||
</td>
|
||||
<td>{session.ip}</td>
|
||||
<td class="col-control">
|
||||
<div class="btn-group" role="group">
|
||||
<f:if condition="{currentSessionId} == {session.id}">
|
||||
<f:else>
|
||||
<f:link.action
|
||||
class="btn btn-default t3js-modal-trigger"
|
||||
action="terminateBackendUserSession"
|
||||
controller="BackendUser"
|
||||
arguments="{backendUser: onlineUser.backendUser, sessionId: session.id}"
|
||||
data="{severity: 'warning', title: '{f:translate(key: \'endSession\')}', content: '{f:translate(key: \'reallyLogout\')} {onlineUser.backendUser.userName}?', button-close-text: '{f:translate(key: \'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel\')}'}"
|
||||
>
|
||||
<core:icon identifier="actions-close" />
|
||||
<f:translate key="endSession" />
|
||||
</f:link.action>
|
||||
</f:else>
|
||||
</f:if>
|
||||
<a class="btn btn-default" href="#" onclick="top.TYPO3.InfoWindow.showItem('be_users', '{onlineUser.backendUser.uid}'); return false;">
|
||||
<core:icon identifier="actions-document-info" />
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</f:for>
|
||||
@@ -0,0 +1,3 @@
|
||||
<f:be.widget.paginate objects="{backendUsers}" as="paginatedBackendUsers" configuration="{itemsPerPage: 50, insertBelow: 1}">
|
||||
<f:render partial="BackendUser/PaginatedListWidgetBody" arguments="{_all}" />
|
||||
</f:be.widget.paginate>
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<div class="table-fit">
|
||||
<table id="typo3-backend-user-list" class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class="col-title"><f:translate key="userName" /> / <f:translate key="realName" /></th>
|
||||
<th><f:translate key="lastLogin" /></th>
|
||||
<th class="col-control"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<f:for each="{paginatedBackendUsers}" as="backendUser">
|
||||
<f:render partial="BackendUser/IndexListRow" section="list_row" arguments="{demand: demand, backendUser: backendUser, onlineBackendUsers: onlineBackendUsers, dateFormat: dateFormat, timeFormat: timeFormat, compareUserUidList: compareUserUidList, currentUserUid: currentUserUid}" />
|
||||
</f:for>
|
||||
<f:comment>
|
||||
Footer row: no officially defined style yet
|
||||
</f:comment>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<f:count subject="{backendUsers}" /> <f:translate key="users" />
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,47 @@
|
||||
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
|
||||
xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
|
||||
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
|
||||
xmlns:bu="http://typo3.org/ns/TYPO3/CMS/Beuser/ViewHelpers">
|
||||
|
||||
<f:section name="list_row">
|
||||
<tr>
|
||||
<td class="col-icon">
|
||||
<a href="#" class="t3js-contextmenutrigger" data-table="be_groups" data-uid="{backendUserGroup.uid}" title="{f:if(condition: '{backendUserGroup.description}', then: '{backendUserGroup.description} ')}(id={backendUserGroup.uid})">
|
||||
<bu:spriteIconForRecord table="be_groups" object="{backendUserGroup}" />
|
||||
</a>
|
||||
</td>
|
||||
<td class="col-title">
|
||||
<be:link.editRecord table="be_groups" uid="{backendUserGroup.uid}" title="edit">
|
||||
<b>{backendUserGroup.title}</b><br />
|
||||
{backendUser.realName}
|
||||
</be:link.editRecord>
|
||||
</td>
|
||||
<td>
|
||||
<f:for each="{backendUserGroup.subgroups}" as="subgroup" iteration="subGroupIterator">
|
||||
<be:link.editRecord table="be_groups" uid="{subgroup.uid}" title="edit">
|
||||
{subgroup.title}
|
||||
</be:link.editRecord>
|
||||
<f:if condition="{subGroupIterator.isLast}"><f:else>, </f:else></f:if>
|
||||
</f:for>
|
||||
</td>
|
||||
<td class="col-control">
|
||||
<div class="btn-group" role="group">
|
||||
<be:link.editRecord class="btn btn-default" table="be_groups" uid="{backendUserGroup.uid}" title="edit">
|
||||
<core:icon identifier="actions-open" />
|
||||
</be:link.editRecord>
|
||||
<f:if condition="{backendUserGroup.hidden}">
|
||||
<f:then>
|
||||
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_groups][{backendUserGroup.uid}][hidden]=0', redirectUrl: redirectUrl)}" title="{f:translate(key:'visibility.unhide')}"><core:icon identifier="actions-edit-unhide" /></a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_groups][{backendUserGroup.uid}][hidden]=1', redirectUrl: redirectUrl)}" title="{f:translate(key:'visibility.hide')}"><core:icon identifier="actions-edit-hide" /></a>
|
||||
</f:else>
|
||||
</f:if>
|
||||
</div>
|
||||
<div class="btn-group" role="group">
|
||||
<a class="btn btn-default" href="#" onclick="top.TYPO3.InfoWindow.showItem('be_groups', '{backendUserGroup.uid}'); return false;"><core:icon identifier="actions-document-info" /></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</f:section>
|
||||
</html>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
<f:be.widget.paginate objects="{backendUserGroups}" as="paginatedBackendUserGroups" configuration="{itemsPerPage: 50, insertBelow: 1}">
|
||||
<f:render partial="BackendUserGroup/PaginatedListWidgetBody" arguments="{_all}" />
|
||||
</f:be.widget.paginate>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
<div class="table-fit">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-icon"></th>
|
||||
<th class="col-title"><f:translate key="backendUserGroup" /></th>
|
||||
<th><f:translate key="subGroups" /></th>
|
||||
<th class="col-control"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<f:for each="{paginatedBackendUserGroups}" as="backendUserGroup">
|
||||
<f:render partial="BackendUserGroup/IndexListRow" section="list_row" arguments="{demand: demand, backendUserGroup: backendUserGroup, dateFormat: dateFormat, timeFormat: timeFormat, currentUserUid: currentUserUid}" />
|
||||
</f:for>
|
||||
<f:comment>
|
||||
Footer row: no officially defined style yet
|
||||
</f:comment>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<f:count subject="{backendUserGroups}" /> <f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:be_groups" />s
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -0,0 +1,54 @@
|
||||
|
||||
<f:form action="index" objectName="demand" object="{demand}" class="form-inline form-inline-spaced">
|
||||
<div class="form-group">
|
||||
<label for="tx_Beuser_username"><f:translate key="userName">Username</f:translate></label>
|
||||
<div class="input-group">
|
||||
<f:form.textfield
|
||||
id="tx_Beuser_username"
|
||||
class="form-control input-sm"
|
||||
property="userName"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tx_Beuser_usertype"><f:translate key="admin">Admin</f:translate></label>
|
||||
<f:form.select
|
||||
id="tx_Beuser_usertype"
|
||||
class="form-control input-sm"
|
||||
property="userType"
|
||||
options="{0: '{f:translate(key:\"both\")}', 1: '{f:translate(key:\"adminOnly\")}', 2: '{f:translate(key:\"normalUserOnly\")}'}"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tx_Beuser_status"><f:translate key="status">Status</f:translate></label>
|
||||
<f:form.select
|
||||
id="tx_Beuser_status"
|
||||
class="form-control input-sm"
|
||||
property="status"
|
||||
options="{0: '{f:translate(key:\"both\")}', 1: '{f:translate(key:\"activeOnly\")}', 2: '{f:translate(key:\"inactiveOnly\")}'}"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tx_Beuser_logins"><f:translate key="login">Login</f:translate></label>
|
||||
<f:form.select
|
||||
id="tx_Beuser_logins"
|
||||
class="form-control input-sm"
|
||||
property="logins"
|
||||
options="{0: '{f:translate(key:\"both\")}', 1: '{f:translate(key:\"loginBefore\")}', 2: '{f:translate(key:\"neverLoggedIn\")}'}"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="tx_beuser_backendUserGroup"><f:translate key="backendUserGroup">User Group</f:translate></label>
|
||||
<f:form.select
|
||||
id="tx_beuser_backendUserGroup"
|
||||
class="form-control input-sm"
|
||||
property="backendUserGroup"
|
||||
options="{backendUserGroups}"
|
||||
optionLabelField="title"
|
||||
optionValueField="uid"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<f:form.submit value="{f:translate(key: 'filter')}" class="btn btn-default btn-sm" />
|
||||
</div>
|
||||
</f:form>
|
||||
@@ -0,0 +1,37 @@
|
||||
<span id="g_{pageId}">
|
||||
<a
|
||||
class="ug_selector changegroup"
|
||||
data-page="{pageId}"
|
||||
data-group-id="{groupId}"
|
||||
data-groupname="{groupname}"
|
||||
>
|
||||
<f:if condition="{groupId} == 0">
|
||||
<f:then>
|
||||
<f:comment>
|
||||
No group set -> [not set]
|
||||
</f:comment>
|
||||
<span class="not_set">
|
||||
[<f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:notSet" />]
|
||||
</span>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<f:if condition="{groupname}">
|
||||
<f:then>
|
||||
<f:comment>
|
||||
A group name can be resolved
|
||||
</f:comment>
|
||||
{groupname -> f:format.crop(maxCharacters:20)}
|
||||
</f:then>
|
||||
<f:else>
|
||||
<f:comment>
|
||||
Group was deleted -> [deleted]
|
||||
</f:comment>
|
||||
<span class="not_set" title="{groupId}">
|
||||
[<f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:deleted" />]
|
||||
</span>
|
||||
</f:else>
|
||||
</f:if>
|
||||
</f:else>
|
||||
</f:if>
|
||||
</a>
|
||||
</span>
|
||||
@@ -0,0 +1,38 @@
|
||||
{namespace be=TYPO3\CMS\Backend\ViewHelpers}
|
||||
<span id="o_{pageId}">
|
||||
<a
|
||||
class="ug_selector changeowner"
|
||||
data-page="{pageId}"
|
||||
data-owner="{userId}"
|
||||
data-username="{username}"
|
||||
>
|
||||
<f:if condition="{userId} == 0">
|
||||
<f:then>
|
||||
<f:comment>
|
||||
No owner set -> [not set]
|
||||
</f:comment>
|
||||
<span class="not_set">
|
||||
[<f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:notSet" />]
|
||||
</span>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<f:if condition="{username}">
|
||||
<f:then>
|
||||
<f:comment>
|
||||
A user name can be resolved
|
||||
</f:comment>
|
||||
{username -> f:format.crop(maxCharacters:20)}
|
||||
</f:then>
|
||||
<f:else>
|
||||
<f:comment>
|
||||
User was deleted -> [deleted]
|
||||
</f:comment>
|
||||
<span class="not_set" title="{userId}">
|
||||
[<f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:deleted" />]
|
||||
</span>
|
||||
</f:else>
|
||||
</f:if>
|
||||
</f:else>
|
||||
</f:if>
|
||||
</a>
|
||||
</span>
|
||||
@@ -0,0 +1,208 @@
|
||||
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
|
||||
xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
|
||||
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
|
||||
xmlns:bu="http://typo3.org/ns/TYPO3/CMS/Beuser/ViewHelpers">
|
||||
|
||||
<f:layout name="Default" />
|
||||
|
||||
<f:section name="Buttons">
|
||||
<be:moduleLayout.button.linkButton
|
||||
icon="actions-view-go-back"
|
||||
title="{f:translate(id: 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.goBack')}"
|
||||
link="{be:moduleLink(route: 'system_BeuserTxBeuser')}"
|
||||
/>
|
||||
</f:section>
|
||||
|
||||
<f:section name="Content">
|
||||
<h1><f:translate key="compareBackendUsers">Compare backend users</f:translate></h1>
|
||||
<div class="table-fit">
|
||||
<table border="0" cellpadding="0" cellspacing="0" id="tx_beuser_compare" class="table table-striped table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<th>
|
||||
<a href="#" class="t3js-contextmenutrigger" data-table="be_users" data-uid="{compareUser.uid}" title="id={compareUser.uid}">
|
||||
<be:avatar backendUser="{compareUser.uid}" showIcon="true" />
|
||||
</a>
|
||||
{compareUser.userName}
|
||||
<be:link.editRecord class="btn btn-default pull-right" table="be_users" uid="{compareUser.uid}" title="edit">
|
||||
<core:icon identifier="actions-open" />
|
||||
</be:link.editRecord>
|
||||
</th>
|
||||
</f:for>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><f:translate key="realName" /></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<td>{compareUser.realName}</td>
|
||||
</f:for>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><f:translate key="email" /></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<td>
|
||||
<f:if condition="{compareUser.email}">
|
||||
<f:then>
|
||||
<f:link.email email="{compareUser.email}" />
|
||||
</f:then>
|
||||
<f:else>
|
||||
-
|
||||
</f:else>
|
||||
</f:if>
|
||||
</td>
|
||||
</f:for>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><f:translate key="admin" /></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<td>
|
||||
<f:if condition="{compareUser.isAdministrator}">
|
||||
<f:then><f:translate key="yes" /></f:then>
|
||||
<f:else><f:translate key="no" /></f:else>
|
||||
</f:if>
|
||||
</td>
|
||||
</f:for>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><f:translate key="disable_compare" /></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<td>
|
||||
<f:if condition="{compareUser.currentlyLoggedIn} == 0">
|
||||
<f:if condition="{compareUser.isDisabled} == 1">
|
||||
<f:then>
|
||||
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{compareUser.uid}][disable]=0', redirectUrl: redirectUrl)}" title="{f:translate(key: 'visibility.unhide')}">
|
||||
<core:icon identifier="actions-edit-unhide" />
|
||||
</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_users][{compareUser.uid}][disable]=1', redirectUrl: redirectUrl)}" title="{f:translate(key: 'visibility.hide')}">
|
||||
<core:icon identifier="actions-edit-hide" />
|
||||
</a>
|
||||
</f:else>
|
||||
</f:if>
|
||||
</f:if>
|
||||
</td>
|
||||
</f:for>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><f:translate key="startDateAndTime" /></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<td>
|
||||
<f:if condition="{compareUser.startDateAndTime}">
|
||||
<f:then>
|
||||
<f:format.date format="{dateFormat} {timeFormat}">{compareUser.startDateAndTime}</f:format.date>
|
||||
</f:then>
|
||||
<f:else>
|
||||
-
|
||||
</f:else>
|
||||
</f:if>
|
||||
</td>
|
||||
</f:for>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><f:translate key="endDateAndTime" /></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<td>
|
||||
<f:if condition="{compareUser.endDateAndTime}">
|
||||
<f:then>
|
||||
<f:format.date format="{dateFormat} {timeFormat}">{compareUser.endDateAndTime}</f:format.date>
|
||||
</f:then>
|
||||
<f:else>
|
||||
-
|
||||
</f:else>
|
||||
</f:if>
|
||||
</td>
|
||||
</f:for>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><f:translate key="lastLogin" /></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<td>
|
||||
<f:if condition="{compareUser.lastLoginDateAndTime}">
|
||||
<f:then>
|
||||
<f:format.date format="{dateFormat} {timeFormat}">{compareUser.lastLoginDateAndTime}</f:format.date>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<f:translate key="never" />
|
||||
</f:else>
|
||||
</f:if>
|
||||
</td>
|
||||
</f:for>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><f:translate key="backendUserGroups" /></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<td>
|
||||
<f:for each="{compareUser.BackendUserGroups}" as="backendUserGroup">
|
||||
<a href="#" class="t3js-contextmenutrigger" data-table="be_groups" data-uid="{backendUserGroup.uid}" title="id={backendUserGroup.uid}">
|
||||
<bu:spriteIconForRecord table="be_users" object="{backendUserGroup}" />
|
||||
</a>
|
||||
{backendUserGroup.title}<br />
|
||||
</f:for>
|
||||
</td>
|
||||
</f:for>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><f:translate key="allowedLanguages" /></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<td>
|
||||
<f:if condition="{compareUser.allowedLanguages}">
|
||||
<f:then>
|
||||
<bu:display.sysLanguage uids="{compareUser.allowedLanguages}" />
|
||||
</f:then>
|
||||
<f:else>
|
||||
-
|
||||
</f:else>
|
||||
</f:if>
|
||||
</td>
|
||||
</f:for>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><f:translate key="dbMountPoints" /></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<td>
|
||||
<f:if condition="{compareUser.dbMountPoints}">
|
||||
<f:then>
|
||||
<bu:display.pages uids="{compareUser.dbMountPoints}" />
|
||||
</f:then>
|
||||
<f:else>
|
||||
-
|
||||
</f:else>
|
||||
</f:if>
|
||||
</td>
|
||||
</f:for>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><f:translate key="fileMounts" /></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<td>
|
||||
<f:if condition="{compareUser.fileMountPoints}">
|
||||
<f:then>
|
||||
<bu:display.sysFileMounts uids="{compareUser.fileMountPoints}" />
|
||||
</f:then>
|
||||
<f:else>
|
||||
-
|
||||
</f:else>
|
||||
</f:if>
|
||||
</td>
|
||||
</f:for>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><f:translate key="disableIpLock" /></th>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<td>
|
||||
<f:if condition="{compareUser.ipLockIsDisabled} == 1">
|
||||
<f:then><f:translate key="yes" /></f:then>
|
||||
<f:else><f:translate key="no" /></f:else>
|
||||
</f:if>
|
||||
</td>
|
||||
</f:for>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</f:section>
|
||||
</html>
|
||||
@@ -0,0 +1,62 @@
|
||||
<html
|
||||
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
|
||||
xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers"
|
||||
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
|
||||
data-namespace-typo3-fluid="true">
|
||||
|
||||
<f:layout name="Default" />
|
||||
|
||||
<f:section name="Buttons">
|
||||
<be:moduleLayout.button.linkButton
|
||||
icon="actions-add"
|
||||
title="{f:translate(id: 'LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newRecordGeneral')}"
|
||||
link="{be:uri.newRecord(table: 'be_users')}"
|
||||
/>
|
||||
</f:section>
|
||||
|
||||
<f:section name="Content">
|
||||
<h1><f:translate key="backendUserListing" /></h1>
|
||||
<f:comment>
|
||||
Listing of users on compare list
|
||||
</f:comment>
|
||||
<f:if condition="{compareUserList}">
|
||||
<h3>{f:translate(key: 'section.compare', default: 'Compare')}</h3>
|
||||
<div class="table-fit">
|
||||
<table id="typo3-backend-user-list-compare" class="table table-hover">
|
||||
<tbody>
|
||||
<f:for each="{compareUserList}" as="compareUser">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="#" class="t3js-contextmenutrigger" data-table="be_users" data-uid="{compareUser.uid}" title="id={compareUser.uid}">
|
||||
<be:avatar backendUser="{compareUser.uid}" showIcon="TRUE" />
|
||||
</a>
|
||||
</td>
|
||||
<td class="col-title">
|
||||
{compareUser.userName}
|
||||
</td>
|
||||
<td>
|
||||
<f:link.action action="removeFromCompareList" arguments="{uid: compareUser.uid}" class="pull-right btn btn-default">
|
||||
<core:icon identifier="actions-remove" />
|
||||
</f:link.action>
|
||||
</td>
|
||||
</tr>
|
||||
</f:for>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<f:form action="compare">
|
||||
<f:form.submit value="{f:translate(key: 'compareUserList', default: 'Compare user list')}" class="btn btn-default" />
|
||||
</f:form>
|
||||
<hr>
|
||||
</f:if>
|
||||
|
||||
<f:comment>
|
||||
Filter section
|
||||
</f:comment>
|
||||
<f:render partial="Filters/BackendUser/Index" arguments="{demand: demand, backendUserGroups: backendUserGroups}" />
|
||||
|
||||
<f:render partial="BackendUser/PaginatedListWidget" arguments="{_all}" />
|
||||
|
||||
</f:section>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,28 @@
|
||||
{namespace bu=TYPO3\CMS\Beuser\ViewHelpers}
|
||||
|
||||
<f:layout name="Default" />
|
||||
|
||||
<f:section name="Buttons">
|
||||
</f:section>
|
||||
|
||||
<f:section name="Content">
|
||||
<h1><f:translate key="onlineUsers" /></h1>
|
||||
<div class="table-fit">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th class="col-title"><f:translate key="userName" /> / <f:translate key="realName" /></th>
|
||||
<th><f:translate key="lastAccess" /></th>
|
||||
<th><f:translate key="ipAddress" /></th>
|
||||
<th class="col-control"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<f:for each="{onlineUsersAndSessions}" as="onlineUser">
|
||||
<f:render partial="BackendUser/OnlineListRow" arguments="{onlineUser: onlineUser, dateFormat: dateFormat, timeFormat: timeFormat, currentSessionId: currentSessionId}" />
|
||||
</f:for>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</f:section>
|
||||
@@ -0,0 +1,20 @@
|
||||
<html
|
||||
xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
|
||||
xmlns:be="http://typo3.org/ns/TYPO3/CMS/Backend/ViewHelpers"
|
||||
data-namespace-typo3-fluid="true">
|
||||
|
||||
<f:layout name="Default" />
|
||||
|
||||
<f:section name="Buttons">
|
||||
<be:moduleLayout.button.linkButton
|
||||
icon="actions-add"
|
||||
title="{f:translate(id: 'LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newRecordGeneral')}"
|
||||
link="{be:uri.newRecord(table: 'be_groups')}"
|
||||
/>
|
||||
</f:section>
|
||||
|
||||
<f:section name="Content">
|
||||
<h1><f:translate key="backendUserGroupListing" /></h1>
|
||||
<f:render partial="BackendUserGroup/PaginatedListWidget" arguments="{_all}" />
|
||||
</f:section>
|
||||
</html>
|
||||
@@ -0,0 +1,107 @@
|
||||
{namespace be=TYPO3\CMS\Backend\ViewHelpers}
|
||||
|
||||
<f:layout name="Permission" />
|
||||
|
||||
<f:section name="headline">
|
||||
<h1>
|
||||
<f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:permissions" />:
|
||||
<f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Edit" />
|
||||
</h1>
|
||||
</f:section>
|
||||
|
||||
<f:section name="content">
|
||||
<f:form action="update" name="editform" id="PermissionControllerEdit">
|
||||
|
||||
<div class="form-group">
|
||||
<label><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Owner" /></label>
|
||||
<f:form.select name="data[pages][{id}][perms_userid]" options="{beUserData}" value="{currentBeUser}" class="form-control" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Group" /></label>
|
||||
<f:if condition="{f:count(subject:beGroupData)} > 1">
|
||||
<f:then>
|
||||
<f:form.select name="data[pages][{id}][perms_groupid]" options="{beGroupData}" value="{currentBeGroup}" class="form-control" />
|
||||
</f:then>
|
||||
<f:else>
|
||||
<div class="alert alert-notice"><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:noGroups" /></div>
|
||||
</f:else>
|
||||
</f:if>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default panel-space">
|
||||
<div class="table-fit">
|
||||
<table class="table table-striped table-hover" id="typo3-permissionMatrix">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:1" /></th>
|
||||
<th><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:16" /></th>
|
||||
<th><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:2" /></th>
|
||||
<th><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:4" /></th>
|
||||
<th><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:8" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Owner" /></strong></td>
|
||||
<td><input type="checkbox" name="check[perms_user][1]" onclick="TYPO3.Permissions.checkChange('check[perms_user]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_user]')" /></td>
|
||||
<td><input type="checkbox" name="check[perms_user][5]" onclick="TYPO3.Permissions.checkChange('check[perms_user]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_user]')" /></td>
|
||||
<td><input type="checkbox" name="check[perms_user][2]" onclick="TYPO3.Permissions.checkChange('check[perms_user]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_user]')" /></td>
|
||||
<td><input type="checkbox" name="check[perms_user][3]" onclick="TYPO3.Permissions.checkChange('check[perms_user]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_user]')" /></td>
|
||||
<td><input type="checkbox" name="check[perms_user][4]" onclick="TYPO3.Permissions.checkChange('check[perms_user]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_user]')" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Group" /></strong></td>
|
||||
<td><input type="checkbox" name="check[perms_group][1]" onclick="TYPO3.Permissions.checkChange('check[perms_group]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_group]')" /></td>
|
||||
<td><input type="checkbox" name="check[perms_group][5]" onclick="TYPO3.Permissions.checkChange('check[perms_group]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_group]')" /></td>
|
||||
<td><input type="checkbox" name="check[perms_group][2]" onclick="TYPO3.Permissions.checkChange('check[perms_group]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_group]')" /></td>
|
||||
<td><input type="checkbox" name="check[perms_group][3]" onclick="TYPO3.Permissions.checkChange('check[perms_group]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_group]')" /></td>
|
||||
<td><input type="checkbox" name="check[perms_group][4]" onclick="TYPO3.Permissions.checkChange('check[perms_group]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_group]')" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Everybody" /></strong></td>
|
||||
<td><input type="checkbox" name="check[perms_everybody][1]" onclick="TYPO3.Permissions.checkChange('check[perms_everybody]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_everybody]')" /></td>
|
||||
<td><input type="checkbox" name="check[perms_everybody][5]" onclick="TYPO3.Permissions.checkChange('check[perms_everybody]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_everybody]')" /></td>
|
||||
<td><input type="checkbox" name="check[perms_everybody][2]" onclick="TYPO3.Permissions.checkChange('check[perms_everybody]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_everybody]')" /></td>
|
||||
<td><input type="checkbox" name="check[perms_everybody][3]" onclick="TYPO3.Permissions.checkChange('check[perms_everybody]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_everybody]')" /></td>
|
||||
<td><input type="checkbox" name="check[perms_everybody][4]" onclick="TYPO3.Permissions.checkChange('check[perms_everybody]', 'tx_beuser_system_beusertxpermission[data][pages][{id}][perms_everybody]')" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="recursionLevel"><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Depth" /></label>
|
||||
<f:form.select id="recursionLevel" name="mirror[pages][{id}]" options="{recursiveSelectOptions}" class="form-control" />
|
||||
</div>
|
||||
|
||||
<f:form.hidden name="data[pages][{id}][perms_user]" value="{pageInfo.perms_user}" />
|
||||
<f:form.hidden name="data[pages][{id}][perms_group]" value="{pageInfo.perms_group}" />
|
||||
<f:form.hidden name="data[pages][{id}][perms_everybody]" value="{pageInfo.perms_everybody}" />
|
||||
<f:form.hidden name="depth" value="{depth}" />
|
||||
<f:form.hidden name="returnUrl" value="{returnUrl}" />
|
||||
|
||||
</f:form>
|
||||
|
||||
<hr>
|
||||
<h3><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Legend" /></h3>
|
||||
<p>
|
||||
<strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:1" /></strong>: <f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:1_t" /> <br />
|
||||
<strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:16" /></strong>: <f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:16_t" /> <br />
|
||||
<strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:2" /></strong>: <f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:2_t" /> <br />
|
||||
<strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:4" /></strong>: <f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:4_t" /> <br />
|
||||
<strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:8" /></strong>: <f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:8_t" />
|
||||
</p>
|
||||
<p><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:def" /></p>
|
||||
|
||||
<script type="text/javascript">
|
||||
require(["jquery", "TYPO3/CMS/Beuser/Permissions"], function($, Permissions) {
|
||||
Permissions.setCheck("check[perms_user]", "tx_beuser_system_beusertxpermission[data][pages][{id}][perms_user]");
|
||||
Permissions.setCheck("check[perms_group]", "tx_beuser_system_beusertxpermission[data][pages][{id}][perms_group]");
|
||||
Permissions.setCheck("check[perms_everybody]", "tx_beuser_system_beusertxpermission[data][pages][{id}][perms_everybody]");
|
||||
});
|
||||
</script>
|
||||
|
||||
</f:section>
|
||||
@@ -0,0 +1,196 @@
|
||||
{namespace be=TYPO3\CMS\Backend\ViewHelpers}
|
||||
{namespace bu=TYPO3\CMS\Beuser\ViewHelpers}
|
||||
|
||||
<f:layout name="Permission" />
|
||||
|
||||
<f:section name="headline">
|
||||
<h1><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:permissions" /></h1>
|
||||
</f:section>
|
||||
|
||||
<f:section name="content">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="depth"><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Depth" />:</label>
|
||||
<f:form.select class="form-control" id="depth" value="{depth}" options="{depthOptions}" additionalAttributes="{onchange: 'TYPO3.Permissions.jumpToUrl(\'{depthBaseUrl}\'.replace(\'__DEPTH__\', this.options[this.selectedIndex].value), this);'}" />
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default panel-space">
|
||||
<div class="table-fit">
|
||||
<table class="table table-striped table-hover" id="typo3-permissionList">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2"> </th>
|
||||
<th><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Owner" /></th>
|
||||
<th align="center"><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Group" /></th>
|
||||
<th align="center"><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Everybody" /></th>
|
||||
<th align="center"><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:EditLock" /></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<f:for each="{viewTree}" as="data">
|
||||
<tr>
|
||||
<f:if condition="{data.row.uid}">
|
||||
<f:then>
|
||||
<f:comment>
|
||||
A "normal" page row is rendered, not the root page
|
||||
</f:comment>
|
||||
|
||||
<td align="left" class="nowrap">
|
||||
<f:link.action
|
||||
action="edit"
|
||||
arguments="{id: '{f:if(condition: data.row._ORIG_uid, then: data.row._ORIG_uid, else: data.row.uid)}', depth: depth, returnUrl: '{f:uri.action(action: \'index\', arguments: \'{id: currentId, depth: depth}\')}'}"
|
||||
title="{f:translate(key: 'LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:ch_permissions')}"
|
||||
>
|
||||
<f:format.raw>{data.depthData}{data.HTML}</f:format.raw>
|
||||
{data.row.title -> f:format.crop(maxCharacters:20)}
|
||||
</f:link.action>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<f:comment>
|
||||
Edit link is workspace aware: If in ws, link to edit the ws overlay record is rendered
|
||||
</f:comment>
|
||||
<f:link.action
|
||||
action="edit"
|
||||
arguments="{id: '{f:if(condition: data.row._ORIG_uid, then: data.row._ORIG_uid, else: data.row.uid)}', depth: depth, returnUrl: '{f:uri.action(action: \'index\', arguments: \'{id: currentId, depth: depth}\')}'}"
|
||||
class="btn btn-default"
|
||||
title="{f:translate(key: 'LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:ch_permissions')}"
|
||||
>
|
||||
<core:icon identifier="actions-open" />
|
||||
</f:link.action>
|
||||
</td>
|
||||
|
||||
<td class="nowrap">
|
||||
<bu:permissions permission="{data.row.perms_user}" scope="user" pageId="{data.row.uid}" />
|
||||
<f:render
|
||||
partial="Permission/Ownername"
|
||||
arguments="{
|
||||
pageId: '{data.row.uid}',
|
||||
userId: '{data.row.perms_userid}',
|
||||
username: '{bu:arrayElement(array:beUsers, key:data.row.perms_userid, subKey:\'username\')}'
|
||||
}"
|
||||
/>
|
||||
</td>
|
||||
|
||||
<td class="nowrap">
|
||||
<bu:permissions permission="{data.row.perms_group}" scope="group" pageId="{data.row.uid}" />
|
||||
<f:render
|
||||
partial="Permission/Groupname"
|
||||
arguments="{
|
||||
pageId: '{data.row.uid}',
|
||||
groupId: '{data.row.perms_groupid}',
|
||||
groupname: '{bu:arrayElement(array:beGroups, key:data.row.perms_groupid, subKey:\'title\')}'
|
||||
}"
|
||||
/>
|
||||
</td>
|
||||
|
||||
<td class="nowrap">
|
||||
<bu:permissions permission="{data.row.perms_everybody}" scope="everybody" pageId="{data.row.uid}" />
|
||||
</td>
|
||||
|
||||
<td class="nowrap">
|
||||
<span id="el_{data.row.uid}">
|
||||
<f:if condition="{data.row.editlock}">
|
||||
<f:then>
|
||||
<a
|
||||
class="editlock btn btn-default"
|
||||
data-page="{data.row.uid}"
|
||||
data-lockstate="1"
|
||||
title="{f:translate(key: 'LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:EditLock_descr')}"
|
||||
>
|
||||
<core:icon identifier="actions-lock" />
|
||||
</a>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<a
|
||||
class="editlock btn btn-default"
|
||||
data-page="{data.row.uid}"
|
||||
data-lockstate="0"
|
||||
title="{f:translate(key: 'LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:EditLock_descr2')}"
|
||||
>
|
||||
<core:icon identifier="actions-unlock" />
|
||||
</a>
|
||||
</f:else>
|
||||
</f:if>
|
||||
</span>
|
||||
</td>
|
||||
</f:then>
|
||||
|
||||
<f:else>
|
||||
<f:comment>
|
||||
Root page row is rendered
|
||||
</f:comment>
|
||||
<td align="left" class="nowrap">
|
||||
<f:format.raw>{data.HTML}</f:format.raw>
|
||||
{data.row.title -> f:format.crop(maxCharacters:20)}
|
||||
</td>
|
||||
<td></td>
|
||||
<td class="nowrap"></td>
|
||||
<td class="nowrap"></td>
|
||||
<td class="nowrap"></td>
|
||||
<td class="nowrap"></td>
|
||||
</f:else>
|
||||
</f:if>
|
||||
</tr>
|
||||
</f:for>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<f:format.raw>{cshItem}</f:format.raw>
|
||||
|
||||
<h3><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:Legend" />:</h3>
|
||||
<div class="beuser-legend">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="edge nowrap"><span><span></span></span></td>
|
||||
<td class="hr nowrap"><span></span></td>
|
||||
<td class="hr nowrap"><span></span></td>
|
||||
<td class="hr nowrap"><span></span></td>
|
||||
<td class="hr nowrap"><span></span></td>
|
||||
<td class="nowrap"><span class="number">1</span></td>
|
||||
<td class="nowrap"><strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:1" /></strong>: <f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:1_t" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="vr nowrap"><span></span></td>
|
||||
<td class="edge nowrap"><span><span></span></span></td>
|
||||
<td class="hr nowrap"><span></span></td>
|
||||
<td class="hr nowrap"><span></span></td>
|
||||
<td class="hr nowrap"><span></span></td>
|
||||
<td class="nowrap"><span class="number">2</span></td>
|
||||
<td class="nowrap"><strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:16" /></strong>: <f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:16_t" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="vr nowrap"><span></span></td>
|
||||
<td class="vr nowrap"><span></span></td>
|
||||
<td class="edge nowrap"><span><span></span></span></td>
|
||||
<td class="hr nowrap"><span></span></td>
|
||||
<td class="hr nowrap"><span></span></td>
|
||||
<td class="nowrap"><span class="number">3</span></td>
|
||||
<td class="nowrap"><strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:2" /></strong>: <f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:2_t" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="vr nowrap"><span></span></td>
|
||||
<td class="vr nowrap"><span></span></td>
|
||||
<td class="vr nowrap"><span></span></td>
|
||||
<td class="edge nowrap"><span><span></span></span></td>
|
||||
<td class="hr nowrap"><span></span></td>
|
||||
<td class="nowrap"><span class="number">4</span></td>
|
||||
<td class="nowrap"><strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:4" /></strong>: <f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:4_t" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowrap"><core:icon identifier="status-status-permission-granted" /></td>
|
||||
<td class="nowrap"><core:icon identifier="status-status-permission-denied" /></td>
|
||||
<td class="nowrap"><core:icon identifier="status-status-permission-granted" /></td>
|
||||
<td class="nowrap"><core:icon identifier="status-status-permission-denied" /></td>
|
||||
<td class="nowrap"><core:icon identifier="status-status-permission-denied" /></td>
|
||||
<td class="nowrap"><span class="number">5</span></td>
|
||||
<td class="nowrap"><strong><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:8" /></strong>: <f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:8_t" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<p><f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:def" /></p>
|
||||
<p>
|
||||
<core:icon identifier="status-status-permission-granted" /> <f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:A_Granted" /><br/>
|
||||
<core:icon identifier="status-status-permission-denied" /> <f:translate key="LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:A_Denied" />
|
||||
</p>
|
||||
</f:section>
|
||||
@@ -0,0 +1 @@
|
||||
<f:render partial="Permission/Groupname" arguments="{pageId: pageId, groupId: groupId, groupname: groupname}" />
|
||||
@@ -0,0 +1 @@
|
||||
<f:render partial="Permission/Ownername" arguments="{pageId: pageId, userId: userId, username: username}" />
|
||||
@@ -0,0 +1,2 @@
|
||||
{namespace bu=TYPO3\CMS\Beuser\ViewHelpers}
|
||||
<bu:permissions permission="{permission}" scope="{scope}" pageId="{pageId}" />
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 676 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path fill="#59F" d="M0 0h64v64H0z"/><path fill="#FFF" d="M46.6 41.2c-2.815-.768-4.974-1.825-6.976-2.678-.042.543-.243 1.113-.782 1.664-1.62 1.726-4.1 3.814-6.808 3.814-2.719 0-5.288-2.115-6.88-3.817-.558-.573-.743-1.177-.762-1.738-2.007.896-4.17 1.885-6.993 2.655 0 0-3.1 1.9-3.4 8.9h36c-.199-7.1-3.399-8.8-3.399-8.8z"/><path fill="#FFF" d="M40 20.5c0-3.6-3.2-6.5-7-6.5h-2c-3.6 0-7 2.9-7 6.5v5c0 2.109 1.628 4.713 3.5 6.553-.1 5.4-1.7 5.947-.9 6.747 2.5 2.7 8.1 2.9 10.8 0 .797-.797-.59-1.3-.896-6.747C38.333 30.215 39.942 27.59 40 25.5v-5z"/></svg>
|
||||
|
After Width: | Height: | Size: 610 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><path fill="#184F44" d="M0 0h64v64H0z"/><path fill="#FFF" d="M45 48H19a1 1 0 0 1-1-1V31a1 1 0 0 1 1-1h26a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1z"/><path fill="#FFF" d="M32 19.5c3.308 0 6 2.692 6 6h4c0-5.523-4.477-10-10-10s-10 4.477-10 10v8h4v-8c0-3.308 2.692-6 6-6z"/><circle fill="#184F44" cx="32" cy="38" r="4"/><path fill="#184F44" d="M30 38h4v6h-4z"/></svg>
|
||||
|
After Width: | Height: | Size: 413 B |
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Beuser/BackendUserListing
|
||||
* JavaScript for backend user listing
|
||||
* @exports TYPO3/CMS/Beuser/BackendUserListing
|
||||
*/
|
||||
define(['jquery', 'TYPO3/CMS/Backend/jquery.clearable'], function($) {
|
||||
|
||||
var $searchFields = $('#tx_Beuser_username');
|
||||
var searchResultShown = ('' !== $searchFields.first().val());
|
||||
|
||||
// make search field clearable
|
||||
$searchFields.clearable({
|
||||
onClear: function() {
|
||||
if (searchResultShown) {
|
||||
$(this).closest('form').submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Beuser/ContextMenuActions
|
||||
*
|
||||
* JavaScript to handle permissions module from context menu
|
||||
* @exports TYPO3/CMS/Beuser/ContextMenuActions
|
||||
*/
|
||||
define(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @exports TYPO3/CMS/Beuser/ContextMenuActions
|
||||
*/
|
||||
var ContextMenuActions = {};
|
||||
|
||||
/**
|
||||
* Open permission module for given uid
|
||||
*
|
||||
* @param {string} table
|
||||
* @param {int} uid of the page
|
||||
*/
|
||||
ContextMenuActions.openPermissionsModule = function(table, uid) {
|
||||
if (table === 'pages') {
|
||||
top.TYPO3.Backend.ContentContainer.setUrl(
|
||||
top.TYPO3.settings.AccessPermissions.moduleUrl +
|
||||
'&id=' + uid +
|
||||
'&tx_beuser_system_beusertxpermission[action]=edit' +
|
||||
'&tx_beuser_system_beusertxpermission[controller]=Permission' +
|
||||
'&returnUrl=' + ContextMenuActions.getReturnUrl()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
ContextMenuActions.getReturnUrl = function() {
|
||||
return top.rawurlencode(top.list_frame.document.location.pathname + top.list_frame.document.location.search);
|
||||
};
|
||||
|
||||
return ContextMenuActions;
|
||||
});
|
||||
@@ -0,0 +1,340 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module: TYPO3/CMS/Beuser/Permissons
|
||||
* Javascript functions regarding the permissions module
|
||||
*/
|
||||
define(['jquery'], function($) {
|
||||
|
||||
/**
|
||||
*
|
||||
* @type {{options: {containerSelector: string}}}
|
||||
* @exports TYPO3/CMS/Beuser/Permissons
|
||||
*/
|
||||
var Permissions = {
|
||||
options: {
|
||||
containerSelector: '#typo3-permissionList'
|
||||
}
|
||||
};
|
||||
var ajaxUrl = TYPO3.settings.ajaxUrls['user_access_permissions'];
|
||||
|
||||
/**
|
||||
* Changes the value of the permissions in the form
|
||||
*
|
||||
* @param {String} checknames
|
||||
* @param {String} varname
|
||||
*/
|
||||
Permissions.setCheck = function(checknames, varname) {
|
||||
if (document.editform[varname]) {
|
||||
var res = document.editform[varname].value;
|
||||
for (var a = 1; a <= 5; a++) {
|
||||
document.editform[checknames + '[' + a + ']'].checked = (res & Math.pow(2, a - 1));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* checks for a change of the permissions in the form
|
||||
*
|
||||
* @param {String} checknames
|
||||
* @param {String} varname
|
||||
*/
|
||||
Permissions.checkChange = function(checknames, varname) {
|
||||
var res = 0;
|
||||
for (var a = 1; a <= 5; a++) {
|
||||
if (document.editform[checknames + '[' + a + ']'].checked) {
|
||||
res |= Math.pow(2, a - 1);
|
||||
}
|
||||
}
|
||||
document.editform[varname].value = res | (checknames === 'tx_beuser_system_beusertxpermission[check][perms_user]' ? 1 : 0);
|
||||
Permissions.setCheck(checknames, varname);
|
||||
};
|
||||
|
||||
/**
|
||||
* wrapper function to call a URL in the current frame
|
||||
*/
|
||||
Permissions.jumpToUrl = function(url) {
|
||||
window.location.href = url;
|
||||
};
|
||||
|
||||
/**
|
||||
* changes permissions by sending an AJAX request to the server
|
||||
*
|
||||
* @param {Object} $element
|
||||
*/
|
||||
Permissions.setPermissions = function($element) {
|
||||
var page = $element.data('page');
|
||||
var who = $element.data('who');
|
||||
var elementSelector = '#' + page + '_' + who;
|
||||
|
||||
$.ajax({
|
||||
url: ajaxUrl,
|
||||
type: 'post',
|
||||
dataType: 'html',
|
||||
cache: false,
|
||||
data: {
|
||||
'page': page,
|
||||
'who': who,
|
||||
'permissions': $element.data('permissions'),
|
||||
'mode': $element.data('mode'),
|
||||
'bits': $element.data('bits')
|
||||
}
|
||||
}).done(function(data) {
|
||||
// Replace content
|
||||
$(elementSelector).replaceWith(data);
|
||||
// Reinitialize tooltip
|
||||
$(elementSelector).find('span').tooltip();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* changes the flag to lock the editing on a page by sending an AJAX request
|
||||
*
|
||||
* @param {Object} $element
|
||||
*/
|
||||
Permissions.toggleEditLock = function($element) {
|
||||
var page = $element.data('page');
|
||||
|
||||
$.ajax({
|
||||
url: ajaxUrl,
|
||||
type: 'post',
|
||||
dataType: 'html',
|
||||
cache: false,
|
||||
data: {
|
||||
'action': 'toggle_edit_lock',
|
||||
'page': page,
|
||||
'editLockState': $element.data('lockstate')
|
||||
}
|
||||
}).done(function(data) {
|
||||
// Replace content
|
||||
$('#el_' + page).replaceWith(data);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Owner-related: Set the new owner of a page by executing an ajax call
|
||||
*
|
||||
* @param {Object} $element
|
||||
*/
|
||||
Permissions.changeOwner = function($element) {
|
||||
var page = $element.data('page');
|
||||
|
||||
$.ajax({
|
||||
url: ajaxUrl,
|
||||
type: 'post',
|
||||
dataType: 'html',
|
||||
cache: false,
|
||||
data: {
|
||||
'action': 'change_owner',
|
||||
'page': page,
|
||||
'ownerUid': $element.data('owner'),
|
||||
'newOwnerUid': $('#new_page_owner').val()
|
||||
}
|
||||
}).done(function(data) {
|
||||
// Replace content
|
||||
$('#o_' + page).replaceWith(data);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Owner-related: load the selector for selecting
|
||||
* the owner of a page by executing an ajax call
|
||||
*
|
||||
* @param {Object} $element
|
||||
*/
|
||||
Permissions.showChangeOwnerSelector = function($element) {
|
||||
var page = $element.data('page');
|
||||
|
||||
$.ajax({
|
||||
url: ajaxUrl,
|
||||
type: 'post',
|
||||
dataType: 'html',
|
||||
cache: false,
|
||||
data: {
|
||||
'action': 'show_change_owner_selector',
|
||||
'page': page,
|
||||
'ownerUid': $element.data('owner'),
|
||||
'username': $element.data('username')
|
||||
}
|
||||
}).done(function(data) {
|
||||
// Replace content
|
||||
$('#o_' + page).replaceWith(data);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Owner-related: Update the HTML view and show the original owner
|
||||
*
|
||||
* @param {Object} $element
|
||||
*/
|
||||
Permissions.restoreOwner = function($element) {
|
||||
var page = $element.data('page');
|
||||
var username = $element.data('username');
|
||||
var usernameHtml = username;
|
||||
if (typeof username === 'undefined') {
|
||||
username = $('<span>', {
|
||||
'class': 'not_set',
|
||||
'text': '[not set]'
|
||||
});
|
||||
usernameHtml = username.html();
|
||||
username = username.text();
|
||||
}
|
||||
|
||||
var html = $('<span/>', {
|
||||
'id': 'o_' + page
|
||||
});
|
||||
var aSelector = $('<a/>', {
|
||||
'class': 'ug_selector changeowner',
|
||||
'data-page': page,
|
||||
'data-owner': $element.data('owner'),
|
||||
'data-username': usernameHtml,
|
||||
'text': username
|
||||
});
|
||||
html.append(aSelector);
|
||||
|
||||
// Replace content
|
||||
$('#o_' + page).replaceWith(html);
|
||||
};
|
||||
|
||||
/**
|
||||
* Group-related: Set the new group by executing an ajax call
|
||||
*
|
||||
* @param {Object} $element
|
||||
*/
|
||||
Permissions.changeGroup = function($element) {
|
||||
var page = $element.data('page');
|
||||
|
||||
$.ajax({
|
||||
url: ajaxUrl,
|
||||
type: 'post',
|
||||
dataType: 'html',
|
||||
cache: false,
|
||||
data: {
|
||||
'action': 'change_group',
|
||||
'page': page,
|
||||
'groupUid': $element.data('groupId'),
|
||||
'newGroupUid': $('#new_page_group').val()
|
||||
}
|
||||
}).done(function(data) {
|
||||
// Replace content
|
||||
$('#g_' + page).replaceWith(data);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Group-related: Load the selector by executing an ajax call
|
||||
*
|
||||
* @param {Object} $element
|
||||
*/
|
||||
Permissions.showChangeGroupSelector = function($element) {
|
||||
var page = $element.data('page');
|
||||
|
||||
$.ajax({
|
||||
url: ajaxUrl,
|
||||
type: 'post',
|
||||
dataType: 'html',
|
||||
cache: false,
|
||||
data: {
|
||||
'action': 'show_change_group_selector',
|
||||
'page': page,
|
||||
'groupUid': $element.data('groupId'),
|
||||
'groupname': $element.data('groupname')
|
||||
}
|
||||
}).done(function(data) {
|
||||
// Replace content
|
||||
$('#g_' + page).replaceWith(data);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Group-related: Update the HTML view and show the original group
|
||||
*
|
||||
* @param {Object} $element
|
||||
*/
|
||||
Permissions.restoreGroup = function($element) {
|
||||
var page = $element.data('page');
|
||||
var groupname = $element.data('groupname');
|
||||
var groupnameHtml = groupname;
|
||||
if (typeof groupname === 'undefined') {
|
||||
groupname = $('<span>', {
|
||||
'class': 'not_set',
|
||||
'text': '[not set]'
|
||||
});
|
||||
groupnameHtml = groupname.html();
|
||||
groupname = groupname.text();
|
||||
}
|
||||
var html = $('<span/>', {
|
||||
'id': 'g_' + page
|
||||
});
|
||||
var aSelector = $('<a/>', {
|
||||
'class': 'ug_selector changegroup',
|
||||
'data-page': page,
|
||||
'data-group': $element.data('groupId'),
|
||||
'data-groupname': groupnameHtml,
|
||||
'text': groupname
|
||||
});
|
||||
html.append(aSelector);
|
||||
|
||||
// Replace content
|
||||
$('#g_' + page).replaceWith(html);
|
||||
};
|
||||
|
||||
/**
|
||||
* initializes events using deferred bound to document
|
||||
* so AJAX reloads are no problem
|
||||
*/
|
||||
Permissions.initializeEvents = function() {
|
||||
|
||||
// Click event to change permissions
|
||||
$(Permissions.options.containerSelector).on('click', '.change-permission', function(evt) {
|
||||
evt.preventDefault();
|
||||
Permissions.setPermissions($(this));
|
||||
}).on('click', '.editlock', function(evt) {
|
||||
// Click event for lock state
|
||||
evt.preventDefault();
|
||||
Permissions.toggleEditLock($(this));
|
||||
}).on('click', '.changeowner', function(evt) {
|
||||
// Click event to change owner
|
||||
evt.preventDefault();
|
||||
Permissions.showChangeOwnerSelector($(this));
|
||||
}).on('click', '.changegroup', function(evt) {
|
||||
// click event to change group
|
||||
evt.preventDefault();
|
||||
Permissions.showChangeGroupSelector($(this));
|
||||
}).on('click', '.restoreowner', function(evt) {
|
||||
// Add click handler for restoring previous owner
|
||||
evt.preventDefault();
|
||||
Permissions.restoreOwner($(this));
|
||||
}).on('click', '.saveowner', function(evt) {
|
||||
// Add click handler for saving owner
|
||||
evt.preventDefault();
|
||||
Permissions.changeOwner($(this));
|
||||
}).on('click', '.restoregroup', function(evt) {
|
||||
// Add click handler for restoring previous group
|
||||
evt.preventDefault();
|
||||
Permissions.restoreGroup($(this));
|
||||
}).on('click', '.savegroup', function(evt) {
|
||||
// Add click handler for saving group
|
||||
evt.preventDefault();
|
||||
Permissions.changeGroup($(this));
|
||||
});
|
||||
};
|
||||
|
||||
$(Permissions.initializeEvents);
|
||||
|
||||
// expose to global
|
||||
TYPO3.Permissions = Permissions;
|
||||
|
||||
return Permissions;
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "typo3/cms-beuser",
|
||||
"type": "typo3-cms-framework",
|
||||
"description": "Backend user administration and overview. Allows you to compare the settings of users and verify their permissions and see who is online.",
|
||||
"homepage": "https://typo3.org",
|
||||
"license": ["GPL-2.0-or-later"],
|
||||
"authors": [{
|
||||
"name": "TYPO3 Core Team",
|
||||
"email": "typo3cms@typo3.org",
|
||||
"role": "Developer"
|
||||
}],
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"require": {
|
||||
"typo3/cms-core": "9.5.31"
|
||||
},
|
||||
"conflict": {
|
||||
"typo3/cms": "*"
|
||||
},
|
||||
"extra": {
|
||||
"typo3/cms": {
|
||||
"Package": {
|
||||
"partOfFactoryDefault": true
|
||||
},
|
||||
"extension-key": "beuser"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"TYPO3\\CMS\\Beuser\\": "Classes/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"TYPO3\\CMS\\Beuser\\Tests\\": "Tests/"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$EM_CONF[$_EXTKEY] = [
|
||||
'title' => 'Backend User Administration',
|
||||
'description' => 'Backend user administration and overview. Allows you to compare the settings of users and verify their permissions and see who is online.',
|
||||
'category' => 'module',
|
||||
'author' => 'TYPO3 Core Team',
|
||||
'author_email' => 'typo3cms@typo3.org',
|
||||
'author_company' => '',
|
||||
'state' => 'stable',
|
||||
'uploadfolder' => 0,
|
||||
'createDirs' => '',
|
||||
'clearCacheOnLoad' => 0,
|
||||
'version' => '9.5.31',
|
||||
'constraints' => [
|
||||
'depends' => [
|
||||
'typo3' => '9.5.31',
|
||||
],
|
||||
'conflicts' => [],
|
||||
'suggests' => [],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
defined('TYPO3_MODE') or die();
|
||||
|
||||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][] = \TYPO3\CMS\Beuser\Hook\SwitchBackUserHook::class . '->switchBack';
|
||||
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/backend.php']['constructPostProcess'][] = \TYPO3\CMS\Beuser\Hook\BackendControllerHook::class . '->addJavaScript';
|
||||
$GLOBALS['TYPO3_CONF_VARS']['BE']['ContextMenu']['ItemProviders'][1486418730] = \TYPO3\CMS\Beuser\ContextMenu\ItemProvider::class;
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
defined('TYPO3_MODE') or die();
|
||||
|
||||
// Module System > Backend Users
|
||||
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
|
||||
'TYPO3.CMS.Beuser',
|
||||
'system',
|
||||
'tx_Beuser',
|
||||
'top',
|
||||
[
|
||||
'BackendUser' => 'index, addToCompareList, removeFromCompareList, compare, online, terminateBackendUserSession',
|
||||
'BackendUserGroup' => 'index'
|
||||
],
|
||||
[
|
||||
'access' => 'admin',
|
||||
'icon' => 'EXT:beuser/Resources/Public/Icons/module-beuser.svg',
|
||||
'labels' => 'LLL:EXT:beuser/Resources/Private/Language/locallang_mod.xlf'
|
||||
]
|
||||
);
|
||||
|
||||
// Module System > Access
|
||||
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
|
||||
'TYPO3.CMS.Beuser',
|
||||
'system',
|
||||
'tx_Permission',
|
||||
'top',
|
||||
[
|
||||
'Permission' => 'index, edit, update'
|
||||
],
|
||||
[
|
||||
'access' => 'admin',
|
||||
'icon' => 'EXT:beuser/Resources/Public/Icons/module-permission.svg',
|
||||
'labels' => 'LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf',
|
||||
'navigationComponentId' => 'TYPO3/CMS/Backend/PageTree/PageTreeElement'
|
||||
]
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:beuser/Configuration/TypoScript/setup.typoscript">
|
||||
Reference in new issue
Block a user