main/core/Manager/ResourceManager.php
public function addPublicFileDirectory(Workspace $workspace)
    {
        $directory = new Directory();
        $dirName = $this->translator->trans('my_public_documents', [], 'platform');
        $directory->setName($dirName);
        $directory->setUploadDestination(true);
        $parent = $this->getNodeScheduledForInsert($workspace, $workspace->getName());
        if (!$parent) {
            $parent = $this->resourceNodeRepo->findOneBy(['workspace' => $workspace->getId(), 'parent' => $parent]);
        }
        $role = $this->roleManager->getRoleByName('ROLE_ANONYMOUS');

        /** @var Directory $publicDir */
        $publicDir = $this->create(
            $directory,
            $this->getResourceTypeByName('directory'),
            $workspace->getCreator(),
            $workspace,
            $parent,
            null,
            ['ROLE_ANONYMOUS' => ['open' => true, 'export' => true, 'create' => [], 'role' => $role]],
            true
        );

        return $publicDir;
    }
public function addPublicFileDirectory(Workspace $workspace)
    {
        $directory = new Directory();
        $dirName = $this->translator->trans('my_public_documents', [], 'platform');
        $directory->setName($dirName);
        $directory->setUploadDestination(true);
        $parent = $this->getNodeScheduledForInsert($workspace, $workspace->getName());
        if (!$parent) {
            $parent = $this->resourceNodeRepo->findOneBy(['workspace' => $workspace->getId(), 'parent' => $parent]);
        }
        $role = $this->roleManager->getRoleByName('ROLE_ANONYMOUS');

        /** @var Directory $publicDir */
        $publicDir = $this->create(
            $directory,
            $this->getResourceTypeByName('directory'),
            $workspace->getCreator(),
            $workspace,
            $parent,
            null,
            ['ROLE_ANONYMOUS' => ['open' => true, 'export' => true, 'create' => [], 'role' => $role]],
            true
        );

        return $publicDir;
    }
public function addPublicFileDirectory ( Workspace $ workspace ) { $ directory = new Directory ( ) ; $ dirName = $ this -> translator -> trans ( 'my_public_documents' , [ ] , 'platform' ) ; $ directory -> setName ( $ dirName ) ; $ directory -> setUploadDestination ( true ) ; $ parent = $ this -> getNodeScheduledForInsert ( $ workspace , $ workspace -> getName ( ) ) ; if ( ! $ parent ) { $ parent = $ this -> resourceNodeRepo -> findOneBy ( [ 'workspace' => $ workspace -> getId ( ) , 'parent' => $ parent ] ) ; } $ role = $ this -> roleManager -> getRoleByName ( 'ROLE_ANONYMOUS' ) ; /** @var Directory $publicDir */ $ publicDir = $ this -> create ( $ directory , $ this -> getResourceTypeByName ( 'directory' ) , $ workspace -> getCreator ( ) , $ workspace , $ parent , null , [ 'ROLE_ANONYMOUS' => [ 'open' => true , 'export' => true , 'create' => [ ] , 'role' => $ role ] ] , true ) ; return $ publicDir ; }
Adds the public file directory in a workspace.

@todo move in workspace manager

@param Workspace $workspace

@return Directory
Adds the public file directory in a workspace .