public function listAction(Exercise $exercise, User $user, Request $request)
    {
        $this->assertHasPermission('OPEN', $exercise);

        $params = $request->query->all();

        $params['hiddenFilters'] = [];
        $params['hiddenFilters']['exercise'] = $exercise->getId();
        $serializationOptions = [];

        $collection = new ResourceCollection([$exercise->getResourceNode()]);
        if (!$this->authorization->isGranted('ADMINISTRATE', $collection) &&
            !$this->authorization->isGranted('MANAGE_PAPERS', $collection)
        ) {
            $params['hiddenFilters']['user'] = $user->getId();
        } elseif (ShowScoreAt::NEVER !== $exercise->getMarkMode()) {
            $serializationOptions[] = Transfer::INCLUDE_USER_SCORE;
        }

        return new JsonResponse(
            $this->finder->search(Paper::class, $params, $serializationOptions)
        );
    }
public function listAction(Exercise $exercise, User $user, Request $request)
    {
        $this->assertHasPermission('OPEN', $exercise);

        $params = $request->query->all();

        $params['hiddenFilters'] = [];
        $params['hiddenFilters']['exercise'] = $exercise->getId();
        $serializationOptions = [];

        $collection = new ResourceCollection([$exercise->getResourceNode()]);
        if (!$this->authorization->isGranted('ADMINISTRATE', $collection) &&
            !$this->authorization->isGranted('MANAGE_PAPERS', $collection)
        ) {
            $params['hiddenFilters']['user'] = $user->getId();
        } elseif (ShowScoreAt::NEVER !== $exercise->getMarkMode()) {
            $serializationOptions[] = Transfer::INCLUDE_USER_SCORE;
        }

        return new JsonResponse(
            $this->finder->search(Paper::class, $params, $serializationOptions)
        );
    }
public function listAction ( Exercise $ exercise , User $ user , Request $ request ) { $ this -> assertHasPermission ( 'OPEN' , $ exercise ) ; $ params = $ request -> query -> all ( ) ; $ params [ 'hiddenFilters' ] = [ ] ; $ params [ 'hiddenFilters' ] [ 'exercise' ] = $ exercise -> getId ( ) ; $ serializationOptions = [ ] ; $ collection = new ResourceCollection ( [ $ exercise -> getResourceNode ( ) ] ) ; if ( ! $ this -> authorization -> isGranted ( 'ADMINISTRATE' , $ collection ) && ! $ this -> authorization -> isGranted ( 'MANAGE_PAPERS' , $ collection ) ) { $ params [ 'hiddenFilters' ] [ 'user' ] = $ user -> getId ( ) ; } elseif ( ShowScoreAt :: NEVER !== $ exercise -> getMarkMode ( ) ) { $ serializationOptions [ ] = Transfer :: INCLUDE_USER_SCORE ; } return new JsonResponse ( $ this -> finder -> search ( Paper :: class , $ params , $ serializationOptions ) ) ; }
Returns all the papers associated with an exercise.
Administrators get the papers of all users, others get only theirs.

@EXT\Route("", name="exercise_paper_list")
@EXT\Method("GET")
@EXT\ParamConverter("user", converter="current_user")

@param Exercise $exercise
@param User     $user
@param Request  $request

@return JsonResponse
Returns all the papers associated with an exercise . Administrators get the papers of all users others get only theirs .