- throw 'bad verb' if no verb is given in oai -request
- handleGetRecord: break if no identifier is given - handleGetRecord: break if no metadataPrefix is given - allow post and get for oai requests
This commit is contained in:
parent
64faf73564
commit
4a6c69100a
|
@ -145,9 +145,10 @@ class RequestController extends Controller
|
|||
$this->handleIllegalVerb();
|
||||
}
|
||||
} else {
|
||||
$oaiRequest['verb'] = 'Identify';
|
||||
$this->proc->setParameter('', 'oai_verb', $oaiRequest['verb']);
|
||||
$this->doc = $this->handleIdentify();
|
||||
// $oaiRequest['verb'] = 'Identify';
|
||||
// $this->proc->setParameter('', 'oai_verb', $oaiRequest['verb']);
|
||||
// $this->doc = $this->handleIdentify();
|
||||
throw new OaiModelException('The verb provided in the request is illegal.', OaiModelError::BADVERB);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,8 +185,17 @@ class RequestController extends Controller
|
|||
{
|
||||
$repIdentifier = "tethys.at";
|
||||
$this->proc->setParameter('', 'repIdentifier', $repIdentifier);
|
||||
|
||||
|
||||
|
||||
// Identifier references metadata Urn, not plain Id!
|
||||
// Currently implemented as 'oai:foo.bar.de:{docId}' or 'urn:nbn...-123'
|
||||
if (!array_key_exists('identifier', $oaiRequest)) {
|
||||
throw new OaiModelException(
|
||||
'The prefix of the identifier argument is unknown.',
|
||||
OaiModelError::BADARGUMENT
|
||||
);
|
||||
}
|
||||
$dataId = $this->getDocumentIdByIdentifier($oaiRequest['identifier']);
|
||||
|
||||
$dataset = null;
|
||||
|
@ -203,6 +213,11 @@ class RequestController extends Controller
|
|||
$metadataPrefix = null;
|
||||
if (true === array_key_exists('metadataPrefix', $oaiRequest)) {
|
||||
$metadataPrefix = $oaiRequest['metadataPrefix'];
|
||||
} else {
|
||||
throw new OaiModelException(
|
||||
'The prefix of the metadata argument is unknown.',
|
||||
OaiModelError::BADARGUMENT
|
||||
);
|
||||
}
|
||||
$this->proc->setParameter('', 'oai_metadataPrefix', $metadataPrefix);
|
||||
|
||||
|
|
|
@ -11,6 +11,6 @@ class VerifyCsrfToken extends Middleware
|
|||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
'oai*',
|
||||
];
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace App\Models\Oai;
|
||||
|
||||
use App\Exceptions\OaiModelException;
|
||||
|
||||
class OaiModelError
|
||||
{
|
||||
/**
|
||||
|
@ -35,7 +37,7 @@ class OaiModelError
|
|||
public static function mapCode($code)
|
||||
{
|
||||
if (false === array_key_exists($code, self::$oaiErrorCodes)) {
|
||||
throw new Oai_Model_Exception("Unknown oai error code $code");
|
||||
throw new OaiModelException("Unknown oai error code $code");
|
||||
}
|
||||
return self::$oaiErrorCodes[$code];
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use Illuminate\Support\Facades\Route;
|
|||
//Auth::routes();
|
||||
//Route::get('/home', 'HomeController@index')->name('home');
|
||||
|
||||
Route::get('/oai', ['as' => 'oai', 'uses' => 'Oai\RequestController@index']);
|
||||
Route::match(array('GET','POST'), '/oai', ['as' => 'oai', 'uses' => 'Oai\RequestController@index']);
|
||||
|
||||
//Route::get('/', 'LocalizationController@index');
|
||||
Route::get(
|
||||
|
|
Loading…
Reference in New Issue
Block a user