本文整理汇总了PHP中TYPO3\Flow\Security\Context::getAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getAccount方法的具体用法?PHP Context::getAccount怎么用?PHP Context::getAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Security\Context
的用法示例。
在下文中一共展示了Context::getAccount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editAction
/**
* @param \SKL\Post\Domain\Model\Author $author
* @return void
*/
public function editAction(Author $author)
{
$account = $this->securityContext->getAccount();
$this->view->assign('usrname', $account->getAccountIdentifier());
$this->view->assign('listCategories', $this->categoryRepository->findAll());
$this->view->assign('author', $author);
}
示例2: preToolbarRendering
/**
* TODO: Document this Method! ( assignVariables )
*/
public function preToolbarRendering()
{
$account = $this->context->getAccount();
$votes = array();
$privilege = array('PRIVILEGE_ABSTAIN', 'PRIVILEGE_GRANT', 'PRIVILEGE_DENY');
$roleVotes = \Debug\Toolbar\Service\DataStorage::get('Security:RoleVotes');
if (is_array($roleVotes)) {
foreach ($roleVotes as $key => $value) {
$vote = array('role' => (string) $value['role']);
$vote['privilege'] = '';
if (is_array($value['privileges'])) {
foreach ($value['privileges'] as $k => $p) {
$vote['privilege'] = $privilege[$p];
}
}
$votes[$value['role'] . ':' . $vote['privilege']] = $vote;
}
} else {
$roles = $this->context->getRoles();
foreach ($roles as $key => $value) {
$vote = array('role' => (string) $value);
$votes[] = $vote;
}
}
\Debug\Toolbar\Service\Collector::getModule('Security')->getToolbar()->addIcon('user')->addText(is_object($account) ? $account->getAccountIdentifier() : 'Guest')->getPopup()->addPartial('Security', array('roles' => $this->context->getRoles(), 'account' => $this->context->getaccount(), 'votes' => $votes))->getPanel()->addPartial('Security', array('roles' => $this->context->getRoles(), 'account' => $this->context->getaccount(), 'votes' => $votes));
}
示例3: getAccount
/**
* Get the account of the first authenticated token.
*
* @return \TYPO3\Flow\Security\Account|NULL
*/
public function getAccount()
{
if ($this->securityContext->canBeInitialized()) {
return $this->securityContext->getAccount();
}
return NULL;
}
示例4: indexAction
/**
* @return void
*/
public function indexAction()
{
$account = $this->securityContext->getAccount();
$this->view->assign('usrname', $account->getAccountIdentifier());
$this->view->assign('setups', $this->setupRepository->findAll());
$this->view->assign('listCategories', $this->categoryRepository->findAll());
}
示例5: initializeAction
/**
* Initializes the controller before invoking an action method.
*
*/
public function initializeAction()
{
if ($this->securityContext->canBeInitialized()) {
$account = $this->securityContext->getAccount();
$this->bearbeiterObj = $this->bearbeiterRepository->findOneByAccount($account);
}
$this->cacheInterface = $this->cacheManager->getCache('GermaniaSacra_GermaniaCache');
}
示例6: getCurrentUser
/**
* Returns the currently logged in user, if any
*
* @return User The currently logged in user, or NULL
*/
public function getCurrentUser()
{
$account = $this->securityContext->getAccount();
if ($account === NULL) {
return NULL;
}
return $this->userRepository->findOneHavingAccount($account);
}
示例7: getUserWorkspaceName
/**
* Returns the name of the currently logged in user's personal workspace (even if that might not exist at that time).
* If no user is logged in this method returns "live".
*
* @return string
*/
public function getUserWorkspaceName()
{
$account = $this->securityContext->getAccount();
if ($account === NULL) {
return 'live';
}
return 'user-' . preg_replace('/[^a-z0-9]/i', '', $account->getAccountIdentifier());
}
示例8: disqusAction
/**
* @param string $title
* @param string $uri
* @param string $identifier
*/
public function disqusAction($title, $uri, $identifier)
{
$this->view->assign('title', $title);
$this->view->assign('uri', $uri);
$this->view->assign('identifier', $identifier);
if ($account = $this->securityContext->getAccount()) {
$this->view->assign('remoteAuth', $this->disqusRemoteAuthService->generateDisqusRemoteAuth($account));
}
}
示例9: initializeAccountIdentifier
/**
* Try to set the current account identifier emitting the events, if possible
*
* @return void
*/
protected function initializeAccountIdentifier()
{
if ($this->securityContext->canBeInitialized()) {
$account = $this->securityContext->getAccount();
if ($account !== NULL) {
$this->eventEmittingService->setCurrentAccountIdentifier($account->getAccountIdentifier());
}
}
}
示例10: initializeAction
/**
* Initializes some basic stuff that will basically be needed for each and
* every action that is executed later on.
*/
public function initializeAction()
{
// get the account of the authenticated user
$this->account = $this->securityContext->getAccount();
// set the locale
$this->locale = $this->localeDetector->detectLocaleFromLocaleTag($this->settings['defaultLanguage']);
if ($this->l18nService->getConfiguration()->getCurrentLocale() !== $this->locale) {
$this->l18nService->getConfiguration()->setCurrentLocale($this->locale);
}
}
示例11: deleteAction
/**
* @param string $session
*/
public function deleteAction($session)
{
$account = $this->securityContext->getAccount();
/** @var \T3DD\Backend\Domain\Model\Vote $vote */
$vote = $this->voteRepository->getVoteForAccountAndSession($session, $account);
if (!$vote) {
$this->response->setStatus(404);
return;
}
$this->voteRepository->remove($vote);
}
示例12: authenticateAction
/**
* @throws \TYPO3\Flow\Security\Exception\AuthenticationRequiredException
* @throws \TYPO3\Flow\Security\Exception\AccessDeniedException
* @return void
*/
public function authenticateAction()
{
try {
$this->authenticationManager->authenticate();
$account = $this->securityContext->getAccount();
$this->redirect('index', 'Dashboard', NULL, array('user' => $account));
} catch (\TYPO3\Flow\Security\Exception\AuthenticationRequiredException $exception) {
$this->flashMessageContainer->addMessage(new \TYPO3\Flow\Error\Error('Bitte die korrekten Benutzerdaten eingeben.'));
//$this->flashMessageContainer->addMessage(new \TYPO3\Flow\Error\Error($exception->getMessage()));
throw $exception;
}
}
示例13: updateAction
/**
* @param Participant $participant
*/
public function updateAction(Participant $participant)
{
$participantEntity = $participant->getPayload();
if ($participantEntity->getAccount() !== NULL && $participantEntity->getAccount() !== $this->securityContext->getAccount() && !$this->securityContext->hasRole('T3DD.Backend:Administrator')) {
$this->response->setStatus(403);
return;
}
if (!$participantEntity->isCompleted()) {
$participantEntity->setCompleted(TRUE);
$participantEntity->setAccount($this->securityContext->getAccount());
}
$this->participantRepository->update($participantEntity);
$this->view->assign('value', $participant);
}
示例14: initializeView
/**
* Initialize view action
*
* @param \TYPO3\Flow\Mvc\View\ViewInterface $view
* @return void
*/
protected function initializeView(\TYPO3\Flow\Mvc\View\ViewInterface $view)
{
$loggedUser = $this->securityContext->getAccount();
$currentUrl = $this->request->getHttpRequest()->getUri();
$view->assign('currentpage', $currentUrl);
$view->assign('state', $this->base64UrlEncode($currentUrl));
if ($loggedUser != NULL) {
$view->assign('loggedInUser', $this->securityContext->getAccount()->getAccountIdentifier());
$view->assign('currentUser', $this->securityContext->getAccount()->getParty());
}
$facebook_appid = $this->facebookService->getAppId();
$facebook_redirecturi = $this->facebookService->getRedirectUri();
$vkLoginUrl = $this->vkService->getAuthorizationUri();
$this->view->assignMultiple(array('vk_url' => $vkLoginUrl, 'google_url' => $this->googlePlusService->getAuthorizationUri(), 'facebook_appid' => $facebook_appid, 'facebook_redirecturi' => $facebook_redirecturi));
}
示例15: isValid
/**
* The given $value is valid if it is an array of format array(hash:string, phrase:string) and the hash was derived from the entered phrase
*
* @param mixed $value The value that should be validated
* @return void
*/
protected function isValid($value)
{
if (!($this->options["ignoreWhenLoggedIn"] && $this->securityContext->getAccount())) {
if (is_array($value)) {
if (empty($value["hash"]) || empty($value["phrase"])) {
$this->addError("Malformed array given; expected array(hash:string, phrase:string)", 422526241);
} else {
if ($this->captchaService->validatePhrase($value["phrase"], $value["hash"]) !== true) {
$this->addError("Given captcha phrase mismatches the hash", 422526242);
}
}
} else {
$this->addError("This argument must be an array", 422526240);
}
}
}