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


PHP SecurityFacade::getLoggedUserId方法代码示例

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


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

示例1: checkPermissions

 /**
  * {@inheritdoc}
  */
 public function checkPermissions($entity, ObjectManager $em)
 {
     $loggedUserId = $this->securityFacade->getLoggedUserId();
     if ($loggedUserId && $loggedUserId == $entity->getId()) {
         throw new ForbiddenException('self delete');
     }
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:10,代码来源:UserDeleteHandler.php

示例2: process

 /**
  * Process form
  *
  * @param  CalendarEvent $entity
  * @throws \LogicException
  *
  * @return bool  True on successful processing, false otherwise
  */
 public function process(CalendarEvent $entity)
 {
     if (!$entity->getCalendar()) {
         if ($this->securityFacade->getLoggedUser() && $this->securityFacade->getOrganization()) {
             /** @var Calendar $defaultCalendar */
             $defaultCalendar = $this->manager->getRepository('OroCalendarBundle:Calendar')->findDefaultCalendar($this->securityFacade->getLoggedUser()->getId(), $this->securityFacade->getOrganization()->getId());
             $entity->setCalendar($defaultCalendar);
         } else {
             throw new \LogicException('Current user did not define');
         }
     }
     $this->form->setData($entity);
     if (in_array($this->request->getMethod(), array('POST', 'PUT'))) {
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             $targetEntityClass = $this->entityRoutingHelper->getEntityClassName($this->request);
             if ($targetEntityClass) {
                 $targetEntityId = $this->entityRoutingHelper->getEntityId($this->request);
                 $targetEntity = $this->entityRoutingHelper->getEntityReference($targetEntityClass, $targetEntityId);
                 $action = $this->entityRoutingHelper->getAction($this->request);
                 if ($action === 'activity') {
                     $this->activityManager->addActivityTarget($entity, $targetEntity);
                 }
                 if ($action === 'assign' && $targetEntity instanceof User && $targetEntityId !== $this->securityFacade->getLoggedUserId()) {
                     /** @var Calendar $defaultCalendar */
                     $defaultCalendar = $this->manager->getRepository('OroCalendarBundle:Calendar')->findDefaultCalendar($targetEntity->getId(), $targetEntity->getOrganization()->getId());
                     $entity->setCalendar($defaultCalendar);
                 }
             }
             $this->onSuccess($entity);
             return true;
         }
     }
     return false;
 }
开发者ID:xamin123,项目名称:platform,代码行数:43,代码来源:CalendarEventHandler.php

示例3: onMode

 /**
  * @param bool $isOn
  */
 protected function onMode($isOn)
 {
     $userId = $this->securityFacade->getLoggedUserId();
     try {
         $this->publisher->send('oro/maintenance', array('isOn' => (bool) $isOn, 'userId' => $userId));
     } catch (\Exception $e) {
         $this->logger->error($e->getMessage());
     }
 }
开发者ID:ramunasd,项目名称:platform,代码行数:12,代码来源:MaintenanceListener.php

示例4: checkPermissions

 /**
  * {@inheritdoc}
  */
 protected function checkPermissions($entity, ObjectManager $em)
 {
     $loggedUserId = $this->securityFacade->getLoggedUserId();
     if ($loggedUserId && $loggedUserId == $entity->getId()) {
         throw new ForbiddenException('self delete');
     }
     if ($this->securityFacade->hasUserSidSharedRecords($entity)) {
         throw new ForbiddenException('user has shared records');
     }
     parent::checkPermissions($entity, $em);
 }
开发者ID:kstupak,项目名称:platform,代码行数:14,代码来源:UserDeleteHandler.php

示例5: getUserCalendars

 /**
  * Gets a list of user's calendars for which it is granted to add events
  *
  * @return array of [id, name]
  */
 public function getUserCalendars()
 {
     /** @var CalendarRepository $repo */
     $repo = $this->doctrineHelper->getEntityRepository('OroCalendarBundle:Calendar');
     $calendars = $repo->getUserCalendarsQueryBuilder($this->securityFacade->getOrganizationId(), $this->securityFacade->getLoggedUserId())->select('c.id, c.name')->getQuery()->getArrayResult();
     foreach ($calendars as &$calendar) {
         if (empty($calendar['name'])) {
             $calendar['name'] = $this->entityNameResolver->getName($this->securityFacade->getLoggedUser());
         }
     }
     return $calendars;
 }
