getSecurityContexts() public méthode

public getSecurityContexts ( )
Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function getParameters()
 {
     $parameters = [];
     foreach ($this->adminPool->getSecurityContexts() as $system => $sections) {
         foreach ($sections as $section => $contexts) {
             foreach ($contexts as $context => $permissionTypes) {
                 $parameters[$context] = $this->accessControlManager->getUserPermissions(new SecurityCondition($context), $this->tokenStorage->getToken()->getUser());
             }
         }
     }
     return $parameters;
 }
Exemple #2
0
 /**
  * Returns contexts of admin.
  *
  * @param Request $request
  *
  * @return JsonResponse
  */
 public function contextsAction(Request $request)
 {
     $contexts = $this->adminPool->getSecurityContexts();
     $system = $request->get('system');
     $response = isset($system) ? $contexts[$system] : $contexts;
     return new JsonResponse($response);
 }
Exemple #3
0
 /**
  * Returns contexts of admin.
  *
  * @param Request $request
  *
  * @return JsonResponse
  */
 public function contextsAction(Request $request)
 {
     $contexts = $this->adminPool->getSecurityContexts();
     $mappedContexts = [];
     foreach ($contexts as $system => $sections) {
         foreach ($sections as $section => $contexts) {
             foreach ($contexts as $context => $permissionTypes) {
                 $this->addContext($mappedContexts, $system, $section, $context, $permissionTypes);
             }
         }
     }
     $requestedSystem = $request->get('system');
     $response = null !== $requestedSystem ? $mappedContexts[$requestedSystem] : $mappedContexts;
     return new JsonResponse($response);
 }
Exemple #4
0
 public function testSecurityContexts()
 {
     $contexts = $this->adminPool->getSecurityContexts();
     $this->assertEquals(['assets.videos', 'assets.pictures', 'assets.documents'], $contexts['Sulu']['Assets']);
     $this->assertEquals(['portals.com', 'portals.de'], $contexts['Sulu']['Portal']);
 }