PHP Class Neos\Neos\Command\UserCommandController

Inheritance: extends Neos\Flow\Cli\CommandController
Show file Open project: neos/neos-development-collection

Protected Properties

Property Type Description
$authenticationProviderSettings array
$userService Neos\Neos\Domain\Service\UserService

Public Methods

Method Description
activateCommand ( string $username, string $authenticationProvider = null ) : void Activate a user
addRoleCommand ( string $username, string $role, string $authenticationProvider = null ) : void Add a role to a user
createCommand ( string $username, string $password, string $firstName, string $lastName, string $roles = null, string $authenticationProvider = null ) : void Create a new user
deactivateCommand ( string $username, string $authenticationProvider = null ) : void Deactivate a user
deleteCommand ( string $username, boolean $assumeYes = false, string $authenticationProvider = null ) : void Delete a user
listCommand ( ) : void List all users
removeRoleCommand ( string $username, string $role, string $authenticationProvider = null ) : void Remove a role from a user
setPasswordCommand ( string $username, string $password, string $authenticationProvider = null ) : void Set a new password for the given user
showCommand ( string $username, string $authenticationProvider = null ) : void Shows the given user

Protected Methods

Method Description
getTableRowForUser ( User $user ) : array Prepares a table row for output with data of the given User
getUserOrFail ( string $username, string $authenticationProviderName ) : User Retrieves the given user or fails by exiting with code 1 and a message

Method Details

activateCommand() public method

This command reactivates possibly expired accounts for the given user. If an authentication provider is specified, this command will look for an account with the given username related to the given provider. Still, this command will activate all accounts of a user, once such a user has been found.
public activateCommand ( string $username, string $authenticationProvider = null ) : void
$username string The username of the user to be activated.
$authenticationProvider string Name of the authentication provider to use for finding the user. Example: "Typo3BackendProvider"
return void

addRoleCommand() public method

This command allows for adding a specific role to an existing user. Roles can optionally be specified as a comma separated list. For all roles provided by Neos, the role namespace "Neos.Neos:" can be omitted. If an authentication provider was specified, the user will be determined by an account identified by "username" related to the given provider. However, once a user has been found, the new role will be added to all existing accounts related to that user, regardless of its authentication provider.
public addRoleCommand ( string $username, string $role, string $authenticationProvider = null ) : void
$username string The username of the user
$role string Role to be added to the user, for example "Neos.Neos:Administrator" or just "Administrator"
$authenticationProvider string Name of the authentication provider to use. Example: "Typo3BackendProvider"
return void

createCommand() public method

This command creates a new user which has access to the backend user interface. More specifically, this command will create a new user and a new account at the same time. The created account is, by default, a Neos backend account using the the "Typo3BackendProvider" for authentication. The given username will be used as an account identifier for that new account. If an authentication provider name is specified, the new account will be created for that provider instead. Roles for the new user can optionally be specified as a comma separated list. For all roles provided by Neos, the role namespace "Neos.Neos:" can be omitted.
public createCommand ( string $username, string $password, string $firstName, string $lastName, string $roles = null, string $authenticationProvider = null ) : void
$username string The username of the user to be created, used as an account identifier for the newly created account
$password string Password of the user to be created
$firstName string First name of the user to be created
$lastName string Last name of the user to be created
$roles string A comma separated list of roles to assign. Examples: "Editor, Acme.Foo:Reviewer"
$authenticationProvider string Name of the authentication provider to use for the new account. Example: "Typo3BackendProvider"
return void

deactivateCommand() public method

This command deactivates a user by flagging all of its accounts as expired. If an authentication provider is specified, this command will look for an account with the given username related to the given provider. Still, this command will deactivate all accounts of a user, once such a user has been found.
public deactivateCommand ( string $username, string $authenticationProvider = null ) : void
$username string The username of the user to be deactivated.
$authenticationProvider string Name of the authentication provider to use for finding the user. Example: "Typo3BackendProvider"
return void

deleteCommand() public method

This command deletes an existing Neos user. All content and data directly related to this user, including but not limited to draft workspace contents, will be removed as well. All accounts owned by the given user will be deleted. If an authentication provider is specified, this command will look for an account with the given username related to the given provider. Specifying an authentication provider does not mean that only the account for that provider is deleted! If a user was found by the combination of username and authentication provider, all related accounts will be deleted.
public deleteCommand ( string $username, boolean $assumeYes = false, string $authenticationProvider = null ) : void
$username string The username of the user to be removed
$assumeYes boolean Assume "yes" as the answer to the confirmation dialog
$authenticationProvider string Name of the authentication provider to use. Example: "Typo3BackendProvider"
return void

getTableRowForUser() protected method

Prepares a table row for output with data of the given User
protected getTableRowForUser ( User $user ) : array
$user Neos\Neos\Domain\Model\User The user
return array

getUserOrFail() protected method

Retrieves the given user or fails by exiting with code 1 and a message
protected getUserOrFail ( string $username, string $authenticationProviderName ) : User
$username string Username of the user to find
$authenticationProviderName string Name of the authentication provider to use
return Neos\Neos\Domain\Model\User The user

listCommand() public method

This command lists all existing Neos users.
public listCommand ( ) : void
return void

removeRoleCommand() public method

This command allows for removal of a specific role from an existing user. If an authentication provider was specified, the user will be determined by an account identified by "username" related to the given provider. However, once a user has been found, the role will be removed from all existing accounts related to that user, regardless of its authentication provider.
public removeRoleCommand ( string $username, string $role, string $authenticationProvider = null ) : void
$username string The username of the user
$role string Role to be removed from the user, for example "Neos.Neos:Administrator" or just "Administrator"
$authenticationProvider string Name of the authentication provider to use. Example: "Typo3BackendProvider"
return void

setPasswordCommand() public method

This command sets a new password for an existing user. More specifically, all accounts related to the user which are based on a username / password token will receive the new password. If an authentication provider was specified, the user will be determined by an account identified by "username" related to the given provider.
public setPasswordCommand ( string $username, string $password, string $authenticationProvider = null ) : void
$username string Username of the user to modify
$password string The new password
$authenticationProvider string Name of the authentication provider to use for finding the user. Example: "Typo3BackendProvider"
return void

showCommand() public method

This command shows some basic details about the given user. If such a user does not exist, this command will exit with a non-zero status code. The user will be retrieved by looking for a Neos backend account with the given identifier (ie. the username) and then retrieving the user which owns that account. If an authentication provider is specified, this command will look for an account identified by "username" for that specific provider.
public showCommand ( string $username, string $authenticationProvider = null ) : void
$username string The username of the user to show. Usually refers to the account identifier of the user's Neos backend account.
$authenticationProvider string Name of the authentication provider to use. Example: "Typo3BackendProvider"
return void

Property Details

$authenticationProviderSettings protected property

protected array $authenticationProviderSettings
return array

$userService protected property

protected UserService,Neos\Neos\Domain\Service $userService
return Neos\Neos\Domain\Service\UserService