当前位置: 首页>>代码示例>>PHP>>正文


PHP Context::getParty方法代码示例

本文整理汇总了PHP中TYPO3\Flow\Security\Context::getParty方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getParty方法的具体用法?PHP Context::getParty怎么用?PHP Context::getParty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\Flow\Security\Context的用法示例。


在下文中一共展示了Context::getParty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkMatchesSubjectForCreatingNodes

 /**
  * Check if department of logged in User match with department property of page node and hide this node if true
  *
  * @param \TYPO3\Flow\AOP\JoinPointInterface $joinPoint
  * @Flow\Around("method(TYPO3\TYPO3CR\Security\Authorization\Privilege\Node\___NotUse___EditNodePrivilege->matchesSubject(PrivilegeSubjectInterface $subject))")
  * @return boolean
  */
 public function checkMatchesSubjectForCreatingNodes($joinPoint)
 {
     $matchesSubject = $joinPoint->getMethodArgument('subject');
     $result = $joinPoint->getAdviceChain()->proceed($joinPoint);
     //  if ($matchesSubject instanceof \TYPO3\Flow\Security\Authorization\Privilege\Method\CreateNodePrivilegeSubject === false) return false;
     if ($result) {
         if ($this->securityContext->getParty() instanceof User) {
             // get access rights depending on matching users and pages department
             if ($this->getPropertyRecursive($matchesSubject->getNode(), 'departmentName') == $this->securityContext->getParty()->getDepartment()) {
                 return false;
             } else {
                 return true;
             }
         } else {
             $role = $this->policyService->getRole('TYPO3.Neos:Administrator');
             if ($role) {
                 foreach ($this->securityContext->getParty()->getAccounts() as $account) {
                     if ($account->hasRole($role)) {
                         return false;
                     }
                 }
             }
         }
     }
     return $result;
 }
开发者ID:phluzern,项目名称:sites.phlu.ch,代码行数:33,代码来源:PhLuPrivilegeAspect.php

示例2: newAction

 /**
  * Shows a form for creating a new news object
  *
  * @return void
  */
 public function newAction()
 {
     $this->view->assign('folders', $this->folderService->listAll());
     $this->view->assign('related', $this->newsService->getEnabledNews());
     $this->view->assign('newsCategories', $this->categoryService->getEnabledLatestCategories());
     $this->view->assign('tags', $this->tagService->listAll());
     $this->view->assign('user', $this->securityContext->getParty());
 }
开发者ID:abedsujan,项目名称:Lelesys.Plugin.News,代码行数:13,代码来源:NewsController.php

示例3: checkOwnerOrAdministratorAndDenyIfNeeded

 /**
  * Check if an administrator is logged in or the owner of a project and deny access if someone else is trying to access
  *
  * @param \GIB\GradingTool\Domain\Model\Project $project
  */
 public function checkOwnerOrAdministratorAndDenyIfNeeded(\GIB\GradingTool\Domain\Model\Project $project)
 {
     // check if the user has access to this project
     if ($this->securityContext->getParty() !== $project->getProjectManager() && !array_key_exists('GIB.GradingTool:Administrator', $this->securityContext->getRoles())) {
         // add a flash message
         $message = new \TYPO3\Flow\Error\Message('Access denied.', \TYPO3\Flow\Error\Message::SEVERITY_ERROR);
         $this->flashMessageContainer->addMessage($message);
         $this->redirect('index', 'Standard');
     }
 }
开发者ID:putheakhem,项目名称:GIB.GradingTool,代码行数:15,代码来源:ProjectController.php

示例4: getNewsAdmin

 /**
  * Get the news list by selection
  *
  * @param \Lelesys\Plugin\News\Domain\Model\Category $category The category
  * @param \Lelesys\Plugin\News\Domain\Model\Folder $folder The folder
  * @return \TYPO3\Flow\Persistence\QueryResultInterface The query result
  */
 public function getNewsAdmin(\Lelesys\Plugin\News\Domain\Model\Category $category = NULL, \Lelesys\Plugin\News\Domain\Model\Folder $folder = NULL)
 {
     $query = $this->createQuery();
     $queryBuilder = ObjectAccess::getProperty($query, 'queryBuilder', TRUE);
     $constraints = array();
     $user = '';
     if ($this->securityContext->hasRole('Lelesys.Plugin.News:NewsAdmin')) {
         if (!empty($folder)) {
             $constraints[] = 'n.folder = ' . "'" . $folder->getUuid() . "'";
         }
     } else {
         $party = $this->securityContext->getParty();
         $user = $this->persistenceManager->getIdentifierByObject($party);
         $constraints[] = 'n.createdBy = ' . "'" . $user . "'";
     }
     if (!empty($category)) {
         $constraints[] = 'c.Persistence_Object_Identifier IN (' . "'" . $category->getUuid() . "'" . ')';
     }
     $newsConstraints = '';
     $count = count($constraints);
     $newCount = 1;
     foreach ($constraints as $contraint) {
         if ($count > $newCount) {
             $newsConstraints .= $contraint . ' AND ';
         } else {
             $newsConstraints .= $contraint;
         }
         $newCount++;
     }
     $queryBuilder->resetDQLParts()->select('n')->from('Lelesys\\Plugin\\News\\Domain\\Model\\News', 'n');
     if (!empty($category)) {
         $queryBuilder->leftjoin('n.categories', 'c');
     }
     if (!empty($category) || !empty($folder) || $user !== '') {
         $queryBuilder->where($newsConstraints);
     }
     $queryBuilder->orderBy('n.dateTime', 'DESC');
     return $query->execute();
 }
开发者ID:abedsujan,项目名称:Lelesys.Plugin.News,代码行数:46,代码来源:NewsRepository.php


注:本文中的TYPO3\Flow\Security\Context::getParty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。