开发者ID:Maksold,项目名称:platform,代码行数:17,代码来源:CalendarEventManager.php

示例6: onBuildAfter

 /**
  * @param BuildAfter $event
  */
 public function onBuildAfter(BuildAfter $event)
 {
     $datagrid = $event->getDatagrid();
     $datasource = $datagrid->getDatasource();
     if ($datasource instanceof OrmDatasource) {
         $parameters = $datagrid->getParameters();
         $userId = $parameters->get('userId');
         if (!$userId) {
             $userId = $this->securityFacade->getLoggedUserId();
         }
         $datasource->getQueryBuilder()->andWhere(sprintf('task.owner = %d', $userId));
     }
 }
开发者ID:antrampa,项目名称:crm,代码行数:16,代码来源:UserTaskGridListener.php

示例7: searchIds

 /**
  * {@inheritdoc}
  */
 protected function searchIds($search, $firstResult, $maxResults)
 {
     $userIds = parent::searchIds($search, $firstResult, $maxResults + 1);
     $excludedKey = null;
     $currentUserId = $this->securityFacade->getLoggedUserId();
     if ($currentUserId) {
         $excludedKey = array_search($currentUserId, $userIds);
     }
     if (false !== $excludedKey) {
         unset($userIds[$excludedKey]);
         $userIds = array_values($userIds);
     } else {
         $userIds = array_slice($userIds, 0, $maxResults);
     }
     return $userIds;
 }
开发者ID:Maksold,项目名称:platform,代码行数:19,代码来源:UserWithoutCurrentHandler.php

示例8: process

 /**
  * Process form
  *
  * @param  CalendarEvent $entity
  *
  * @throws \LogicException
  *
  * @return bool  True on successful processing, false otherwise
  */
 public function process(CalendarEvent $entity)
 {
     $this->form->setData($entity);
     if (in_array($this->request->getMethod(), array('POST', 'PUT'))) {
         $originalChildren = new ArrayCollection();
         foreach ($entity->getChildEvents() as $childEvent) {
             $originalChildren->add($childEvent);
         }
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             $this->ensureCalendarSet($entity);
             $targetEntityClass = $this->entityRoutingHelper->getEntityClassName($this->request);
             if ($targetEntityClass) {
                 $targetEntityId = $this->entityRoutingHelper->getEntityId($this->request);
                 $targetEntity = $this->entityRoutingHelper->getEntityReference($targetEntityClass, $targetEntityId);
                 $action = $this->entityRoutingHelper->getAction($this->request);
                 if ($action === 'activity') {
                     $this->activityManager->addActivityTarget($entity, $targetEntity);
                 }
                 if ($action === 'assign' && $targetEntity instanceof User && $targetEntityId !== $this->securityFacade->getLoggedUserId()) {
                     /** @var Calendar $defaultCalendar */
                     $defaultCalendar = $this->manager->getRepository('OroCalendarBundle:Calendar')->findDefaultCalendar($targetEntity->getId(), $targetEntity->getOrganization()->getId());
                     $entity->setCalendar($defaultCalendar);
                 }
             }
             $this->onSuccess($entity, $originalChildren, $this->form->get('notifyInvitedUsers')->getData());
             return true;
         }
     }
     return false;
 }
开发者ID:northdakota,项目名称:platform,代码行数:40,代码来源:CalendarEventHandler.php

示例9: onModeOff

 public function onModeOff()
 {
     $userId = $this->securityFacade->getLoggedUserId();
     $this->publisher->send('oro/maintenance', array('isOn' => false, 'userId' => $userId));
 }
开发者ID:xamin123,项目名称:platform,代码行数:5,代码来源:MaintenanceListener.php

示例10: getBasicQueryBuilder

 /**
  * Returns query builder that uses to build query for search bu id or by search string.
  * Result data limit by users that was have access to the current organization and excluding current user.
  *
  * @return QueryBuilder
  */
 protected function getBasicQueryBuilder()
 {
     $queryBuilder = $this->entityRepository->createQueryBuilder('u');
     $queryBuilder->join('u.organizations', 'org')->andWhere('org.id = :org')->andWhere('u.id != :currentUser')->setParameter('org', $this->securityFacade->getOrganizationId())->setParameter('currentUser', $this->securityFacade->getLoggedUserId());
     return $queryBuilder;
 }
开发者ID:northdakota,项目名称:platform,代码行数:12,代码来源:OrganizationUsersHandler.php


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