add card type : review

This commit is contained in:
Schneider Roland
2022-12-01 20:51:11 +01:00
parent 3424d68a27
commit 5a705f15b0
2 changed files with 11 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
namespace mobileapi\components;
use common\components\HttpStatus;
use common\models\Card;
use common\models\MobileDevice;
use Yii;
@@ -35,8 +36,16 @@ class ActivatedFilter extends ActionFilter
if (isset($mobileDevice)) {
$deviceId = $mobileDevice->id;
$idCard = $mobileDevice->id_card;
// find out if the device is activated
$activated = $mobileDevice->status === MobileDevice::STATUS_ACTIVE;
// override activated to true, if it is a reviewer card
$card = Card::findOne($idCard);
if ( isset($card) ){
if ( isset($card->type) ){
$activated = true;
}
}
}
// if device is not activated, throw exception with http status 412
if ($activated === false) {