customerapi: on cancel check also registration ownership
This commit is contained in:
@@ -18,6 +18,4 @@ use yii\web\NotFoundHttpException;
|
||||
class CustomerApiController extends RestController
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -122,29 +122,6 @@ class EventController extends \customerapi\controllers\CustomerApiController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Query $query
|
||||
* @param $interval
|
||||
* @return Query the query with the added conditions
|
||||
*/
|
||||
private function buildEventQuery($query, $interval)
|
||||
{
|
||||
|
||||
$paramEventStartMax = (clone $interval->lastActiveDate);
|
||||
$paramEventStartMax = $paramEventStartMax->modify('+1 day');
|
||||
$paramEventStartMax = $paramEventStartMax->getTimestamp();
|
||||
|
||||
|
||||
/** @var ActiveQuery $query */
|
||||
return $query
|
||||
->innerJoinWith('trainer')
|
||||
->innerJoinWith('eventType')
|
||||
->innerJoinWith('room')
|
||||
->joinWith('activeEventRegistrations')
|
||||
->andWhere(['>=', 'event.start', $interval->firstActiveDate->getTimestamp()])
|
||||
->andWhere(['<', 'event.start', $paramEventStartMax])
|
||||
->andWhere(['event.active' => '1']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $id_event the id of the event
|
||||
|
||||
@@ -76,9 +76,9 @@ class EventRegistrationController extends CustomerApiController
|
||||
*/
|
||||
public function actionCancel($idRegistration) {
|
||||
$manager = new \common\manager\EventRegistrationManager();
|
||||
$registration = $manager->loadRegistration($idRegistration);
|
||||
$manager->cancelRegistration($registration);
|
||||
$registration = $manager->loadRegistration($idRegistration);
|
||||
$registration = $manager->loadRegistration($idRegistration,\Yii::$app->user->id);
|
||||
$manager->cancelRegistration($registration,\Yii::$app->user->id);
|
||||
$registration = $manager->loadRegistration($idRegistration,\Yii::$app->user->id);
|
||||
return $this->asJson($registration);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,43 +38,43 @@ class SiteController extends Controller
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return [
|
||||
'error' => [
|
||||
'class' => 'yii\web\ErrorAction',
|
||||
],
|
||||
'captcha' => [
|
||||
'class' => 'yii\captcha\CaptchaAction',
|
||||
'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
|
||||
],
|
||||
];
|
||||
}
|
||||
// /**
|
||||
// * @inheritdoc
|
||||
// */
|
||||
// public function actions()
|
||||
// {
|
||||
// return [
|
||||
// 'error' => [
|
||||
// 'class' => 'yii\web\ErrorAction',
|
||||
// ],
|
||||
// 'captcha' => [
|
||||
// 'class' => 'yii\captcha\CaptchaAction',
|
||||
// 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
|
||||
// ],
|
||||
// ];
|
||||
// }
|
||||
|
||||
/**
|
||||
* Displays homepage.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex()
|
||||
{
|
||||
return $this->render('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out the current user.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionLogout()
|
||||
{
|
||||
Yii::$app->user->logout();
|
||||
|
||||
return $this->goHome();
|
||||
}
|
||||
// /**
|
||||
// * Displays homepage.
|
||||
// *
|
||||
// * @return mixed
|
||||
// */
|
||||
// public function actionIndex()
|
||||
// {
|
||||
// return $this->render('index');
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Logs out the current user.
|
||||
// *
|
||||
// * @return mixed
|
||||
// */
|
||||
// public function actionLogout()
|
||||
// {
|
||||
// Yii::$app->user->logout();
|
||||
//
|
||||
// return $this->goHome();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user