acl->checkScope(Email::ENTITY_TYPE)) { throw new Forbidden(); } if (!$this->acl->checkScope(Email::ENTITY_TYPE, Acl\Table::ACTION_CREATE)) { throw new Forbidden(); } $q = $request->getQueryParam('q'); if (is_string($q)) { $q = trim($q); } if (!$q) { throw new BadRequest("No `q` parameter."); } $maxSize = intval($request->getQueryParam('maxSize')); if (!$maxSize || $maxSize > self::ADDRESS_MAX_SIZE) { $maxSize = (int) $this->config->get('recordsPerPage'); } $onlyActual = $request->getQueryParam('onlyActual') === 'true'; $result = $this->service->searchInAddressBook($q, $maxSize, $onlyActual); return ResponseComposer::json($result); } }