Наследование: extends Neos\Party\Domain\Model\Person, implements Neos\ContentRepository\Domain\Model\UserInterface
 /**
  * Prepares a table row for output with data of the given User
  *
  * @param User $user The user
  * @return array
  */
 protected function getTableRowForUser(User $user)
 {
     $roleNames = array();
     $accountIdentifiers = array();
     foreach ($user->getAccounts() as $account) {
         /** @var Account $account */
         $authenticationProviderName = $account->getAuthenticationProviderName();
         if ($authenticationProviderName !== $this->userService->getDefaultAuthenticationProviderName()) {
             $authenticationProviderLabel = ' (' . (isset($this->authenticationProviderSettings[$authenticationProviderName]['label']) ? $this->authenticationProviderSettings[$authenticationProviderName]['label'] : $authenticationProviderName) . ')';
         } else {
             $authenticationProviderLabel = '';
         }
         $accountIdentifiers[] = $account->getAccountIdentifier() . $authenticationProviderLabel;
         foreach ($account->getRoles() as $role) {
             /** @var Role $role */
             $roleNames[] = $role->getIdentifier();
         }
     }
     return array($user->getName()->getFullName(), $user->getPrimaryElectronicAddress(), implode(', ', $accountIdentifiers), implode(', ', $roleNames), $user->isActive() ? 'yes' : 'no');
 }
 /**
  * Delete an electronic address action
  *
  * @param User $user
  * @param ElectronicAddress $electronicAddress
  * @return void
  */
 public function deleteElectronicAddressAction(User $user, ElectronicAddress $electronicAddress)
 {
     $user->removeElectronicAddress($electronicAddress);
     $this->userService->updateUser($user);
     $this->addFlashMessage('The electronic address "%s" (%s) has been deleted for "%s".', 'Electronic address removed', Message::SEVERITY_NOTICE, array(htmlspecialchars($electronicAddress->getIdentifier()), htmlspecialchars($electronicAddress->getType()), htmlspecialchars($user->getName())), 1412374678);
     $this->redirect('edit', null, null, array('user' => $user));
 }
Пример #3
0
 /**
  * @test
  */
 public function constructorInitializesPreferences()
 {
     $user = new User();
     $this->assertInstanceOf(UserPreferences::class, $user->getPreferences());
 }
 /**
  * Creates a personal workspace for the given user's account if it does not exist already.
  *
  * @param User $user The new user to create a workspace for
  * @param Account $account The user's backend account
  * @throws IllegalObjectTypeException
  */
 protected function createPersonalWorkspace(User $user, Account $account)
 {
     $userWorkspaceName = UserUtility::getPersonalWorkspaceNameForUsername($account->getAccountIdentifier());
     $userWorkspace = $this->workspaceRepository->findByIdentifier($userWorkspaceName);
     if ($userWorkspace === null) {
         $liveWorkspace = $this->workspaceRepository->findByIdentifier('live');
         if (!$liveWorkspace instanceof Workspace) {
             $liveWorkspace = new Workspace('live');
             $liveWorkspace->setTitle('Live');
             $this->workspaceRepository->add($liveWorkspace);
         }
         $userWorkspace = new Workspace($userWorkspaceName, $liveWorkspace, $user);
         $userWorkspace->setTitle((string) $user->getName());
         $this->workspaceRepository->add($userWorkspace);
     }
 }