This method basically "creates" a user like createUser() would, except that it does not create the User
object itself. If you need to create the User object elsewhere, for example in your ActionController, make sure
to call this method for registering the new user instead of adding it to the PartyRepository manually.
This method also creates a new user workspace for the given user if no such workspace exist.
public addUser ( string $username, string $password, |
||
$username | string | The username of the user to be created. |
$password | string | Password of the user to be created |
$user | The pre-built user object to start with | |
$roleIdentifiers | array | A list of role identifiers to assign |
$authenticationProviderName | string | Name of the authentication provider to use. Example: "Typo3BackendProvider" |
return | The same user object |
/** * Create a new user * * @param string $username The user name (ie. account identifier) of the new user * @param array $password Expects an array in the format array('<password>', '<password confirmation>') * @param User $user The user to create * @param array $roleIdentifiers A list of roles (role identifiers) to assign to the new user * @Flow\Validate(argumentName="username", type="\Neos\Flow\Validation\Validator\NotEmptyValidator") * @Flow\Validate(argumentName="username", type="\Neos\Neos\Validation\Validator\UserDoesNotExistValidator") * @Flow\Validate(argumentName="password", type="\Neos\Neos\Validation\Validator\PasswordValidator", options={ "allowEmpty"=0, "minimum"=1, "maximum"=255 }) * @return void */ public function createAction($username, array $password, User $user, array $roleIdentifiers) { $this->userService->addUser($username, $password[0], $user, $roleIdentifiers); $this->addFlashMessage('The user "%s" has been created.', 'User created', Message::SEVERITY_OK, array(htmlspecialchars($username)), 1416225561); $this->redirect('index'); }