コード例 #1
0
ファイル: SSOListener.php プロジェクト: CG77/ezpublish-kernel
 /**
  * Iterates over legacy SSO handlers, and pre-authenticates a user if a handler returns one.
  *
  * @param Request $request A Request instance
  *
  * @return array An array composed of the user and the credentials
  */
 protected function getPreAuthenticatedData(Request $request)
 {
     $kernelClosure = $this->legacyKernelClosure;
     /** @var \ezpKernelHandler $legacyKernel */
     $legacyKernel = $kernelClosure();
     $logger = $this->logger;
     $legacyUser = $legacyKernel->runCallback(function () use($logger) {
         foreach (eZINI::instance()->variable('UserSettings', 'SingleSignOnHandlerArray') as $ssoHandlerName) {
             $className = 'eZ' . $ssoHandlerName . 'SSOHandler';
             if (!class_exists($className)) {
                 if ($logger) {
                     $logger->error("Undefined legacy SSOHandler class: {$className}");
                 }
                 continue;
             }
             $ssoHandler = new $className();
             $ssoUser = $ssoHandler->handleSSOLogin();
             if (!$ssoUser instanceof eZUser) {
                 continue;
             }
             $logger->info("Matched user using eZ legacy SSO Handler: {$className}");
             return $ssoUser;
         }
     }, false, false);
     // No matched user with legacy.
     if (!$legacyUser instanceof eZUser) {
         return array('', '');
     }
     $user = new User($this->userService->loadUser($legacyUser->attribute('contentobject_id')), array('ROLE_USER'));
     return array($user, $user->getPassword());
 }
コード例 #2
0
ファイル: Handler.php プロジェクト: bdunogier/eziftttbundle
 public function handleAction(Request $request)
 {
     $user = $this->userService->loadUserByCredentials($request->username, $request->password);
     $this->repository->setCurrentUser($user);
     $contentCreateStruct = $this->contentProvider->newContentCreateStructFromRequest($request);
     $locationCreateStruct = $this->contentProvider->newLocationCreateStructFromRequest($request);
     $content = $this->contentService->createContent($contentCreateStruct, array($locationCreateStruct));
     $this->contentService->publishVersion($content->versionInfo);
 }
コード例 #3
0
 /**
  * Saves content draft corresponding to $data.
  * Depending on the nature of $data (create or update data), the draft will either be created or simply updated.
  *
  * @param ContentStruct|\EzSystems\RepositoryForms\Data\User\UserCreateData $data
  * @param $languageCode
  *
  * @return \eZ\Publish\API\Repository\Values\Content\Content
  */
 private function saveDraft(UserCreateData $data, $languageCode)
 {
     foreach ($data->fieldsData as $fieldDefIdentifier => $fieldData) {
         if ($fieldData->getFieldTypeIdentifier() !== 'ezuser') {
             $data->setField($fieldDefIdentifier, $fieldData->value, $languageCode);
         }
     }
     return $this->repository->sudo(function () use($data) {
         return $this->userService->createUser($data, $data->getParentGroups());
     });
 }
コード例 #4
0
 public function updateContentTypeAction(Request $request, $contentTypeId, $languageCode = null)
 {
     $languageCode = $languageCode ?: $this->prioritizedLanguages[0];
     // First try to load the draft.
     // If it doesn't exist, create it.
     try {
         $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);
     } catch (NotFoundException $e) {
         $contentTypeDraft = $this->contentTypeService->createContentTypeDraft($this->contentTypeService->loadContentType($contentTypeId));
     }
     $contentTypeData = (new ContentTypeDraftMapper())->mapToFormData($contentTypeDraft);
     $form = $this->createForm('ezrepoforms_contenttype_update', $contentTypeData, ['languageCode' => $languageCode]);
     $actionUrl = $this->generateUrl('admin_contenttypeUpdate', ['contentTypeId' => $contentTypeId, 'languageCode' => $languageCode]);
     // Synchronize form and data.
     $form->handleRequest($request);
     $hasErrors = false;
     if ($form->isValid()) {
         $this->contentTypeActionDispatcher->dispatchFormAction($form, $contentTypeData, $form->getClickedButton() ? $form->getClickedButton()->getName() : null, ['languageCode' => $languageCode]);
         if ($response = $this->contentTypeActionDispatcher->getResponse()) {
             return $response;
         }
         return $this->redirectAfterFormPost($actionUrl);
     } elseif ($form->isSubmitted()) {
         $hasErrors = true;
     }
     return $this->render('eZPlatformUIBundle:ContentType:update_content_type.html.twig', ['form' => $form->createView(), 'action_url' => $actionUrl, 'contentTypeName' => $contentTypeDraft->getName($languageCode), 'contentTypeDraft' => $contentTypeDraft, 'modifier' => $this->userService->loadUser($contentTypeDraft->modifierId), 'languageCode' => $languageCode, 'hasErrors' => $hasErrors]);
 }
コード例 #5
0
ファイル: User.php プロジェクト: CG77/ezpublish-kernel
 /**
  * Assigns the user to a user group
  *
  * @param $userId
  *
  * @throws \eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException
  * @return \eZ\Publish\Core\REST\Server\Values\UserGroupRefList
  */
 public function assignUserToUserGroup($userId)
 {
     $user = $this->userService->loadUser($userId);
     try {
         $userGroupLocation = $this->locationService->loadLocation($this->extractLocationIdFromPath($this->request->query->get('group')));
     } catch (APINotFoundException $e) {
         throw new Exceptions\ForbiddenException($e->getMessage());
     }
     try {
         $userGroup = $this->userService->loadUserGroup($userGroupLocation->contentId);
     } catch (APINotFoundException $e) {
         throw new Exceptions\ForbiddenException($e->getMessage());
     }
     try {
         $this->userService->assignUserToUserGroup($user, $userGroup);
     } catch (InvalidArgumentException $e) {
         throw new Exceptions\ForbiddenException($e->getMessage());
     }
     $userGroups = $this->userService->loadUserGroupsOfUser($user);
     $restUserGroups = array();
     foreach ($userGroups as $userGroup) {
         $userGroupContentInfo = $userGroup->getVersionInfo()->getContentInfo();
         $userGroupLocation = $this->locationService->loadLocation($userGroupContentInfo->mainLocationId);
         $contentType = $this->contentTypeService->loadContentType($userGroupContentInfo->contentTypeId);
         $restUserGroups[] = new Values\RestUserGroup($userGroup, $contentType, $userGroupContentInfo, $userGroupLocation, $this->contentService->loadRelations($userGroup->getVersionInfo()));
     }
     return new Values\UserGroupRefList($restUserGroups, $this->router->generate('ezpublish_rest_loadUserGroupsOfUser', array('userId' => $userId)), $userId);
 }
コード例 #6
0
 /**
  * Parse input structure
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\API\Repository\Values\User\UserGroupCreateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $contentType = null;
     if (array_key_exists('ContentType', $data) && is_array($data['ContentType'])) {
         if (!array_key_exists('_href', $data['ContentType'])) {
             throw new Exceptions\Parser("Missing '_href' attribute for ContentType element in UserGroupCreate.");
         }
         $contentType = $this->contentTypeService->loadContentType($this->requestParser->parseHref($data['ContentType']['_href'], 'contentTypeId'));
     }
     if (!array_key_exists('mainLanguageCode', $data)) {
         throw new Exceptions\Parser("Missing 'mainLanguageCode' element for UserGroupCreate.");
     }
     $userGroupCreateStruct = $this->userService->newUserGroupCreateStruct($data['mainLanguageCode'], $contentType);
     if (array_key_exists('Section', $data) && is_array($data['Section'])) {
         if (!array_key_exists('_href', $data['Section'])) {
             throw new Exceptions\Parser("Missing '_href' attribute for Section element in UserGroupCreate.");
         }
         $userGroupCreateStruct->sectionId = $this->requestParser->parseHref($data['Section']['_href'], 'sectionId');
     }
     if (array_key_exists('remoteId', $data)) {
         $userGroupCreateStruct->remoteId = $data['remoteId'];
     }
     if (!array_key_exists('fields', $data) || !is_array($data['fields']) || !is_array($data['fields']['field'])) {
         throw new Exceptions\Parser("Missing or invalid 'fields' element for UserGroupCreate.");
     }
     foreach ($data['fields']['field'] as $fieldData) {
         if (!array_key_exists('fieldDefinitionIdentifier', $fieldData)) {
             throw new Exceptions\Parser("Missing 'fieldDefinitionIdentifier' element in field data for UserGroupCreate.");
         }
         $fieldDefinition = $userGroupCreateStruct->contentType->getFieldDefinition($fieldData['fieldDefinitionIdentifier']);
         if (!$fieldDefinition) {
             throw new Exceptions\Parser("'{$fieldData['fieldDefinitionIdentifier']}' is invalid field definition identifier for '{$userGroupCreateStruct->contentType->identifier}' content type in UserGroupCreate.");
         }
         if (!array_key_exists('fieldValue', $fieldData)) {
             throw new Exceptions\Parser("Missing 'fieldValue' element for '{$fieldData['fieldDefinitionIdentifier']}' identifier in UserGroupCreate.");
         }
         $fieldValue = $this->fieldTypeParser->parseValue($fieldDefinition->fieldTypeIdentifier, $fieldData['fieldValue']);
         $languageCode = null;
         if (array_key_exists('languageCode', $fieldData)) {
             $languageCode = $fieldData['languageCode'];
         }
         $userGroupCreateStruct->setField($fieldData['fieldDefinitionIdentifier'], $fieldValue, $languageCode);
     }
     return $userGroupCreateStruct;
 }
コード例 #7
0
 /**
  * Parse input structure.
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\Core\REST\Server\Values\RestUserGroupUpdateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $parsedData = array();
     if (array_key_exists('mainLanguageCode', $data)) {
         $parsedData['mainLanguageCode'] = $data['mainLanguageCode'];
     }
     if (array_key_exists('Section', $data) && is_array($data['Section'])) {
         if (!array_key_exists('_href', $data['Section'])) {
             throw new Exceptions\Parser("Missing '_href' attribute for Section element in UserGroupUpdate.");
         }
         $parsedData['sectionId'] = $this->requestParser->parseHref($data['Section']['_href'], 'sectionId');
     }
     if (array_key_exists('remoteId', $data)) {
         $parsedData['remoteId'] = $data['remoteId'];
     }
     if (array_key_exists('fields', $data)) {
         $groupLocationParts = explode('/', $this->requestParser->parseHref($data['__url'], 'groupPath'));
         $groupLocation = $this->locationService->loadLocation(array_pop($groupLocationParts));
         if (!is_array($data['fields']) || !array_key_exists('field', $data['fields']) || !is_array($data['fields']['field'])) {
             throw new Exceptions\Parser("Invalid 'fields' element for UserGroupUpdate.");
         }
         $parsedData['fields'] = array();
         foreach ($data['fields']['field'] as $fieldData) {
             if (!array_key_exists('fieldDefinitionIdentifier', $fieldData)) {
                 throw new Exceptions\Parser("Missing 'fieldDefinitionIdentifier' element in field data for UserGroupUpdate.");
             }
             if (!array_key_exists('fieldValue', $fieldData)) {
                 throw new Exceptions\Parser("Missing 'fieldValue' element for '{$fieldData['fieldDefinitionIdentifier']}' identifier in UserGroupUpdate.");
             }
             $fieldValue = $this->fieldTypeParser->parseFieldValue($groupLocation->contentId, $fieldData['fieldDefinitionIdentifier'], $fieldData['fieldValue']);
             $languageCode = null;
             if (array_key_exists('languageCode', $fieldData)) {
                 $languageCode = $fieldData['languageCode'];
             }
             $parsedData['fields'][$fieldData['fieldDefinitionIdentifier']] = array('fieldValue' => $fieldValue, 'languageCode' => $languageCode);
         }
     }
     $userGroupUpdateStruct = $this->userService->newUserGroupUpdateStruct();
     if (!empty($parsedData)) {
         if (array_key_exists('mainLanguageCode', $parsedData) || array_key_exists('remoteId', $parsedData)) {
             $userGroupUpdateStruct->contentMetadataUpdateStruct = $this->contentService->newContentMetadataUpdateStruct();
             if (array_key_exists('mainLanguageCode', $parsedData)) {
                 $userGroupUpdateStruct->contentMetadataUpdateStruct->mainLanguageCode = $parsedData['mainLanguageCode'];
             }
             if (array_key_exists('remoteId', $parsedData)) {
                 $userGroupUpdateStruct->contentMetadataUpdateStruct->remoteId = $parsedData['remoteId'];
             }
         }
         if (array_key_exists('fields', $parsedData)) {
             $userGroupUpdateStruct->contentUpdateStruct = $this->contentService->newContentUpdateStruct();
             foreach ($parsedData['fields'] as $fieldDefinitionIdentifier => $fieldValue) {
                 $userGroupUpdateStruct->contentUpdateStruct->setField($fieldDefinitionIdentifier, $fieldValue['fieldValue'], $fieldValue['languageCode']);
             }
         }
     }
     return new RestUserGroupUpdateStruct($userGroupUpdateStruct, array_key_exists('sectionId', $parsedData) ? $parsedData['sectionId'] : null);
 }
コード例 #8
0
 /**
  * @param $data
  * @return array
  */
 private function getParentGroups(&$data)
 {
     $userGroupIds = $this->objectCollection->getList('content_items', $data['groups']);
     $userGroups = [];
     foreach ($userGroupIds as $userGroupId) {
         $userGroups[] = $this->userService->loadUserGroup($userGroupId);
     }
     return $userGroups;
 }
コード例 #9
0
 /**
  * @Given /^there is a User Content$/
  */
 public function thereIsAUserContent()
 {
     $login = '******' . microtime(true);
     $email = $login . '@example.com';
     $struct = $this->userService->newUserCreateStruct($login, $email, 'publish', 'eng-GB');
     $struct->setField('first_name', 'John');
     $struct->setField('last_name', 'Doe');
     $parentGroup = $this->userService->loadUserGroup(11);
     $user = $this->userService->createUser($struct, [$parentGroup]);
     $this->currentContent = $this->contentService->loadContentByContentInfo($user->contentInfo);
 }
コード例 #10
0
 /**
  * @inheritdoc
  */
 public function visit(TreeNodeInterface $node, &$data)
 {
     if (!is_array($data)) {
         return null;
     }
     $struct = $this->userService->newUserGroupCreateStruct('');
     $this->fillValueObject($struct, $data, ['content_type']);
     $defaultUserGroup = $this->userService->loadUserGroup(self::DEFAULT_USER_GROUP_ID);
     // @todo: process parent user group
     $userGroup = $this->userService->createUserGroup($struct, $defaultUserGroup);
     $this->saveUserGroupDataToCollection($node, $userGroup);
     if (isset($data['roles'])) {
         foreach ($data['roles'] as $roleId) {
             $role = $this->repository->getRoleService()->loadRoleByIdentifier($roleId);
             // @doc: parameter RoleLimitation is not supported.
             // Not possible to assign role to user or group with limitation
             $this->repository->getRoleService()->assignRoleToUserGroup($role, $userGroup);
         }
     }
     return $userGroup;
 }
コード例 #11
0
ファイル: Role.php プロジェクト: dfritschy/ezpublish-kernel
 /**
  * Returns a role assignment to the given user group
  *
  * @param $groupPath
  * @param $roleId
  *
  * @throws \eZ\Publish\Core\REST\Common\Exceptions\NotFoundException
  * @return \eZ\Publish\Core\REST\Server\Values\RestUserGroupRoleAssignment
  */
 public function loadRoleAssignmentForUserGroup($groupPath, $roleId)
 {
     $groupLocationParts = explode('/', $groupPath);
     $groupLocation = $this->locationService->loadLocation(array_pop($groupLocationParts));
     $userGroup = $this->userService->loadUserGroup($groupLocation->contentId);
     $roleAssignments = $this->roleService->getRoleAssignmentsForUserGroup($userGroup);
     foreach ($roleAssignments as $roleAssignment) {
         if ($roleAssignment->getRole()->id == $roleId) {
             return new Values\RestUserGroupRoleAssignment($roleAssignment, $groupPath);
         }
     }
     throw new Exceptions\NotFoundException("Role assignment not found: '{$this->request->getPathInfo()}'.");
 }
コード例 #12
0
 /**
  * @Then User with name :username has the following fields:
  * @Then User with name :username exists with the following fields:
  *
  * Checks that user ':username' exists with the values provided in the field/value table. example:
  *       | Name          | value           |
  *       | email         | testuser@ez.no  |
  *       | password      | testuser        |
  *       | first_name    | Test            |
  *       | last_name     | User            |
  */
 public function assertUserWithNameExistsWithFields($username, TableNode $table)
 {
     Assertion::assertTrue($this->checkUserExistenceByUsername($username), "Couldn't find User with name '{$username}'.");
     $user = $this->userService->loadUserByLogin($username);
     $fieldsTable = $table->getTable();
     array_shift($fieldsTable);
     $updateFields = array();
     foreach ($fieldsTable as $fieldRow) {
         $fieldName = $fieldRow[0];
         $expectedValue = $fieldRow[1];
         switch ($fieldName) {
             case 'email':
                 $fieldValue = $user->email;
                 break;
             case 'password':
                 $fieldValue = $user->passwordHash;
                 $expectedValue = $this->createPasswordHash($username, $expectedValue, $user->hashAlgorithm);
                 break;
             default:
                 $fieldValue = $user->getFieldValue($fieldName);
         }
         Assertion::assertEquals($expectedValue, $fieldValue, "Field '{$fieldName}' did not contain expected value '{$expectedValue}'.");
     }
 }
