PHP Класс Neos\Neos\Domain\Service\UserService

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$accountFactory Neos\Flow\Security\AccountFactory
$accountRepository Neos\Flow\Security\AccountRepository
$authenticationManager Neos\Flow\Security\Authentication\AuthenticationManagerInterface
$defaultAuthenticationProviderName string Might be configurable in the future, for now centralising this as a "constant"
$hashService Neos\Flow\Security\Cryptography\HashService
$now Neos\Flow\Utility\Now
$partyRepository Neos\Party\Domain\Repository\PartyRepository
$partyService Neos\Party\Domain\Service\PartyService
$policyService Neos\Flow\Security\Policy\PolicyService
$privilegeManager Neos\Flow\Security\Authorization\PrivilegeManagerInterface
$publishingService Neos\Neos\Service\PublishingService
$runtimeUserCache array
$securityContext Neos\Flow\Security\Context
$userRepository Neos\Neos\Domain\Repository\UserRepository
$workspaceRepository Neos\ContentRepository\Domain\Repository\WorkspaceRepository

Открытые методы

Метод Описание
activateUser ( User $user ) : void Reactivates the given user
addRoleToAccount ( Account $account, string $roleIdentifier ) : integer Adds the specified role to the given account and potentially carries out further actions which are needed to properly reflect these changes.
addRoleToUser ( User $user, string $roleIdentifier ) : integer Adds the specified role to all accounts of the given user and potentially carries out further actions which are needed to properly reflect these changes.
addUser ( string $username, string $password, User $user, array $roleIdentifiers = null, string $authenticationProviderName = null ) : User Adds a user whose User object has been created elsewhere
createUser ( string $username, string $password, string $firstName, string $lastName, array $roleIdentifiers = null, string $authenticationProviderName = null ) : User Creates a user based on the given information
currentUserCanManageWorkspace ( Workspace $workspace ) : boolean Checks if the current user may manage the given workspace according to one the roles of the user's accounts
currentUserCanPublishToWorkspace ( Workspace $workspace ) : boolean Checks if the current user may publish to the given workspace according to one the roles of the user's accounts
currentUserCanReadWorkspace ( Workspace $workspace ) : boolean Checks if the current user may read the given workspace according to one the roles of the user's accounts
currentUserCanTransferOwnershipOfWorkspace ( Workspace $workspace ) : boolean Checks if the current user may transfer ownership of the given workspace
deactivateUser ( User $user ) : void Deactivates the given user
deleteUser ( User $user ) : void Deletes the specified user and all remaining content in his personal workspaces
emitRolesAdded ( Account $account, array $roles ) : void Signals that new roles have been assigned to the given account
emitRolesRemoved ( Account $account, array $roles ) : void Signals that roles have been removed to the given account
emitUserActivated ( User $user ) : void Signals that the given user has been activated
emitUserCreated ( User $user ) : void Signals that a new user, including a new account has been created.
emitUserDeactivated ( User $user ) : void Signals that the given user has been activated
emitUserDeleted ( User $user ) : void Signals that the given user has been deleted.
emitUserUpdated ( User $user ) : void Signals that the given user data has been updated.
getCurrentUser ( ) : User Returns the currently logged in user, if any
getDefaultAuthenticationProviderName ( ) : string Returns the default authentication provider name
getUser ( string $username, string $authenticationProviderName = null ) : User Retrieves an existing user by the given username
getUsername ( User $user, string $authenticationProviderName = null ) : string Returns the username of the given user
getUsers ( ) : array Retrieves a list of all existing users
removeRoleFromAccount ( Account $account, string $roleIdentifier ) : integer Removes the specified role from the given account and potentially carries out further actions which are needed to properly reflect these changes.
removeRoleFromUser ( User $user, string $roleIdentifier ) : integer Removes the specified role from all accounts of the given user and potentially carries out further actions which are needed to properly reflect these changes.
setRolesForAccount ( Account $account, array $newRoleIdentifiers ) : void Overrides any assigned roles of the given account and potentially carries out further actions which are needed to properly reflect these changes.
setUserPassword ( User $user, string $password ) : void Sets a new password for the given user
updateUser ( User $user ) : void Updates the given user in the respective repository and potentially executes further actions depending on what has been changed.

Защищенные методы

