BackendUserController extends ActionController

Backend module user and user group administration controller.

Internal

This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.

Table of Contents

Properties

$actionMethodName  : non-empty-string
Name of the action method
$arguments  : Arguments
$backendUriBuilder  : UriBuilder
$backendUserGroupRepository  : BackendUserGroupRepository
$backendUserRepository  : BackendUserRepository
$backendUserSessionRepository  : BackendUserSessionRepository
$configurationManager  : ConfigurationManagerInterface
$defaultViewObjectName  : class-string|null
The default view class to use. Keep this 'null' for default fluid view, or set to 'JsonView::class' or some inheriting class.
$errorMethodName  : string
Name of the special error action method which is called in case of errors
$eventDispatcher  : EventDispatcherInterface
$fileHandlingService  : FileHandlingService
$fileMountRepository  : FileMountRepository
$hashService  : HashService
$iconFactory  : IconFactory
$moduleData  : ModuleData|null
$moduleTemplate  : ModuleTemplate
$moduleTemplateFactory  : ModuleTemplateFactory
$mvcPropertyMappingConfigurationService  : MvcPropertyMappingConfigurationService
$pageRenderer  : PageRenderer
$reflectionService  : ReflectionService
$request  : RequestInterface
$responseFactory  : ResponseFactoryInterface
$settings  : array<string|int, mixed>
Contains the settings of the current extension
$streamFactory  : StreamFactoryInterface
$uriBuilder  : UriBuilder
$userInformationService  : UserInformationService
$validatorResolver  : ValidatorResolver
$view  : ViewInterface
The current view, as resolved by resolveView()

Methods

__construct()  : mixed
addFlashMessage()  : void
Creates a Message object and adds it to the FlashMessageQueue.
addGroupToCompareListAction()  : ResponseInterface
Attaches one backend user group to the compare list
addToCompareListAction()  : ResponseInterface
Attaches one backend user to the compare list
compareAction()  : ResponseInterface
Compare backend users from demand
compareGroupsAction()  : ResponseInterface
groupsAction()  : ResponseInterface
Displays all BackendUserGroups
indexAction()  : ResponseInterface
Default action, forwarding the request to either a defined default action or the default entry point "list"
initializeAction()  : void
Init module state.
initializeControllerArgumentsBaseValidators()  : void
Collects the base validators which were defined for the data type of each controller argument and adds them to the argument's validator chain.
initiatePasswordResetAction()  : ResponseInterface
Starts the password reset process for a selected user.
injectConfigurationManager()  : void
injectEventDispatcher()  : void
injectFileHandlingService()  : void
injectHashService()  : void
injectInternalExtensionService()  : void
injectInternalFlashMessageService()  : void
injectMvcPropertyMappingConfigurationService()  : void
injectPropertyMapper()  : void
injectReflectionService()  : void
injectResponseFactory()  : void
injectStreamFactory()  : void
injectValidatorResolver()  : void
injectViewFactory()  : void
listAction()  : ResponseInterface
Displays all BackendUsers
onlineAction()  : ResponseInterface
Views all currently logged in BackendUsers and their sessions
processRequest()  : ResponseInterface
Store a valid selected action as defaultAction
removeAllFromCompareListAction()  : ResponseInterface
Removes all backend users from the compare list
removeAllGroupsFromCompareListAction()  : ResponseInterface
Removes all backend user groups from the compare list
removeFromCompareListAction()  : ResponseInterface
Removes given backend user to the compare list
removeGroupFromCompareListAction()  : ResponseInterface
Removes given backend user group to the compare list
showAction()  : ResponseInterface
throwStatus()  : never
Sends the specified HTTP status immediately and only stops to run back through the middleware stack.
addBaseUriIfNecessary()  : string
Adds the base uri if not already in place.
addErrorFlashMessage()  : void
If an error occurred during this request, this adds a flash message describing the error to the flash message container.
addMainMenu()  : void
Doc header main drop down
addToCompareList()  : void
Attaches the given uid to the requested compare list
callActionMethod()  : ResponseInterface
Calls the specified action method and passes the arguments.
cleanCompareList()  : void
Removes all items from the requested compare list
errorAction()  : ResponseInterface
A special action which is called if the originally intended action could not be called, for example if the arguments were not valid.
filemountsAction()  : ResponseInterface
forwardToReferringRequest()  : ResponseInterface|null
If information on the request before the current request was sent, this method forwards back to the originating request. This effectively ends processing of the current request, so do not call this method before you have finished the necessary business logic!
getBackendUser()  : BackendUserAuthentication
getErrorFlashMessage()  : bool|string
A template method for displaying custom error flash messages, or to display no flash message at all on errors. Override this to customize the flash message in your action controller.
getFlashMessageQueue()  : FlashMessageQueue
todo: As soon as the incoming request contains the compiled plugin namespace, extbase will offer a trait to create a flash message identifier from the current request. Users then should inject the flash message service themselves if needed.
getFlattenedValidationErrorMessage()  : string
Returns a string with a basic error message about validation failure.
getOnlineBackendUsers()  : array<string|int, mixed>
Create an array with the uids of online users as the keys [ 1 => true, 5 => true ]
handleArgumentMappingExceptions()  : void
This method processes exceptions that occur due to missing or not found targets or arguments during argument mapping. Based on configuration settings, either a "page not found" response is triggered or the original exception is propagated.
htmlResponse()  : ResponseInterface
Returns a response object with either the given html string or the current rendered view as content.
initializeActionMethodArguments()  : void
Implementation of the arguments initialization in the action controller: Automatically registers arguments of the current action
initializeActionMethodValidators()  : void
Adds the needed validators to the Arguments:
initializeView()  : void
Assign default variables to ModuleTemplate view
jsonResponse()  : ResponseInterface
Returns a response object with either the given json string or the current rendered view as content. Mainly to be used for actions / controllers using the JsonView.
mapRequestArgumentsToControllerArguments()  : void
Maps arguments delivered by the request object to the local controller arguments.
redirect()  : ResponseInterface
Redirects the request to another action and / or controller.
redirectToUri()  : ResponseInterface
Redirects the web request to another uri.
removeFromCompareList()  : void
Removes the given uid from the requested compare list
renderAssetsForRequest()  : void
Method which initializes assets that should be attached to the response for the given $request, which contains parameters that an override can use to determine which assets to add via PageRenderer.
resolveActionMethodName()  : string
Resolves and checks the current action method name
resolveView()  : ViewInterface
Prepares a view for the current action.
terminateBackendUserSessionAction()  : ResponseInterface
Terminate BackendUser session and logout corresponding client Redirects to onlineAction with message

