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


PHP SecurityFacade::getOrganizationId方法代码示例

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


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

示例1: reverseTransform

 /**
  * {@inheritdoc}
  */
 public function reverseTransform($value)
 {
     if (!$value) {
         return [];
     }
     /** @var CalendarRepository $calendarRepository */
     $calendarRepository = $this->registry->getRepository('OroCalendarBundle:Calendar');
     $organizationId = $this->securityFacade->getOrganizationId();
     if (!$organizationId) {
         throw new TransformationFailedException('Can\'t get current organization');
     }
     $events = new ArrayCollection();
     /** @var User $user */
     $userIds = [];
     foreach ($value as $user) {
         $userIds[] = $user->getId();
     }
     $calendars = $calendarRepository->findDefaultCalendars($userIds, $organizationId);
     foreach ($calendars as $calendar) {
         $event = new CalendarEvent();
         $event->setCalendar($calendar);
         $events->add($event);
     }
     return $events;
 }
开发者ID:Maksold,项目名称:platform,代码行数:28,代码来源:EventsToUsersTransformer.php

示例2: beforeSearchEvent

 /**
  * Add Organization limitation for search data
  *
  * @param BeforeSearchEvent $event
  */
 public function beforeSearchEvent(BeforeSearchEvent $event)
 {
     $query = $event->getQuery();
     $organizationId = $this->securityFacade->getOrganizationId();
     if ($organizationId) {
         $query->andWhere('organization', 'in', [$organizationId, self::EMPTY_ORGANIZATION_ID], 'integer');
     }
     $event->setQuery($query);
 }
开发者ID:gmoigneu,项目名称:platform,代码行数:14,代码来源:SearchListener.php

示例3: onPreSetData

 /**
  * @param FormEvent $event
  */
 public function onPreSetData(FormEvent $event)
 {
     $form = $event->getForm();
     $data = $event->getData();
     if ($data) {
         if ($data->getId()) {
             $form->remove('businessUnit');
             $form->add('businessUnit', 'oro_business_unit_tree_select', ['label' => 'oro.organization.businessunit.parent.label', 'empty_value' => 'oro.business_unit.form.none_business_user', 'property_path' => 'owner', 'required' => false, 'choices' => $this->getBusinessUnitChoices($this->businessUnitManager->getBusinessUnitsTree(null, $this->securityFacade->getOrganizationId())), 'forbidden_business_unit_ids' => $this->businessUnitManager->getChildBusinessUnitIds($data->getId(), $this->securityFacade->getOrganizationId())]);
         }
     }
 }
开发者ID:xamin123,项目名称:platform,代码行数:14,代码来源:BusinessUnitType.php

示例4: 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

示例5: buildView

 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $buTree = $this->buManager->getBusinessUnitRepo()->getOrganizationBusinessUnitsTree($this->securityFacade->getOrganizationId());
     $view->vars['organization_tree_ids'] = $buTree;
     /** @var PersistentCollection $businessUnitData */
     $businessUnitData = $view->vars['data']->getBusinessUnits();
     if ($businessUnitData) {
         $businessUnitData = $businessUnitData->map(function ($item) {
             return $item->getId();
         })->getValues();
     }
     $view->vars['selected_organizations'] = [$this->securityFacade->getOrganizationId()];
     $view->vars['selected_business_units'] = $businessUnitData;
 }
开发者ID:Maksold,项目名称:platform,代码行数:17,代码来源:OrganizationsSelectType.php

示例6: onBuildAfter

 /**
  * @param BuildAfter $event
  */
 public function onBuildAfter(BuildAfter $event)
 {
     $datagrid = $event->getDatagrid();
     $datasource = $datagrid->getDatasource();
     if ($datasource instanceof OrmDatasource) {
         $isPublicGranted = $this->calendarConfig->isPublicCalendarEnabled();
         $isSystemGranted = $this->calendarConfig->isSystemCalendarEnabled() && $this->securityFacade->isGranted('oro_system_calendar_view');
         if ($isPublicGranted && $isSystemGranted) {
             $datasource->getQueryBuilder()->andWhere('(sc.public = :public OR sc.organization = :organizationId)')->setParameter('public', true)->setParameter('organizationId', $this->securityFacade->getOrganizationId());
         } elseif ($isPublicGranted) {
             $datasource->getQueryBuilder()->andWhere('sc.public = :public')->setParameter('public', true);
         } elseif ($isSystemGranted) {
             $datasource->getQueryBuilder()->andWhere('sc.organization = :organizationId')->setParameter('organizationId', $this->securityFacade->getOrganizationId());
         } else {
             // it is denied to view both public and system calendars
             $datasource->getQueryBuilder()->andWhere('1 = 0');
         }
     }
 }
开发者ID:Maksold,项目名称:platform,代码行数:22,代码来源:SystemCalendarGridListener.php

示例7: getOrganizationContextId

 /**
  * @return int|null
  */
 protected function getOrganizationContextId()
 {
     return $this->securityFacade->getOrganizationId();
 }
开发者ID:xamin123,项目名称:platform,代码行数:7,代码来源:OwnerFormExtension.php

示例8: 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::getOrganizationId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。