Details
-
Improvement
-
Resolution: Done
-
High
-
None
Description
There should be an option to disable and enable user accounts from the UI like it was done in legacy. Disabled users are not allowed to log in.
Currently, you can achieve this only by using Public PHP API. Example code snippet:
$repository = $this->getContainer()->get('ezpublish.api.repository'); $userService = $repository->getUserService(); $permissionResolver = $repository->getPermissionResolver(); $user = $userService->loadUserByLogin('admin'); $permissionResolver->setCurrentUserReference($user); $userToDisable = $userService->loadUserByLogin('test_editor'); $userUpdateStruct = $userService->newUserUpdateStruct(); $userUpdateStruct->enabled = false; $userToDisable = $userService->updateUser($userToDisable, $userUpdateStruct);