Properties

$actionMethodName

Name of the action method

protected non-empty-string $actionMethodName = 'indexAction'
Internal

$defaultViewObjectName

The default view class to use. Keep this 'null' for default fluid view, or set to 'JsonView::class' or some inheriting class.

protected class-string|null $defaultViewObjectName = null

$errorMethodName

Name of the special error action method which is called in case of errors

protected string $errorMethodName = 'errorAction'

$eventDispatcher

protected EventDispatcherInterface $eventDispatcher

$responseFactory

protected ResponseFactoryInterface $responseFactory

$settings

Contains the settings of the current extension

protected array<string|int, mixed> $settings

$streamFactory

protected StreamFactoryInterface $streamFactory

Methods

__construct()

public __construct(BackendUserRepository $backendUserRepository, BackendUserGroupRepository $backendUserGroupRepository, BackendUserSessionRepository $backendUserSessionRepository, UserInformationService $userInformationService, ModuleTemplateFactory $moduleTemplateFactory, UriBuilder $backendUriBuilder, IconFactory $iconFactory, PageRenderer $pageRenderer, FileMountRepository $fileMountRepository) : mixed
Parameters
$backendUserRepository : BackendUserRepository
$backendUserGroupRepository : BackendUserGroupRepository
$backendUserSessionRepository : BackendUserSessionRepository
$userInformationService : UserInformationService
$moduleTemplateFactory : ModuleTemplateFactory
$backendUriBuilder : UriBuilder
$iconFactory : IconFactory
$pageRenderer : PageRenderer
$fileMountRepository : FileMountRepository

addFlashMessage()

Creates a Message object and adds it to the FlashMessageQueue.

