Exemplo n.º 1
0
 /**
  * Returns the list of file upload destination choices
  *
  * @return array
  */
 public function getDefaultUploadDestinations()
 {
     $user = $this->container->get('security.token_storage')->getToken()->getUser();
     if ($user == 'anon.') {
         return array();
     }
     $pws = $user->getPersonalWorkspace();
     $defaults = [];
     if ($pws) {
         $defaults = array_merge($defaults, $this->directoryRepo->findDefaultUploadDirectories($pws));
     }
     if ($node = $this->container->get('request')->getSession()->get('current_resource_node')) {
         $defaults = array_merge($defaults, $this->directoryRepo->findDefaultUploadDirectories($node->getWorkspace()));
     }
     return $defaults;
 }
Exemplo n.º 2
0
 /**
  * Returns the list of file upload destination choices.
  *
  * @return array
  */
 public function getDefaultUploadDestinations()
 {
     $user = $this->container->get('security.token_storage')->getToken()->getUser();
     if ($user === 'anon.') {
         return [];
     }
     $pws = $user->getPersonalWorkspace();
     $defaults = [];
     if ($pws) {
         $defaults = array_merge($defaults, $this->directoryRepo->findDefaultUploadDirectories($pws));
     }
     $node = $this->container->get('request')->getSession()->get('current_resource_node');
     if ($node && $node->getWorkspace()) {
         $root = $this->directoryRepo->findDefaultUploadDirectories($node->getWorkspace());
         if ($this->container->get('security.authorization_checker')->isGranted('CREATE', $root)) {
             $defaults = array_merge($defaults, $root);
         }
     }
     return $defaults;
 }