@@ -39,6 +39,7 @@ termes. | |||
namespace backend\controllers; | |||
use common\models\Producer ; | |||
use common\models\User ; | |||
/** | |||
* UserController implements the CRUD actions for User model. | |||
@@ -61,7 +62,7 @@ class CommunicateController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return Yii::$app->user->identity->status == USER::STATUS_ADMIN || Yii::$app->user->identity->status == USER::STATUS_BOULANGER; | |||
return User::hasAccessBackend(); | |||
} | |||
] | |||
], |
@@ -40,13 +40,13 @@ namespace backend\controllers; | |||
use Yii; | |||
use yii\filters\AccessControl; | |||
use common\models\PointVente; | |||
use common\models\PointSale; | |||
use yii\data\ActiveDataProvider; | |||
use yii\web\Controller; | |||
use yii\web\NotFoundHttpException; | |||
use yii\filters\VerbFilter; | |||
use common\models\User; | |||
use common\models\PointVenteUser; | |||
use common\models\UserPointSale; | |||
/** | |||
* PointVenteController implements the CRUD actions for PointVente model. | |||
@@ -69,8 +69,7 @@ class PointVenteController extends BackendController | |||
'allow' => true, | |||
'roles' => ['@'], | |||
'matchCallback' => function ($rule, $action) { | |||
return Yii::$app->user->identity->status == USER::STATUS_ADMIN | |||
|| Yii::$app->user->identity->status == USER::STATUS_BOULANGER; | |||
return User::hasAccessBackend(); | |||
} | |||
], | |||
], |
@@ -49,7 +49,7 @@ use common\helpers\Url ; | |||
<p>Voici votre identifiant de connexion : <br /> | |||
<strong><?= Html::encode($user->email) ?></strong></p> | |||
<?php if($user->status == User::STATUS_BOULANGER): ?> | |||
<?php if($user->status == User::STATUS_PRODUCER): ?> | |||
<p>Vous pouvez dès maintenant vous connecter à votre <a href="<?= Url::backend(); ?>">Espace boulanger</a> pour mettre | |||
en place votre système de réservation.</p> | |||
<?php else: ?> |
@@ -48,7 +48,7 @@ Votre inscription sur La boîte à pain a bien été prise en compte. | |||
Voici votre identifiant de connexion : | |||
<?= $user->email ?> | |||
<?php if($user->status == User::STATUS_BOULANGER): ?> | |||
<?php if($user->status == User::STATUS_PRODUCER): ?> | |||
Vous pouvez dès maintenant vous connecter à votre Espace boulanger pour mettre en place votre système de réservation : | |||
<?= Url::backend(); ?> | |||
<?php else: ?> |
@@ -101,7 +101,7 @@ class User extends ActiveRecordCommon implements IdentityInterface | |||
['email', 'email', 'message' => 'Cette adresse email n\'est pas valide'], | |||
['email', 'verifyEmail'], | |||
['status', 'default', 'value' => self::STATUS_ACTIVE], | |||
['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED, self::STATUS_ADMIN, self::STATUS_BOULANGER]], | |||
['status', 'in', 'range' => [self::STATUS_ACTIVE, self::STATUS_DELETED, self::STATUS_ADMIN, self::STATUS_PRODUCER]], | |||
['password_old', 'verifyPasswordOld'], | |||
['password_new', 'verifyPasswordNew'], | |||
['password_new_confirm', 'verifyPasswordNewConfirm'], |
@@ -243,7 +243,7 @@ class SignupForm extends Model | |||
// user | |||
$user->id_etablissement = $etablissement->id; | |||
$user->status = User::STATUS_BOULANGER; | |||
$user->status = User::STATUS_PRODUCER; | |||
// envoi d'un email à l'administrateur pour le prévenir | |||
Yii::$app->mailer->compose( |