public addFlashMessage(string $messageBody[, string $messageTitle = '' ][, ContextualFeedbackSeverity $severity = ContextualFeedbackSeverity::OK ][, bool $storeInSession = true ]) : void
Parameters
$messageBody : string
$messageTitle : string = ''
$severity : ContextualFeedbackSeverity = ContextualFeedbackSeverity::OK
$storeInSession : bool = true
Tags
throws
InvalidArgumentException

if the message body is no string

see
FlashMessage

addGroupToCompareListAction()

Attaches one backend user group to the compare list

public addGroupToCompareListAction(int $uid) : ResponseInterface
Parameters
$uid : int
Return values
ResponseInterface

addToCompareListAction()

Attaches one backend user to the compare list

public addToCompareListAction(int $uid) : ResponseInterface
Parameters
$uid : int
Return values
ResponseInterface

compareAction()

Compare backend users from demand

public compareAction() : ResponseInterface
Return values
ResponseInterface

compareGroupsAction()

public compareGroupsAction() : ResponseInterface
Return values
ResponseInterface

groupsAction()

Displays all BackendUserGroups

public groupsAction([BackendUserGroup|null $userGroupDto = null ][, int $currentPage = 1 ][, string $operation = '' ]) : ResponseInterface
Parameters
$userGroupDto : BackendUserGroup|null = null
$currentPage : int = 1
$operation : string = ''
Return values
ResponseInterface

indexAction()

Default action, forwarding the request to either a defined default action or the default entry point "list"

public indexAction() : ResponseInterface
Return values
ResponseInterface

initializeAction()

Init module state.

public initializeAction() : void

This isn't done within __construct() since the controller object is only created once in extbase when multiple actions are called in one call. When those change module state, the second action would see old state.

initializeControllerArgumentsBaseValidators()

Collects the base validators which were defined for the data type of each controller argument and adds them to the argument's validator chain.

public initializeControllerArgumentsBaseValidators() : void
Internal

initiatePasswordResetAction()

Starts the password reset process for a selected user.

public initiatePasswordResetAction(int $user) : ResponseInterface
Parameters
$user : int
Return values
ResponseInterface

injectEventDispatcher()

public injectEventDispatcher(EventDispatcherInterface $eventDispatcher) : void
Parameters
$eventDispatcher : EventDispatcherInterface

injectResponseFactory()

public final injectResponseFactory(ResponseFactoryInterface $responseFactory) : void
Parameters
$responseFactory : ResponseFactoryInterface

injectStreamFactory()

public final injectStreamFactory(StreamFactoryInterface $streamFactory) : void
Parameters
$streamFactory : StreamFactoryInterface

listAction()

Displays all BackendUsers

public listAction([Demand|null $demand = null ][, int $currentPage = 1 ][, string $operation = '' ]) : ResponseInterface
Parameters
$demand : Demand|null = null
$currentPage : int = 1
$operation : string = ''
Return values
ResponseInterface

onlineAction()

Views all currently logged in BackendUsers and their sessions

public onlineAction() : ResponseInterface
Return values
ResponseInterface

processRequest()

Store a valid selected action as defaultAction

public processRequest(RequestInterface $request) : ResponseInterface
Parameters
$request : RequestInterface

The request object

Return values
ResponseInterface

removeAllFromCompareListAction()

Removes all backend users from the compare list

public removeAllFromCompareListAction() : ResponseInterface
Return values
ResponseInterface

removeAllGroupsFromCompareListAction()

Removes all backend user groups from the compare list

public removeAllGroupsFromCompareListAction() : ResponseInterface
Return values
ResponseInterface

removeFromCompareListAction()

Removes given backend user to the compare list

public removeFromCompareListAction(int $uid[, int $redirectToCompare = 0 ]) : ResponseInterface
Parameters
$uid : int
$redirectToCompare : int = 0
Return values
ResponseInterface

removeGroupFromCompareListAction()

Removes given backend user group to the compare list

public removeGroupFromCompareListAction(int $uid[, int $redirectToCompare = 0 ]) : ResponseInterface
Parameters
$uid : int
$redirectToCompare : int = 0
Return values
ResponseInterface

showAction()

public showAction([int $uid = 0 ]) : ResponseInterface
Parameters
$uid : int = 0
Return values
ResponseInterface

throwStatus()

Sends the specified HTTP status immediately and only stops to run back through the middleware stack.

