Added check for preorderType in address and campaign to api
This commit is contained in:
@@ -535,6 +535,24 @@ class PreorderApicontroller extends mfBaseApicontroller {
|
||||
return mfResponse::Forbidden(['message' => "Bestellung in diesem Netzgebiet/Cluster nicht erlaubt"]);
|
||||
}
|
||||
|
||||
// check for allowed PreorderType in address
|
||||
$allowed_freigabe = json_decode($address->freigabe);
|
||||
if(!is_array($allowed_freigabe) || !count($allowed_freigabe)) {
|
||||
return mfResponse::Forbidden(['message' => "Adresse (noch) nicht bestellbar"]);
|
||||
}
|
||||
if(!in_array($type, $allowed_freigabe)) {
|
||||
return mfResponse::Forbidden(['message' => "Adresse (noch) nicht bestellbar"]);
|
||||
}
|
||||
|
||||
// check for allowed PreorderType in campaign
|
||||
$allowed_campaigntypes = $this->campaign->types;
|
||||
if(!is_array($allowed_campaigntypes) || !count($allowed_campaigntypes)) {
|
||||
return mfResponse::Forbidden(['message' => "PreorderType not allowed"]);
|
||||
}
|
||||
if(!array_key_exists($type, $allowed_campaigntypes)) {
|
||||
return mfResponse::Forbidden(['message' => "PreorderType not allowed"]);
|
||||
}
|
||||
|
||||
/*
|
||||
* build fields
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user