Commit 9eaeb9d7 authored by Ingo Pfennigstorf's avatar Ingo Pfennigstorf Committed by Frank Nägler
Browse files

[FEATURE] Add backend user groups to backend user module

The backend user module lacks the possibility to easily list and
edit backend user groups. Add this functionality now.

Resolves: #64686
Releases: master
Change-Id: I5ddbdd03de2248619e0937d4d35e3998cbc83e40
Reviewed-on: http://review.typo3.org/36499

Reviewed-by: Ingo Pfennigstorf's avatarIngo Pfennigstorf <i.pfennigstorf@gmail.com>
Tested-by: Ingo Pfennigstorf's avatarIngo Pfennigstorf <i.pfennigstorf@gmail.com>
Reviewed-by: default avatarAndreas Fernandez <andreas.fernandez@aspedia.de>
Tested-by: default avatarAndreas Fernandez <andreas.fernandez@aspedia.de>
Reviewed-by: default avatarFrank Nägler <typo3@naegler.net>
Tested-by: default avatarFrank Nägler <typo3@naegler.net>
parent ad3a03b7
......@@ -636,7 +636,7 @@ class ElementInformationController {
}
$record = BackendUtility::getRecord($row['tablename'], $row['recuid']);
$parentRecord = BackendUtility::getRecord('pages', $record['pid']);
$icon = IconUtility::getSpriteIconForRecord($row['tablename'], $record);
$icon = (is_array($record)) ? IconUtility::getSpriteIconForRecord($row['tablename'], $record) : '';
$actions = $this->getRecordActions($row['tablename'], $row['recuid']);
$editOnClick = BackendUtility::editOnClick('&edit[' . $row['tablename'] . '][' . $row['recuid'] . ']=edit', $GLOBALS['BACK_PATH']);
$infoData[] = '
......
<?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\Utility\BackendUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
/**
* Backend module user group administration controller
*
* @author Ingo Pfennigstorf <i.pfennigstorf@gmail.com>
*/
class BackendUserGroupController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
/**
* @var \TYPO3\CMS\Beuser\Domain\Repository\BackendUserGroupRepository
* @inject
*/
protected $backendUserGroupRepository;
/**
* Initialize actions
*
* @return void
* @throws \RuntimeException
*/
public function initializeAction() {
// @TODO: Extbase backend modules relies on frontend TypoScript for view, persistence
// and settings. Thus, we need a TypoScript root template, that then loads the
// ext_typoscript_setup.txt file of this module. This is nasty, but can not be
// circumvented until there is a better solution in extbase.
// For now we throw an exception if no settings are detected.
if (empty($this->settings)) {
throw new \RuntimeException('No settings detected. This module can not work then. This usually happens if there is no frontend TypoScript template with root flag set. ' . 'Please create a frontend page with a TypoScript root template.', 1344375003);
}
}
/**
* Displays all BackendUserGroups
*
* @return void
*/
public function indexAction() {
$this->view->assign('backendUserGroups', $this->backendUserGroupRepository->findAll());
}
}
......@@ -26,6 +26,11 @@ class BackendUserGroup extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
*/
protected $title;
/**
* @var bool
*/
protected $hidden;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Beuser\Domain\Model\BackendUserGroup>
* @lazy
......@@ -46,6 +51,20 @@ class BackendUserGroup extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
return $this->title;
}
/**
* @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
*/
......
......@@ -27,4 +27,15 @@ class BackendUserGroupRepository extends \TYPO3\CMS\Extbase\Persistence\Reposito
protected $defaultOrderings = array(
'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;
}
}
......@@ -42,6 +42,9 @@ class SpriteIconForRecordViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\Abst
if (method_exists($object, 'getIsDisabled')) {
$row['disable'] = $object->getIsDisabled();
}
if (method_exists($object, 'getHidden')) {
$row['hidden'] = $object->getHidden();
}
if ($table === 'be_users' && $object instanceof \TYPO3\CMS\Beuser\Domain\Model\BackendUser) {
$row['admin'] = $object->getIsAdministrator();
}
......
......@@ -27,10 +27,10 @@ module.tx_beuser {
}
settings {
// This is a dummy entry. It is used in Tx_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.
// 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
}
}
\ No newline at end of file
......@@ -21,6 +21,9 @@
<trans-unit id="backendUserListing" xml:space="preserve">
<source>Backend User Listing</source>
</trans-unit>
<trans-unit id="subGroups" xml:space="preserve">
<source>Sub Groups</source>
</trans-unit>
<trans-unit id="email" xml:space="preserve">
<source>Email</source>
</trans-unit>
......@@ -111,6 +114,9 @@
<trans-unit id="backendUsers" xml:space="preserve">
<source>Backend users</source>
</trans-unit>
<trans-unit id="backendUserGroupsMenu" xml:space="preserve">
<source>Backend user groups</source>
</trans-unit>
<trans-unit id="onlineUsers" xml:space="preserve">
<source>Online users</source>
</trans-unit>
......@@ -141,6 +147,9 @@
<trans-unit id="terminateSessionSuccess" xml:space="preserve">
<source>Session successfully terminated.</source>
</trans-unit>
<trans-unit id="backendUserGroupListing" xml:space="preserve">
<source>Backend User Group Listing</source>
</trans-unit>
</body>
</file>
</xliff>
......@@ -6,6 +6,7 @@
<f:be.buttons.csh />
<f:be.menus.actionMenu>
<f:be.menus.actionMenuItem label="{f:translate(key: 'backendUsers')}" controller="BackendUser" action="index" />
<f:be.menus.actionMenuItem label="{f:translate(key: 'backendUserGroupsMenu')}" controller="BackendUserGroup" action="index" />
<f:be.menus.actionMenuItem label="{f:translate(key: 'onlineUsers')}" controller="BackendUser" action="online" />
</f:be.menus.actionMenu>
</div>
......
{namespace be = TYPO3\CMS\Backend\ViewHelpers}
{namespace bu = TYPO3\CMS\Beuser\ViewHelpers}
<tr>
<td class="col-icon">
<a href="#" class="t3-js-clickmenutrigger" data-table="be_groups" data-uid="{backendUserGroup.uid}" data-listframe="1" title="id={backendUserGroup.uid}">
<bu:spriteIconForRecord table="be_groups" object="{backendUserGroup}" />
</a>
</td>
<td class="col-title">
<a href="#" onclick="document.location.href='alt_doc.php?edit[be_groups][{backendUserGroup.uid}]=edit&amp;returnUrl='+T3_THIS_LOCATION">
<b>{backendUserGroup.title}</b><br />
{backendUser.realName}
</a>
</td>
<td>
<f:for each="{backendUserGroup.subgroups}" as="subgroup" iteration="subGroupIterator">
<a href="alt_doc.php?edit[be_groups][{subgroup.uid}]=edit&amp;returnUrl={returnUrl}">
{subgroup.title}
</a>
<f:if condition="{subGroupIterator.isLast}"><f:else>, </f:else></f:if>
</f:for>
</td>
<td class="col-control">
<div class="btn-group" role="group">
<a class="btn btn-default" href="#" onclick="top.launchView('be_groups', '{backendUserGroup.uid}'); return false;"><be:spriteManagerIcon iconName="actions-document-info" /></a>
<a class="btn btn-default" href="#" onclick="document.location.href='alt_doc.php?edit[be_groups][{backendUserGroup.uid}]=edit&amp;returnUrl='+T3_THIS_LOCATION"><be:spriteManagerIcon iconName="actions-document-open" /></a>
<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)}"><be:spriteManagerIcon iconName="actions-edit-unhide" options="{title: 'unhide'}" /></a>
</f:then>
<f:else>
<a class="btn btn-default" href="{bu:issueCommand(parameters: 'data[be_groups][{backendUserGroup.uid}][hidden]=1', redirectUrl: redirectUrl)}"><be:spriteManagerIcon iconName="actions-edit-hide" options="{title: 'hide'}" /></a>
</f:else>
</f:if>
</div>
</td>
</tr>
{namespace be = TYPO3\CMS\Backend\ViewHelpers}
{namespace bu = TYPO3\CMS\Beuser\ViewHelpers}
<f:layout name="Default" />
<f:section name="iconButtons">
<a href="#" onclick="window.location.href='alt_doc.php?returnUrl=' + T3_THIS_LOCATION + '&amp;edit[be_groups][0]=new'; return false;"><be:spriteManagerIcon iconName="actions-document-new" /></a>
</f:section>
<f:section name="headline">
<h1><f:translate key="backendUserGroupListing" /></h1>
</f:section>
<f:section name="content">
<f:comment>
Listing of all user groups
</f:comment>
<f:be.widget.paginate objects="{backendUserGroups}" as="paginatedBackendUserGroups" configuration="{itemsPerPage: 50, insertBelow: 1}">
<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" arguments="{demand: demand, backendUserGroup: backendUserGroup, dateFormat: dateFormat, timeFormat: timeFormat, returnUrl: returnUrl}" />
</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:lang/locallang_tca.xlf:be_groups" />s
</td>
</tr>
</tbody>
</table>
</div>
</f:be.widget.paginate>
</f:section>
......@@ -9,7 +9,8 @@ if (TYPO3_MODE === 'BE') {
'tx_Beuser',
'top',
array(
'BackendUser' => 'index, addToCompareList, removeFromCompareList, compare, online, terminateBackendUserSession'
'BackendUser' => 'index, addToCompareList, removeFromCompareList, compare, online, terminateBackendUserSession',
'BackendUserGroup' => 'index'
),
array(
'access' => 'admin',
......
================================================================
Feature: #64686 - Add backend user groups to backend user module
================================================================
Description
===========
The backend user groups can be maintained in a submodule of the
"Backend users" backend module now.
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment