main/core/Manager/ResourceManager.php
public function createRights(ResourceNode $node, array $rights = [], $withDefault = true)
    {
        foreach ($rights as $data) {
            $resourceTypes = $this->checkResourceTypes($data['create']);
            $this->rightsManager->create($data, $data['role'], $node, false, $resourceTypes);
        }
        if ($withDefault) {
            if (!array_key_exists('ROLE_ANONYMOUS', $rights)) {
                $this->rightsManager->create(
                    0,
                    $this->roleRepo->findOneBy(['name' => 'ROLE_ANONYMOUS']),
                    $node,
                    false,
                    []
                );
            }
            if (!array_key_exists('ROLE_USER', $rights)) {
                $this->rightsManager->create(
                    0,
                    $this->roleRepo->findOneBy(['name' => 'ROLE_USER']),
                    $node,
                    false,
                    []
                );
            }
        }
    }
public function createRights(ResourceNode $node, array $rights = [], $withDefault = true)
    {
        foreach ($rights as $data) {
            $resourceTypes = $this->checkResourceTypes($data['create']);
            $this->rightsManager->create($data, $data['role'], $node, false, $resourceTypes);
        }
        if ($withDefault) {
            if (!array_key_exists('ROLE_ANONYMOUS', $rights)) {
                $this->rightsManager->create(
                    0,
                    $this->roleRepo->findOneBy(['name' => 'ROLE_ANONYMOUS']),
                    $node,
                    false,
                    []
                );
            }
            if (!array_key_exists('ROLE_USER', $rights)) {
                $this->rightsManager->create(
                    0,
                    $this->roleRepo->findOneBy(['name' => 'ROLE_USER']),
                    $node,
                    false,
                    []
                );
            }
        }
    }
public function createRights ( ResourceNode $ node , array $ rights = [ ] , $ withDefault = true ) { foreach ( $ rights as $ data ) { $ resourceTypes = $ this -> checkResourceTypes ( $ data [ 'create' ] ) ; $ this -> rightsManager -> create ( $ data , $ data [ 'role' ] , $ node , false , $ resourceTypes ) ; } if ( $ withDefault ) { if ( ! array_key_exists ( 'ROLE_ANONYMOUS' , $ rights ) ) { $ this -> rightsManager -> create ( 0 , $ this -> roleRepo -> findOneBy ( [ 'name' => 'ROLE_ANONYMOUS' ] ) , $ node , false , [ ] ) ; } if ( ! array_key_exists ( 'ROLE_USER' , $ rights ) ) { $ this -> rightsManager -> create ( 0 , $ this -> roleRepo -> findOneBy ( [ 'name' => 'ROLE_USER' ] ) , $ node , false , [ ] ) ; } } }
Create the rights for a node.

array $rights should be defined that way:
array('ROLE_WS_XXX' => array('open' => true, 'edit' => false, ...
'create' => array('directory', ...), 'role' => $entity))

@param \Claroline\CoreBundle\Entity\Resource\ResourceNode $node
@param array                                              $rights
@param bool                                               $withDefault
Create the rights for a node .