public throwStatus(int $statusCode[, string $statusMessage = '' ][, string|null $content = null ]) : never

Note: If any other plugin or content or hook is used within a frontend request, this is skipped by design.

Parameters
$statusCode : int

The HTTP status code

$statusMessage : string = ''

A custom HTTP status message

$content : string|null = null

Body content which further explains the status

Tags
throws
PropagateResponseException
Return values
never

addBaseUriIfNecessary()

Adds the base uri if not already in place.

protected addBaseUriIfNecessary(string $uri) : string
Parameters
$uri : string
Internal
Return values
string

addErrorFlashMessage()

If an error occurred during this request, this adds a flash message describing the error to the flash message container.

protected addErrorFlashMessage() : void
Internal

addMainMenu()

Doc header main drop down

protected addMainMenu(string $currentAction) : void
Parameters
$currentAction : string

addToCompareList()

Attaches the given uid to the requested compare list

protected addToCompareList(string $listIdentifier, int $uid) : void
Parameters
$listIdentifier : string
$uid : int

callActionMethod()

Calls the specified action method and passes the arguments.

protected callActionMethod(RequestInterface $request) : ResponseInterface

If the action returns a string, it is appended to the content in the response object. If the action doesn't return anything and a valid view exists, the view is rendered automatically.

Parameters
$request : RequestInterface
Internal
Return values
ResponseInterface

cleanCompareList()

Removes all items from the requested compare list

protected cleanCompareList(string $listIdentifier) : void
Parameters
$listIdentifier : string

errorAction()

A special action which is called if the originally intended action could not be called, for example if the arguments were not valid.

protected errorAction() : ResponseInterface

The default implementation sets a flash message, request errors and forwards back to the originating action. This is suitable for most actions dealing with form input.

We clear the page cache by default on an error as well, as we need to make sure the data is re-evaluated when the user changes something.

Return values
ResponseInterface

filemountsAction()

protected filemountsAction([int $currentPage = 1 ]) : ResponseInterface
Parameters
$currentPage : int = 1
Return values
ResponseInterface

forwardToReferringRequest()

If information on the request before the current request was sent, this method forwards back to the originating request. This effectively ends processing of the current request, so do not call this method before you have finished the necessary business logic!

protected forwardToReferringRequest() : ResponseInterface|null
Internal
Return values
ResponseInterface|null

getErrorFlashMessage()

A template method for displaying custom error flash messages, or to display no flash message at all on errors. Override this to customize the flash message in your action controller.

protected getErrorFlashMessage() : bool|string

Returns either the flash message or "false" if no flash message should be set

Return values
bool|string

getFlashMessageQueue()

todo: As soon as the incoming request contains the compiled plugin namespace, extbase will offer a trait to create a flash message identifier from the current request. Users then should inject the flash message service themselves if needed.

protected getFlashMessageQueue([string|null $identifier = null ]) : FlashMessageQueue
Parameters
$identifier : string|null = null
Internal
Return values
FlashMessageQueue

getFlattenedValidationErrorMessage()

Returns a string with a basic error message about validation failure.

protected getFlattenedValidationErrorMessage() : string