Метод Описание
createPersonalWorkspace ( User $user, Account $account ) Creates a personal workspace for the given user's account if it does not exist already.
deletePersonalWorkspace ( string $accountIdentifier ) : void Removes all personal workspaces of the given user's account if these workspaces exist. Also removes all possibly existing content of these workspaces.
getAllRoles ( User $user ) : array Returns an array with all roles of a user's accounts, including parent roles, the "Everybody" role and the "AuthenticatedUser" role, assuming that the user is logged in.
normalizeRoleIdentifier ( string $roleIdentifier ) : string Replaces a role identifier not containing a "." into fully qualified role identifier from the Neos.Neos namespace.
normalizeRoleIdentifiers ( array $roleIdentifiers ) : array Replaces role identifiers not containing a "." into fully qualified role identifiers from the Neos.Neos namespace.
removeOwnerFromUsersWorkspaces ( User $user ) : void Removes ownership of all workspaces currently owned by the given user

Описание методов

activateUser() публичный Метод

Reactivates the given user
public activateUser ( User $user ) : void
$user Neos\Neos\Domain\Model\User The user to deactivate
Результат void

addRoleToAccount() публичный Метод

Adds the specified role to the given account and potentially carries out further actions which are needed to properly reflect these changes.
public addRoleToAccount ( Account $account, string $roleIdentifier ) : integer
$account Neos\Flow\Security\Account The account to add roles to
$roleIdentifier string A fully qualified role identifier, or a role identifier relative to the Neos.Neos namespace
Результат integer How often this role has been added to the given account (effectively can be 1 or 0)

addRoleToUser() публичный Метод

Adds the specified role to all accounts of the given user and potentially carries out further actions which are needed to properly reflect these changes.
public addRoleToUser ( User $user, string $roleIdentifier ) : integer
$user Neos\Neos\Domain\Model\User The user to add roles to
$roleIdentifier string A fully qualified role identifier, or a role identifier relative to the Neos.Neos namespace
Результат integer How often this role has been added to accounts owned by the user

addUser() публичный Метод

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, User $user, array $roleIdentifiers = null, string $authenticationProviderName = null ) : User
$username string The username of the user to be created.
$password string Password of the user to be created
$user Neos\Neos\Domain\Model\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"
Результат Neos\Neos\Domain\Model\User The same user object

createPersonalWorkspace() защищенный Метод

Creates a personal workspace for the given user's account if it does not exist already.
protected createPersonalWorkspace ( User $user, Account $account )
$user Neos\Neos\Domain\Model\User The new user to create a workspace for
$account Neos\Flow\Security\Account The user's backend account

createUser() публичный Метод

The created user and account are automatically added to their respective repositories and thus be persisted.
public createUser ( string $username, string $password, string $firstName, string $lastName, array $roleIdentifiers = null, string $authenticationProviderName = null ) : User
$username string The username of the user to be created.
$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
$roleIdentifiers array A list of role identifiers to assign
$authenticationProviderName string Name of the authentication provider to use. Example: "Typo3BackendProvider"
Результат Neos\Neos\Domain\Model\User The created user instance

currentUserCanManageWorkspace() публичный Метод

In future versions, this logic may be implemented in Neos in a more generic way (for example, by means of an ACL object), but for now, this method exists in order to at least centralize and encapsulate the required logic.
public currentUserCanManageWorkspace ( Workspace $workspace ) : boolean
$workspace Neos\ContentRepository\Domain\Model\Workspace The workspace
Результат boolean

currentUserCanPublishToWorkspace() публичный Метод

In future versions, this logic may be implemented in Neos in a more generic way (for example, by means of an ACL object), but for now, this method exists in order to at least centralize and encapsulate the required logic.
public currentUserCanPublishToWorkspace ( Workspace $workspace ) : boolean
$workspace Neos\ContentRepository\Domain\Model\Workspace The workspace
Результат boolean

currentUserCanReadWorkspace() публичный Метод

In future versions, this logic may be implemented in Neos in a more generic way (for example, by means of an ACL object), but for now, this method exists in order to at least centralize and encapsulate the required logic.
public currentUserCanReadWorkspace ( Workspace $workspace ) : boolean
$workspace Neos\ContentRepository\Domain\Model\Workspace The workspace
Результат boolean

currentUserCanTransferOwnershipOfWorkspace() публичный Метод

In future versions, this logic may be implemented in Neos in a more generic way (for example, by means of an ACL object), but for now, this method exists in order to at least centralize and encapsulate the required logic.
public currentUserCanTransferOwnershipOfWorkspace ( Workspace $workspace ) : boolean
$workspace Neos\ContentRepository\Domain\Model\Workspace The workspace
Результат boolean