コード例 #13
0
 /**
  * Sets the current ez user to the user with the given user name.
  *
  * @param string $username
  */
 private function setMigrationUser($username)
 {
     $this->repository->setCurrentUser($this->userService->loadUserByLogin($username));
 }
コード例 #14
0
 /**
  * Parse input structure
  *
  * @param array $data
  * @param \eZ\Publish\Core\REST\Common\Input\ParsingDispatcher $parsingDispatcher
  *
  * @return \eZ\Publish\Core\REST\Server\Values\RestUserUpdateStruct
  */
 public function parse(array $data, ParsingDispatcher $parsingDispatcher)
 {
     $parsedData = array();
     //@todo XSD has a login element, but it's not possible to update login
     if (array_key_exists('email', $data)) {
         $parsedData['email'] = $data['email'];
     }
     if (array_key_exists('password', $data)) {
         $parsedData['password'] = $data['password'];
     }
     if (array_key_exists('enabled', $data)) {
         $parsedData['enabled'] = $this->parserTools->parseBooleanValue($data['enabled']);
     }
     if (array_key_exists('mainLanguageCode', $data)) {
         $parsedData['mainLanguageCode'] = $data['mainLanguageCode'];
     }
     if (array_key_exists('Section', $data) && is_array($data['Section'])) {
         if (!array_key_exists('_href', $data['Section'])) {
             throw new Exceptions\Parser("Missing '_href' attribute for Section element in UserUpdate.");
         }
         $parsedData['sectionId'] = $this->requestParser->parseHref($data['Section']['_href'], 'sectionId');
     }
     if (array_key_exists('remoteId', $data)) {
         $parsedData['remoteId'] = $data['remoteId'];
     }
     if (array_key_exists('fields', $data)) {
         $userId = $this->requestParser->parseHref($data['__url'], 'userId');
         if (!is_array($data['fields']) || !array_key_exists('field', $data['fields']) || !is_array($data['fields']['field'])) {
             throw new Exceptions\Parser("Invalid 'fields' element for UserUpdate.");
         }
         $parsedData['fields'] = array();
         foreach ($data['fields']['field'] as $fieldData) {
             if (!array_key_exists('fieldDefinitionIdentifier', $fieldData)) {
                 throw new Exceptions\Parser("Missing 'fieldDefinitionIdentifier' element in field data for UserUpdate.");
             }
             if (!array_key_exists('fieldValue', $fieldData)) {
                 throw new Exceptions\Parser("Missing 'fieldValue' element for '{$fieldData['fieldDefinitionIdentifier']}' identifier in UserUpdate.");
             }
             $fieldValue = $this->fieldTypeParser->parseFieldValue($userId, $fieldData['fieldDefinitionIdentifier'], $fieldData['fieldValue']);
             $languageCode = null;
             if (array_key_exists('languageCode', $fieldData)) {
                 $languageCode = $fieldData['languageCode'];
             }
             $parsedData['fields'][$fieldData['fieldDefinitionIdentifier']] = array('fieldValue' => $fieldValue, 'languageCode' => $languageCode);
         }
     }
     $userUpdateStruct = $this->userService->newUserUpdateStruct();
     if (!empty($parsedData)) {
         if (array_key_exists('email', $parsedData)) {
             $userUpdateStruct->email = $parsedData['email'];
         }
         if (array_key_exists('password', $parsedData)) {
             $userUpdateStruct->password = $parsedData['password'];
         }
         if (array_key_exists('enabled', $parsedData)) {
             $userUpdateStruct->enabled = $parsedData['enabled'];
         }
         if (array_key_exists('mainLanguageCode', $parsedData) || array_key_exists('remoteId', $parsedData)) {
             $userUpdateStruct->contentMetadataUpdateStruct = $this->contentService->newContentMetadataUpdateStruct();
             if (array_key_exists('mainLanguageCode', $parsedData)) {
                 $userUpdateStruct->contentMetadataUpdateStruct->mainLanguageCode = $parsedData['mainLanguageCode'];
             }
             if (array_key_exists('remoteId', $parsedData)) {
                 $userUpdateStruct->contentMetadataUpdateStruct->remoteId = $parsedData['remoteId'];
             }
         }
         if (array_key_exists('fields', $parsedData)) {
             $userUpdateStruct->contentUpdateStruct = $this->contentService->newContentUpdateStruct();
             foreach ($parsedData['fields'] as $fieldDefinitionIdentifier => $fieldValue) {
                 $userUpdateStruct->contentUpdateStruct->setField($fieldDefinitionIdentifier, $fieldValue['fieldValue'], $fieldValue['languageCode']);
             }
         }
     }
     return new RestUserUpdateStruct($userUpdateStruct, array_key_exists('sectionId', $parsedData) ? $parsedData['sectionId'] : null);
 }
