public function mountCollection(Request $request, $databox_id, $collection_id)
    {
        $connection = $this->getApplicationBox()->get_connection();
        $connection->beginTransaction();
        try {
            /** @var Authenticator $authenticator */
            $authenticator = $this->app->getAuthenticator();
            $baseId = \collection::mount_collection(
                $this->app,
                $this->findDataboxById($databox_id),
                $collection_id,
                $authenticator->getUser()
            );

            $othCollSel = (int) $request->request->get("othcollsel") ?: null;

            if (null !== $othCollSel) {
                $query = $this->createUserQuery();
                $n = 0;

                /** @var ACLProvider $aclProvider */
                $aclProvider = $this->app['acl'];
                while ($n < $query->on_base_ids([$othCollSel])->get_total()) {
                    $results = $query->limit($n, 50)->execute()->get_results();

                    foreach ($results as $user) {
                        $aclProvider->get($user)->duplicate_right_from_bas($othCollSel, $baseId);
                    }

                    $n += 50;
                }
            }

            $connection->commit();

            return $this->app->redirectPath('admin_database', [
                'databox_id' => $databox_id,
                'mount'      => 'ok',
            ]);
        } catch (\Exception $e) {
            $connection->rollBack();

            return $this->app->redirectPath('admin_database', [
                'databox_id' => $databox_id,
                'mount'      => 'ko',
            ]);
        }
    }
public function mountCollection(Request $request, $databox_id, $collection_id)
    {
        $connection = $this->getApplicationBox()->get_connection();
        $connection->beginTransaction();
        try {
            /** @var Authenticator $authenticator */
            $authenticator = $this->app->getAuthenticator();
            $baseId = \collection::mount_collection(
                $this->app,
                $this->findDataboxById($databox_id),
                $collection_id,
                $authenticator->getUser()
            );

            $othCollSel = (int) $request->request->get("othcollsel") ?: null;

            if (null !== $othCollSel) {
                $query = $this->createUserQuery();
                $n = 0;

                /** @var ACLProvider $aclProvider */
                $aclProvider = $this->app['acl'];
                while ($n < $query->on_base_ids([$othCollSel])->get_total()) {
                    $results = $query->limit($n, 50)->execute()->get_results();

                    foreach ($results as $user) {
                        $aclProvider->get($user)->duplicate_right_from_bas($othCollSel, $baseId);
                    }

                    $n += 50;
                }
            }

            $connection->commit();

            return $this->app->redirectPath('admin_database', [
                'databox_id' => $databox_id,
                'mount'      => 'ok',
            ]);
        } catch (\Exception $e) {
            $connection->rollBack();

            return $this->app->redirectPath('admin_database', [
                'databox_id' => $databox_id,
                'mount'      => 'ko',
            ]);
        }
    }
public function mountCollection ( Request $ request , $ databox_id , $ collection_id ) { $ connection = $ this -> getApplicationBox ( ) -> get_connection ( ) ; $ connection -> beginTransaction ( ) ; try { /** @var Authenticator $authenticator */ $ authenticator = $ this -> app -> getAuthenticator ( ) ; $ baseId = \ collection :: mount_collection ( $ this -> app , $ this -> findDataboxById ( $ databox_id ) , $ collection_id , $ authenticator -> getUser ( ) ) ; $ othCollSel = ( int ) $ request -> request -> get ( "othcollsel" ) ? : null ; if ( null !== $ othCollSel ) { $ query = $ this -> createUserQuery ( ) ; $ n = 0 ; /** @var ACLProvider $aclProvider */ $ aclProvider = $ this -> app [ 'acl' ] ; while ( $ n < $ query -> on_base_ids ( [ $ othCollSel ] ) -> get_total ( ) ) { $ results = $ query -> limit ( $ n , 50 ) -> execute ( ) -> get_results ( ) ; foreach ( $ results as $ user ) { $ aclProvider -> get ( $ user ) -> duplicate_right_from_bas ( $ othCollSel , $ baseId ) ; } $ n += 50 ; } } $ connection -> commit ( ) ; return $ this -> app -> redirectPath ( 'admin_database' , [ 'databox_id' => $ databox_id , 'mount' => 'ok' , ] ) ; } catch ( \ Exception $ e ) { $ connection -> rollBack ( ) ; return $ this -> app -> redirectPath ( 'admin_database' , [ 'databox_id' => $ databox_id , 'mount' => 'ko' , ] ) ; } }
Mount a collection on a databox

@param  Request $request       The current HTTP request
@param  integer $databox_id    The requested databox
@param  integer $collection_id The requested collection id
@return RedirectResponse
Mount a collection on a databox