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


PHP User::getEntityRoles方法代码示例

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


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

示例1: findByUser

 public function findByUser(User $user, $showAll = false)
 {
     $qb = $this->createQueryBuilder('f')->leftJoin('f.panelFacets', 'pf')->leftJoin('pf.fieldsFacet', 'ff')->leftJoin('ff.fieldsFacetValue', 'ffv');
     if (!$showAll) {
         $qb->join('f.roles', 'frole')->join('pf.panelFacetsRole', 'pfr')->andWhere('frole in (:roles)')->andWhere('pfr.role in (:roles)')->andWhere('pfr.canOpen = true')->setParameter('roles', $user->getEntityRoles());
     }
     return $qb->getQuery()->getResult();
 }
开发者ID:claroline,项目名称:distribution,代码行数:8,代码来源:FacetRepository.php

示例2: checkRights

 public function checkRights(User $user, $theRight)
 {
     if ($this->authorization->isGranted('ROLE_ADMIN')) {
         return true;
     }
     $roles = $user->getEntityRoles();
     $rights = $this->rightsRepo->findPresenceRightsByRolesAndValue($roles, $theRight);
     return count($rights) > 0;
 }
开发者ID:claroline,项目名称:distribution,代码行数:9,代码来源:PresenceManager.php

示例3: getTaggedWorkspacesByRoles

 public function getTaggedWorkspacesByRoles(User $user, $tag, $orderedBy = 'id', $order = 'ASC')
 {
     $roles = $user->getEntityRoles();
     return count($roles) > 0 ? $this->taggedObjectRepo->findTaggedWorkspacesByRoles($tag, $roles, $orderedBy, $order) : array();
 }
开发者ID:kitan1982,项目名称:TagBundle,代码行数:5,代码来源:TagManager.php

示例4: desktopWidgetInstanceCreateAction

 /**
  * @EXT\Route(
  *     "desktop/hometab/{homeTab}/widget/instance/create",
  *     name="claro_desktop_widget_instance_create",
  *     options = {"expose"=true}
  * )
  * @EXT\Method("POST")
  * @EXT\ParamConverter("user", options={"authenticatedUser" = true})
  * @EXT\Template("ClarolineCoreBundle:Tool\desktop\home:desktopWidgetInstanceCreateModalForm.html.twig")
  *
  * Creates a widget instance.
  *
  * @return Response
  */
 public function desktopWidgetInstanceCreateAction(User $user, HomeTab $homeTab)
 {
     $widgetInstance = new WidgetInstance();
     $widgetDisplayConfig = new WidgetDisplayConfig();
     $instanceForm = $this->formFactory->create(new WidgetInstanceType(true, true, $user->getEntityRoles()), $widgetInstance);
     $displayConfigForm = $this->formFactory->create(new WidgetDisplayConfigType(), $widgetDisplayConfig);
     $instanceForm->handleRequest($this->request);
     $displayConfigForm->handleRequest($this->request);
     if ($instanceForm->isValid() && $displayConfigForm->isValid()) {
         $widgetInstance->setUser($user);
         $widgetInstance->setIsAdmin(false);
         $widgetInstance->setIsDesktop(true);
         $widgetHomeTabConfig = new WidgetHomeTabConfig();
         $widgetHomeTabConfig->setHomeTab($homeTab);
         $widgetHomeTabConfig->setWidgetInstance($widgetInstance);
         $widgetHomeTabConfig->setUser($user);
         $widgetHomeTabConfig->setVisible(true);
         $widgetHomeTabConfig->setLocked(false);
         $widgetHomeTabConfig->setWidgetOrder(1);
         $widgetHomeTabConfig->setType('desktop');
         $widget = $widgetInstance->getWidget();
         $widgetDisplayConfig->setWidgetInstance($widgetInstance);
         $widgetDisplayConfig->setUser($user);
         $widgetDisplayConfig->setWidth($widget->getDefaultWidth());
         $widgetDisplayConfig->setHeight($widget->getDefaultHeight());
         $this->widgetManager->persistWidgetConfigs($widgetInstance, $widgetHomeTabConfig, $widgetDisplayConfig);
         return new JsonResponse(array('widgetInstanceId' => $widgetInstance->getId(), 'widgetHomeTabConfigId' => $widgetHomeTabConfig->getId(), 'widgetDisplayConfigId' => $widgetDisplayConfig->getId(), 'color' => $widgetDisplayConfig->getColor(), 'name' => $widgetInstance->getName(), 'configurable' => $widgetInstance->getWidget()->isConfigurable() ? 1 : 0, 'width' => $widget->getDefaultWidth(), 'height' => $widget->getDefaultHeight()), 200);
     } else {
         return array('homeTab' => $homeTab, 'instanceForm' => $instanceForm->createView(), 'displayConfigForm' => $displayConfigForm->createView());
     }
 }
开发者ID:ChMat,项目名称:CoreBundle,代码行数:45,代码来源:HomeController.php


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