當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。