コード例 #15
0
 private function login($username, $password)
 {
     $this->repository->setCurrentUser($this->userService->loadUserByCredentials($username, $password));
 }
コード例 #16
0
 /**
  * Assign a role to users and groups in the assignment array.
  *
  * <pre>
  * $assignments = array(
  *      array(
  *          'type' => 'user',
  *          'ids' => array(user ids),
  *          'limitation' => array(limitations)
  *      )
  * )
  * </pre>
  *
  * @param \eZ\Publish\API\Repository\Values\User\Role $role
  * @param \eZ\Publish\API\Repository\RoleService $roleService
  * @param \eZ\Publish\API\Repository\UserService $userService
  * @param array $assignments
  */
 private function assignRole(Role $role, RoleService $roleService, UserService $userService, array $assignments)
 {
     foreach ($assignments as $assign) {
         switch ($assign['type']) {
             case 'user':
                 foreach ($assign['ids'] as $userId) {
                     $userId = $this->referenceResolver->resolveReference($userId);
                     $user = $userService->loadUser($userId);
                     if (!isset($assign['limitations'])) {
                         $roleService->assignRoleToUser($role, $user);
                     } else {
                         foreach ($assign['limitations'] as $limitation) {
                             $limitationObject = $this->createLimitation($roleService, $limitation);
                             $roleService->assignRoleToUser($role, $user, $limitationObject);
                         }
                     }
                 }
                 break;
             case 'group':
                 foreach ($assign['ids'] as $groupId) {
                     $groupId = $this->referenceResolver->resolveReference($groupId);
                     $group = $userService->loadUserGroup($groupId);
                     if (!isset($assign['limitations'])) {
                         // q: why are we swallowing exceptions here ?
                         //try {
                         $roleService->assignRoleToUserGroup($role, $group);
                         //} catch (InvalidArgumentException $e) {}
                     } else {
                         foreach ($assign['limitations'] as $limitation) {
                             $limitationObject = $this->createLimitation($roleService, $limitation);
                             // q: why are we swallowing exceptions here ?
                             //try {
                             $roleService->assignRoleToUserGroup($role, $group, $limitationObject);
                             //} catch (InvalidArgumentException $e) {}
                         }
                     }
                 }
                 break;
         }
     }
 }
コード例 #17
0
 /**
  * Instantiate a new user group update struct
  *
  * @return \eZ\Publish\API\Repository\Values\User\UserGroupUpdateStruct
  */
 public function newUserGroupUpdateStruct()
 {
     return $this->service->newUserGroupUpdateStruct();
 }
コード例 #18
0
 /**
  * Trigger
  *
  * @param InteractiveLoginEvent $event
  */
 public function onInteractiveLogin(InteractiveLoginEvent $event)
 {
     // We just load a generic user and assign it back to the event.
     // You may want to create users here, or even load predefined users depending on your own rules.
     $event->setApiUser($this->userService->loadUserByLogin('member'));
 }
コード例 #19
0
ファイル: Demo.php プロジェクト: bdunogier/eziftttdemobundle
 /**
  * The content is located below the Root folder.
  */
 public function newLocationCreateStructFromRequest(Request $request)
 {
     $user = $this->userService->loadUserByCredentials($request->username, $request->password);
     return $this->locationService->newLocationCreateStruct($user->contentInfo->mainLocationId);
 }