deactivateUser() публичный Метод

Deactivates the given user
public deactivateUser ( User $user ) : void
$user Neos\Neos\Domain\Model\User The user to deactivate
Результат void

deletePersonalWorkspace() защищенный Метод

Removes all personal workspaces of the given user's account if these workspaces exist. Also removes all possibly existing content of these workspaces.
protected deletePersonalWorkspace ( string $accountIdentifier ) : void
$accountIdentifier string Identifier of the user's account
Результат void

deleteUser() публичный Метод

Deletes the specified user and all remaining content in his personal workspaces
public deleteUser ( User $user ) : void
$user Neos\Neos\Domain\Model\User The user to delete
Результат void

emitRolesAdded() публичный Метод

Signals that new roles have been assigned to the given account
public emitRolesAdded ( Account $account, array $roles ) : void
$account Neos\Flow\Security\Account The account
$roles array
Результат void

emitRolesRemoved() публичный Метод

Signals that roles have been removed to the given account
public emitRolesRemoved ( Account $account, array $roles ) : void
$account Neos\Flow\Security\Account The account
$roles array
Результат void

emitUserActivated() публичный Метод

Signals that the given user has been activated
public emitUserActivated ( User $user ) : void
$user Neos\Neos\Domain\Model\User The user
Результат void

emitUserCreated() публичный Метод

Signals that a new user, including a new account has been created.
public emitUserCreated ( User $user ) : void
$user Neos\Neos\Domain\Model\User The created user
Результат void

emitUserDeactivated() публичный Метод

Signals that the given user has been activated
public emitUserDeactivated ( User $user ) : void
$user Neos\Neos\Domain\Model\User The user
Результат void

emitUserDeleted() публичный Метод

Signals that the given user has been deleted.
public emitUserDeleted ( User $user ) : void
$user Neos\Neos\Domain\Model\User The created user
Результат void

emitUserUpdated() публичный Метод

Signals that the given user data has been updated.
public emitUserUpdated ( User $user ) : void
$user Neos\Neos\Domain\Model\User The created user
Результат void

getAllRoles() защищенный Метод

Returns an array with all roles of a user's accounts, including parent roles, the "Everybody" role and the "AuthenticatedUser" role, assuming that the user is logged in.
protected getAllRoles ( User $user ) : array
$user Neos\Neos\Domain\Model\User The user
Результат array

getCurrentUser() публичный Метод

Returns the currently logged in user, if any
public getCurrentUser ( ) : User
Результат Neos\Neos\Domain\Model\User The currently logged in user, or null

getDefaultAuthenticationProviderName() публичный Метод

Returns the default authentication provider name
public getDefaultAuthenticationProviderName ( ) : string
Результат string

getUser() публичный Метод

Retrieves an existing user by the given username
public getUser ( string $username, string $authenticationProviderName = null ) : User
$username string The username
$authenticationProviderName string Name of the authentication provider to use. Example: "Typo3BackendProvider"
Результат Neos\Neos\Domain\Model\User The user, or null if the user does not exist

getUsername() публичный Метод

Technically, this method will look for the user's backend account (or, if authenticationProviderName is specified, for the account matching the given authentication provider) and return the account's identifier.
public getUsername ( User $user, string $authenticationProviderName = null ) : string
$user Neos\Neos\Domain\Model\User
$authenticationProviderName string
Результат string The username or null if the given user does not have a backend account

getUsers() публичный Метод

Retrieves a list of all existing users
public getUsers ( ) : array
Результат array

normalizeRoleIdentifier() защищенный Метод

Replaces a role identifier not containing a "." into fully qualified role identifier from the Neos.Neos namespace.
protected normalizeRoleIdentifier ( string $roleIdentifier ) : string
$roleIdentifier string
Результат string

normalizeRoleIdentifiers() защищенный Метод

Replaces role identifiers not containing a "." into fully qualified role identifiers from the Neos.Neos namespace.
protected normalizeRoleIdentifiers ( array $roleIdentifiers ) : array
$roleIdentifiers array
Результат array

removeOwnerFromUsersWorkspaces() защищенный Метод

Removes ownership of all workspaces currently owned by the given user
protected removeOwnerFromUsersWorkspaces ( User $user ) : void
$user Neos\Neos\Domain\Model\User The user currently owning workspaces
Результат void