We may add all validation error messages to a log file in the future, but for security reasons (@see #54074) we do not return these here.

Internal
Return values
string

getOnlineBackendUsers()

Create an array with the uids of online users as the keys [ 1 => true, 5 => true ]

protected getOnlineBackendUsers() : array<string|int, mixed>
Return values
array<string|int, mixed>

handleArgumentMappingExceptions()

This method processes exceptions that occur due to missing or not found targets or arguments during argument mapping. Based on configuration settings, either a "page not found" response is triggered or the original exception is propagated.

protected handleArgumentMappingExceptions(Exception $exception) : void

Extension authors can override this function to implement additional/custom argument mapping exception handling

Parameters
$exception : Exception

htmlResponse()

Returns a response object with either the given html string or the current rendered view as content.

protected htmlResponse([string|null $html = null ]) : ResponseInterface
Parameters
$html : string|null = null
Return values
ResponseInterface

initializeActionMethodArguments()

Implementation of the arguments initialization in the action controller: Automatically registers arguments of the current action

protected initializeActionMethodArguments() : void

Don't override this method - use initializeAction() instead.

Internal
Tags
throws
InvalidArgumentTypeException
see
initializeArguments()

initializeActionMethodValidators()

Adds the needed validators to the Arguments:

protected initializeActionMethodValidators() : void
  • Validators checking the data type from the param annotation
  • Custom validators specified with validate annotations.
  • Model-based validators (validate annotations in the model)
  • Custom model validator classes
Internal

initializeView()

Assign default variables to ModuleTemplate view

protected initializeView() : void

jsonResponse()

Returns a response object with either the given json string or the current rendered view as content. Mainly to be used for actions / controllers using the JsonView.

protected jsonResponse([string|null $json = null ]) : ResponseInterface
Parameters
$json : string|null = null
Return values
ResponseInterface

mapRequestArgumentsToControllerArguments()

Maps arguments delivered by the request object to the local controller arguments.

protected mapRequestArgumentsToControllerArguments() : void
Internal

redirect()

Redirects the request to another action and / or controller.

protected redirect(string|null $actionName[, string|null $controllerName = null ][, string|null $extensionName = null ][, array<string|int, mixed>|null $arguments = null ][, int|null $pageUid = null ][, null $_ = null ][, int $statusCode = 303 ]) : ResponseInterface

Redirect will be sent to the client which then performs another request to the new URI.

Parameters
$actionName : string|null

Name of the action to forward to

$controllerName : string|null = null

Unqualified object name of the controller to forward to. If not specified, the current controller is used.

$extensionName : string|null = null

Name of the extension containing the controller to forward to. If not specified, the current extension is assumed.

$arguments : array<string|int, mixed>|null = null

Arguments to pass to the target action

$pageUid : int|null = null

Target page uid. If NULL, the current page uid is used

$_ : null = null

(optional) Unused

$statusCode : int = 303

(optional) The HTTP status code for the redirect. Default is "303 See Other

Return values
ResponseInterface

redirectToUri()

Redirects the web request to another uri.

protected redirectToUri(string|UriInterface $uri[, null $_ = null ][, int $statusCode = 303 ]) : ResponseInterface
Parameters
$uri : string|UriInterface

A string representation of a URI

$_ : null = null

(optional) Unused

$statusCode : int = 303

(optional) The HTTP status code for the redirect. Default is "303 See Other"

Return values
ResponseInterface

removeFromCompareList()

Removes the given uid from the requested compare list

protected removeFromCompareList(string $listIdentifier, int $uid) : void
Parameters
$listIdentifier : string
$uid : int

renderAssetsForRequest()

Method which initializes assets that should be attached to the response for the given $request, which contains parameters that an override can use to determine which assets to add via PageRenderer.

protected renderAssetsForRequest(RequestInterface $request) : void

This default implementation will attempt to render the sections "HeaderAssets" and "FooterAssets" from the template that is being rendered, inserting the rendered content into either page header or footer, as appropriate. Both sections are optional and can be used one or both in combination.

You can add assets with this method without worrying about duplicates, if for example you do this in a plugin that gets used multiple time on a page.

Parameters
$request : RequestInterface
Internal

resolveActionMethodName()

Resolves and checks the current action method name

protected resolveActionMethodName() : string
Internal
Tags
throws
NoSuchActionException

if the action specified in the request object does not exist (and if there's no default action either).

Return values
string

resolveView()

Prepares a view for the current action.

protected resolveView() : ViewInterface
Internal
Tags
todo

We may want to decide in extbase to go away from the automatic view preparation via processRequest() and this method for actions. We could very well postulate actions should take care of creating "their" view on their own using a ViewFactoryInterface implementation, similar to what is done with request creation already (which needs further work, too), and have a helper in this class to easily create a standard view. This would dissolve the ugly $this->defaultViewObjectName property, which is more a burden than helpful since controllers then need to have an initializeFooAction() just to set this property when different actions want different views. Also, it does not allow actions to have no view prepared at all, for instance when they just want to create a json response by json_encode()'ing stuff. We should look at this in v14, which renders property defaultViewObjectName even more useless.

Return values
ViewInterface

terminateBackendUserSessionAction()

Terminate BackendUser session and logout corresponding client Redirects to onlineAction with message

protected terminateBackendUserSessionAction(string $sessionId) : ResponseInterface
Parameters
$sessionId : string
Return values
ResponseInterface

        
On this page

Search results