本文整理汇总了PHP中TYPO3\Flow\Security\Context::getPartyByType方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getPartyByType方法的具体用法?PHP Context::getPartyByType怎么用?PHP Context::getPartyByType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Security\Context
的用法示例。
在下文中一共展示了Context::getPartyByType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBackendUser
/**
* @return User
*/
public function getBackendUser()
{
if ($this->securityContext->canBeInitialized() === TRUE) {
return $this->securityContext->getPartyByType('TYPO3\\Neos\\Domain\\Model\\User');
}
return NULL;
}
示例2: updateAction
/**
* Update/adds a user preference
*
* @param string $key The key of the preference to update/add
* @param string $value The value of the preference
* @return void
*/
public function updateAction($key, $value)
{
/** @var $user User */
$user = $this->securityContext->getPartyByType('TYPO3\\Neos\\Domain\\Model\\User');
// TODO: This should be done in an earlier stage (TypeConverter ?)
if (strtolower($value) === 'false') {
$value = FALSE;
} elseif (strtolower($value) === 'true') {
$value = TRUE;
}
$user->getPreferences()->set($key, $value);
$this->partyRepository->update($user);
$this->throwStatus(204, 'User preferences have been updated');
}
示例3: render
/**
* @param NodeInterface $node
* @return string
* @throws NeosException
*/
public function render(NodeInterface $node)
{
if ($this->privilegeManager->isPrivilegeTargetGranted('TYPO3.Neos:Backend.GeneralAccess') === false) {
return '';
}
/** @var $actionRequest ActionRequest */
$actionRequest = $this->controllerContext->getRequest();
$innerView = new StandaloneView($actionRequest);
$innerView->setTemplatePathAndFilename('resource://TYPO3.Neos/Private/Templates/Backend/Content/Container.html');
$innerView->setFormat('html');
$innerView->setPartialRootPath('resource://TYPO3.Neos/Private/Partials');
$user = $this->securityContext->getPartyByType('TYPO3\\Neos\\Domain\\Model\\User');
$innerView->assignMultiple(array('node' => $node, 'modules' => $this->menuHelper->buildModuleList($this->controllerContext), 'sites' => $this->menuHelper->buildSiteList($this->controllerContext), 'user' => $user));
return $innerView->render();
}
示例4: getCurrentPartyProfile
/**
* Retrieve current profileNode
*
* @throws \Exception
* @return NodeInterface
*/
public function getCurrentPartyProfile()
{
/** @var $user \TYPO3\Neos\Domain\Model\User */
$user = $this->securityContext->getPartyByType('TYPO3\\Neos\\Domain\\Model\\User');
if ($user instanceof \TYPO3\Neos\Domain\Model\User) {
$profileNodeIdentifier = $user->getPreferences()->get('profileNodeIdentifier');
$contentContext = $this->contextFactory->create(array());
if ($profileNodeIdentifier !== NULL) {
$profileNode = $contentContext->getNodeByIdentifier($profileNodeIdentifier);
if (!isset($profileNode) || !$profileNode instanceof NodeInterface) {
throw new \Exception('Profile not found');
}
return $profileNode;
}
throw new \Exception('Profile not found');
} else {
throw new \Exception('User not found');
}
}
示例5: indexAction
/**
* @param array $module
* @return mixed
*/
public function indexAction(array $module)
{
$moduleRequest = new ActionRequest($this->request);
$moduleRequest->setArgumentNamespace('moduleArguments');
$moduleRequest->setControllerObjectName($module['controller']);
$moduleRequest->setControllerActionName($module['action']);
if (isset($module['format'])) {
$moduleRequest->setFormat($module['format']);
}
if ($this->request->hasArgument($moduleRequest->getArgumentNamespace()) === true && is_array($this->request->getArgument($moduleRequest->getArgumentNamespace()))) {
$moduleRequest->setArguments($this->request->getArgument($moduleRequest->getArgumentNamespace()));
}
foreach ($this->request->getPluginArguments() as $argumentNamespace => $argument) {
$moduleRequest->setArgument('--' . $argumentNamespace, $argument);
}
$modules = explode('/', $module['module']);
$moduleConfiguration = Arrays::getValueByPath($this->settings['modules'], implode('.submodules.', $modules));
$moduleConfiguration['path'] = $module['module'];
if (!$this->menuHelper->isModuleEnabled($moduleConfiguration['path'])) {
throw new DisabledModuleException(sprintf('The module "%s" is disabled. You can enable it with the "enabled" flag in Settings.yaml.', $module['module']), 1437148922);
}
$moduleBreadcrumb = array();
$path = array();
foreach ($modules as $moduleIdentifier) {
array_push($path, $moduleIdentifier);
$config = Arrays::getValueByPath($this->settings['modules'], implode('.submodules.', $path));
$moduleBreadcrumb[implode('/', $path)] = $config;
}
$moduleRequest->setArgument('__moduleConfiguration', $moduleConfiguration);
$moduleResponse = new Response($this->response);
$this->dispatcher->dispatch($moduleRequest, $moduleResponse);
if ($moduleResponse->hasHeader('Location')) {
$this->redirectToUri($moduleResponse->getHeader('Location'), 0, $moduleResponse->getStatusCode());
} elseif ($moduleRequest->getFormat() !== 'html') {
$mediaType = MediaTypes::getMediaTypeFromFilename('file.' . $moduleRequest->getFormat());
if ($mediaType !== 'application/octet-stream') {
$this->controllerContext->getResponse()->setHeader('Content-Type', $mediaType);
}
return $moduleResponse->getContent();
} else {
$user = $this->securityContext->getPartyByType('TYPO3\\Neos\\Domain\\Model\\User');
$sites = $this->menuHelper->buildSiteList($this->controllerContext);
$this->view->assignMultiple(array('moduleClass' => implode('-', $modules), 'moduleContents' => $moduleResponse->getContent(), 'title' => $moduleRequest->hasArgument('title') ? $moduleRequest->getArgument('title') : $moduleConfiguration['label'], 'rootModule' => array_shift($modules), 'submodule' => array_shift($modules), 'moduleConfiguration' => $moduleConfiguration, 'moduleBreadcrumb' => $moduleBreadcrumb, 'user' => $user, 'modules' => $this->menuHelper->buildModuleList($this->controllerContext), 'sites' => $sites));
}
}