removeRoleFromAccount() публичный Метод

Removes the specified role from the given account and potentially carries out further actions which are needed to properly reflect these changes.
public removeRoleFromAccount ( Account $account, string $roleIdentifier ) : integer
$account Neos\Flow\Security\Account The account to remove roles from
$roleIdentifier string A fully qualified role identifier, or a role identifier relative to the Neos.Neos namespace
Результат integer How often this role has been removed from the given account (effectively can be 1 or 0)

removeRoleFromUser() публичный Метод

Removes the specified role from all accounts of the given user and potentially carries out further actions which are needed to properly reflect these changes.
public removeRoleFromUser ( User $user, string $roleIdentifier ) : integer
$user Neos\Neos\Domain\Model\User The user to remove roles from
$roleIdentifier string A fully qualified role identifier, or a role identifier relative to the Neos.Neos namespace
Результат integer How often this role has been removed from accounts owned by the user

setRolesForAccount() публичный Метод

Overrides any assigned roles of the given account and potentially carries out further actions which are needed to properly reflect these changes.
public setRolesForAccount ( Account $account, array $newRoleIdentifiers ) : void
$account Neos\Flow\Security\Account The account to assign the roles to
$newRoleIdentifiers array A list of fully qualified role identifiers, or role identifiers relative to the Neos.Neos namespace
Результат void

setUserPassword() публичный Метод

This method will iterate over all accounts owned by the given user and, if the account uses a UsernamePasswordToken, sets a new password accordingly.
public setUserPassword ( User $user, string $password ) : void
$user Neos\Neos\Domain\Model\User The user to set the password for
$password string A new password
Результат void

updateUser() публичный Метод

Note: changes to the user's account will not be committed for persistence. Please use addRoleToAccount(), removeRoleFromAccount(), setRolesForAccount() and setUserPassword() for changing account properties.
public updateUser ( User $user ) : void
$user Neos\Neos\Domain\Model\User The modified user
Результат void

Описание свойств

$accountFactory защищенное свойство

protected AccountFactory,Neos\Flow\Security $accountFactory
Результат Neos\Flow\Security\AccountFactory

$accountRepository защищенное свойство

protected AccountRepository,Neos\Flow\Security $accountRepository
Результат Neos\Flow\Security\AccountRepository

$authenticationManager защищенное свойство

protected AuthenticationManagerInterface,Neos\Flow\Security\Authentication $authenticationManager
Результат Neos\Flow\Security\Authentication\AuthenticationManagerInterface

$defaultAuthenticationProviderName защищенное свойство

Might be configurable in the future, for now centralising this as a "constant"
protected string $defaultAuthenticationProviderName
Результат string

$hashService защищенное свойство

protected HashService,Neos\Flow\Security\Cryptography $hashService
Результат Neos\Flow\Security\Cryptography\HashService

$now защищенное свойство

protected Now,Neos\Flow\Utility $now
Результат Neos\Flow\Utility\Now

$partyRepository защищенное свойство

protected PartyRepository,Neos\Party\Domain\Repository $partyRepository
Результат Neos\Party\Domain\Repository\PartyRepository

$partyService защищенное свойство

protected PartyService,Neos\Party\Domain\Service $partyService
Результат Neos\Party\Domain\Service\PartyService

$policyService защищенное свойство

protected PolicyService,Neos\Flow\Security\Policy $policyService
Результат Neos\Flow\Security\Policy\PolicyService

$privilegeManager защищенное свойство

protected PrivilegeManagerInterface,Neos\Flow\Security\Authorization $privilegeManager
Результат Neos\Flow\Security\Authorization\PrivilegeManagerInterface

$publishingService защищенное свойство

protected PublishingService,Neos\Neos\Service $publishingService
Результат Neos\Neos\Service\PublishingService

$runtimeUserCache защищенное свойство

protected array $runtimeUserCache
Результат array

$securityContext защищенное свойство

protected Context,Neos\Flow\Security $securityContext
Результат Neos\Flow\Security\Context

$userRepository защищенное свойство

protected UserRepository,Neos\Neos\Domain\Repository $userRepository
Результат Neos\Neos\Domain\Repository\UserRepository

$workspaceRepository защищенное свойство

protected WorkspaceRepository,Neos\ContentRepository\Domain\Repository $workspaceRepository
Результат Neos\ContentRepository\Domain\Repository\WorkspaceRepository