public function behaviors() | public function behaviors() | ||||
{ | { | ||||
return [ | return [ | ||||
'verbs' => [ | |||||
'class' => VerbFilter::class, | |||||
'actions' => [ | |||||
], | |||||
], | |||||
'access' => [ | 'access' => [ | ||||
'class' => AccessControl::class, | 'class' => AccessControl::class, | ||||
'rules' => [ | 'rules' => [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->isCurrentAdmin(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsAdministrator($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
], | ], | ||||
], | ], | ||||
], | ], | ||||
'verbs' => [ | |||||
'class' => VerbFilter::class, | |||||
'actions' => [ | |||||
], | |||||
], | |||||
]; | ]; | ||||
} | } | ||||
public function behaviors() | public function behaviors() | ||||
{ | { | ||||
return [ | return [ | ||||
'verbs' => [ | |||||
'class' => VerbFilter::class, | |||||
'actions' => [ | |||||
], | |||||
], | |||||
'access' => [ | 'access' => [ | ||||
'class' => AccessControl::class, | 'class' => AccessControl::class, | ||||
'rules' => [ | 'rules' => [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
$userModule = $this->getUserModule(); | |||||
return $userModule->isCurrentAdmin() || $userModule->isCurrentProducer(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
public function behaviors() | public function behaviors() | ||||
{ | { | ||||
return [ | return [ | ||||
'verbs' => [ | |||||
'class' => VerbFilter::class, | |||||
'actions' => [ | |||||
], | |||||
], | |||||
'access' => [ | 'access' => [ | ||||
'class' => AccessControl::class, | 'class' => AccessControl::class, | ||||
'rules' => [ | 'rules' => [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->isCurrentProducer() | |||||
|| $this->getUserModule()->isCurrentAdmin(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
public function behaviors() | public function behaviors() | ||||
{ | { | ||||
return [ | return [ | ||||
'verbs' => [ | |||||
'class' => VerbFilter::class, | |||||
'actions' => [ | |||||
], | |||||
], | |||||
'access' => [ | 'access' => [ | ||||
'class' => AccessControl::class, | 'class' => AccessControl::class, | ||||
'rules' => [ | 'rules' => [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
], | ], | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->isCurrentAdmin(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsAdministrator($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
public function behaviors() | public function behaviors() | ||||
{ | { | ||||
return [ | return [ | ||||
'verbs' => [ | |||||
'class' => VerbFilter::class, | |||||
'actions' => [ | |||||
], | |||||
], | |||||
'access' => [ | 'access' => [ | ||||
'class' => AccessControl::class, | 'class' => AccessControl::class, | ||||
'rules' => [ | 'rules' => [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->isCurrentAdmin(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsAdministrator($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
public function behaviors() | public function behaviors() | ||||
{ | { | ||||
return [ | return [ | ||||
'verbs' => [ | |||||
'class' => VerbFilter::class, | |||||
'actions' => [ | |||||
], | |||||
], | |||||
'access' => [ | 'access' => [ | ||||
'class' => AccessControl::class, | 'class' => AccessControl::class, | ||||
'rules' => [ | 'rules' => [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
], | ], | ||||
], | ], |
public function behaviors() | public function behaviors() | ||||
{ | { | ||||
return [ | return [ | ||||
'verbs' => [ | |||||
'class' => VerbFilter::class, | |||||
'actions' => [ | |||||
], | |||||
], | |||||
'access' => [ | 'access' => [ | ||||
'class' => AccessControl::class, | 'class' => AccessControl::class, | ||||
'rules' => [ | 'rules' => [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
use common\helpers\GlobalParam; | use common\helpers\GlobalParam; | ||||
use common\logic\Document\Quotation\Model\QuotationSearch; | use common\logic\Document\Quotation\Model\QuotationSearch; | ||||
use common\logic\Order\Order\Model\Order; | use common\logic\Order\Order\Model\Order; | ||||
use Yii; | |||||
use yii\base\UserException; | use yii\base\UserException; | ||||
use yii\filters\AccessControl; | use yii\filters\AccessControl; | ||||
use yii\filters\VerbFilter; | |||||
use yii\helpers\Html; | use yii\helpers\Html; | ||||
class QuotationController extends DocumentController | class QuotationController extends DocumentController | ||||
public function behaviors() | public function behaviors() | ||||
{ | { | ||||
return [ | return [ | ||||
'verbs' => [ | |||||
'class' => VerbFilter::class, | |||||
'actions' => [ | |||||
], | |||||
], | |||||
'access' => [ | 'access' => [ | ||||
'class' => AccessControl::class, | 'class' => AccessControl::class, | ||||
'rules' => [ | 'rules' => [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
], | ], | ||||
[ | [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->getCurrentStatus() == User::STATUS_ADMIN; | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsAdministrator($this->getUserCurrent()); | |||||
} | } | ||||
], | ], | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->isUserCurrentAdmin(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsAdministrator($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
use common\helpers\GlobalParam; | use common\helpers\GlobalParam; | ||||
use yii\filters\AccessControl; | use yii\filters\AccessControl; | ||||
use Yii; | use Yii; | ||||
use DateTime; | |||||
use DateInterval; | |||||
use DatePeriod; | |||||
class StatsController extends BackendController | class StatsController extends BackendController | ||||
{ | { | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
public function behaviors() | public function behaviors() | ||||
{ | { | ||||
return [ | return [ | ||||
'verbs' => [ | |||||
'class' => VerbFilter::class, | |||||
'actions' => [], | |||||
], | |||||
'access' => [ | 'access' => [ | ||||
'class' => AccessControl::class, | 'class' => AccessControl::class, | ||||
'rules' => [ | 'rules' => [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->isCurrentAdmin(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
use common\logic\Ticket\Ticket\Model\Ticket; | use common\logic\Ticket\Ticket\Model\Ticket; | ||||
use common\logic\Ticket\Ticket\Model\TicketSearch; | use common\logic\Ticket\Ticket\Model\TicketSearch; | ||||
use yii\filters\AccessControl; | use yii\filters\AccessControl; | ||||
use yii\filters\VerbFilter; | |||||
use yii\helpers\Html; | use yii\helpers\Html; | ||||
use yii\web\NotFoundHttpException; | use yii\web\NotFoundHttpException; | ||||
public function behaviors() | public function behaviors() | ||||
{ | { | ||||
return [ | return [ | ||||
'verbs' => [ | |||||
'class' => VerbFilter::class, | |||||
'actions' => [ | |||||
], | |||||
], | |||||
'access' => [ | 'access' => [ | ||||
'class' => AccessControl::class, | 'class' => AccessControl::class, | ||||
'rules' => [ | 'rules' => [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
namespace backend\controllers; | namespace backend\controllers; | ||||
use common\logic\Config\TaxRate\Model\TaxRate; | use common\logic\Config\TaxRate\Model\TaxRate; | ||||
use Yii; | |||||
use yii\web\NotFoundHttpException; | use yii\web\NotFoundHttpException; | ||||
use yii\filters\VerbFilter; | use yii\filters\VerbFilter; | ||||
use yii\filters\AccessControl; | use yii\filters\AccessControl; | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->isUserCurrentAdmin(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsAdministrator($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
use backend\models\CreditForm; | use backend\models\CreditForm; | ||||
use common\helpers\GlobalParam; | use common\helpers\GlobalParam; | ||||
use backend\models\MailForm; | use backend\models\MailForm; | ||||
use common\helpers\MeanPayment; | |||||
use common\helpers\Password; | use common\helpers\Password; | ||||
use common\logic\Order\Order\Model\OrderSearch; | use common\logic\Order\Order\Model\OrderSearch; | ||||
use common\logic\PointSale\PointSale\Model\PointSale; | use common\logic\PointSale\PointSale\Model\PointSale; | ||||
use common\logic\PointSale\UserPointSale\Model\UserPointSale; | use common\logic\PointSale\UserPointSale\Model\UserPointSale; | ||||
use common\logic\Payment\Model\Payment; | |||||
use common\logic\User\User\Model\User; | use common\logic\User\User\Model\User; | ||||
use common\logic\User\User\Model\UserSearch; | use common\logic\User\User\Model\UserSearch; | ||||
use common\logic\User\User\Wrapper\UserModule; | |||||
use common\logic\User\UserProducer\Model\UserProducer; | use common\logic\User\UserProducer\Model\UserProducer; | ||||
use common\logic\User\UserUserGroup\Model\UserUserGroup; | use common\logic\User\UserUserGroup\Model\UserUserGroup; | ||||
use yii\base\UserException; | use yii\base\UserException; | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
] | ] | ||||
], | ], |
use common\helpers\GlobalParam; | use common\helpers\GlobalParam; | ||||
use common\logic\User\UserGroup\Model\UserGroupSearch; | use common\logic\User\UserGroup\Model\UserGroupSearch; | ||||
use common\logic\User\UserUserGroup\Model\UserUserGroup; | use common\logic\User\UserUserGroup\Model\UserUserGroup; | ||||
use Yii; | |||||
use yii\filters\AccessControl; | use yii\filters\AccessControl; | ||||
use yii\web\NotFoundHttpException; | use yii\web\NotFoundHttpException; | ||||
use yii\filters\VerbFilter; | |||||
use yii\helpers\Html; | use yii\helpers\Html; | ||||
/** | /** | ||||
public function behaviors() | public function behaviors() | ||||
{ | { | ||||
return [ | return [ | ||||
'verbs' => [ | |||||
'class' => VerbFilter::class, | |||||
'actions' => [ | |||||
], | |||||
], | |||||
'access' => [ | 'access' => [ | ||||
'class' => AccessControl::class, | 'class' => AccessControl::class, | ||||
'rules' => [ | 'rules' => [ | ||||
'allow' => true, | 'allow' => true, | ||||
'roles' => ['@'], | 'roles' => ['@'], | ||||
'matchCallback' => function ($rule, $action) { | 'matchCallback' => function ($rule, $action) { | ||||
return $this->getUserModule()->hasAccessBackend(); | |||||
return $this->getUserModule() | |||||
->getAuthorizationChecker() | |||||
->isGrantedAsProducer($this->getUserCurrent()); | |||||
} | } | ||||
], | ], | ||||
], | ], |
return $this->lastname; | return $this->lastname; | ||||
} | } | ||||
public function getStatus(): string | |||||
{ | |||||
return $this->status; | |||||
} | |||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ |
<?php | |||||
namespace common\logic\User\User\Service; | |||||
use common\logic\AbstractUtils; | |||||
use common\logic\User\User\Model\User; | |||||
class AuthorizationChecker extends AbstractUtils | |||||
{ | |||||
protected UserSolver $userSolver; | |||||
public function loadDependencies(): void | |||||
{ | |||||
$this->userSolver = $this->loadService(UserSolver::class); | |||||
} | |||||
public function isGrantedAsAdministrator(User $user = null): bool | |||||
{ | |||||
if(!$user) { | |||||
return false; | |||||
} | |||||
return $this->userSolver->isStatusAdministrator($user); | |||||
} | |||||
public function isGrantedAsProducer(User $user = null): bool | |||||
{ | |||||
if(!$user) { | |||||
return false; | |||||
} | |||||
return $this->isGrantedAsAdministrator($user) | |||||
|| $this->userSolver->isStatusProducer($user); | |||||
} | |||||
public function isGrantedAsUser(User $user = null): bool | |||||
{ | |||||
if(!$user) { | |||||
return false; | |||||
} | |||||
return $this->isGrantedAsProducer($user) | |||||
|| $this->userSolver->isStatusUser($user); | |||||
} | |||||
} |
return $user->status == User::STATUS_ADMIN; | return $user->status == User::STATUS_ADMIN; | ||||
} | } | ||||
public function isStatusAdministrator(User $user): bool | |||||
{ | |||||
return $user->getStatus() == User::STATUS_ADMIN; | |||||
} | |||||
/** | /** | ||||
* Retourne si l'utilisateur est un producteur ou non. | * Retourne si l'utilisateur est un producteur ou non. | ||||
* | * | ||||
|| $user->status == User::STATUS_PRODUCER) && $user->id_producer; | || $user->status == User::STATUS_PRODUCER) && $user->id_producer; | ||||
} | } | ||||
public function isStatusProducer(User $user): bool | |||||
{ | |||||
return $user->getStatus() == User::STATUS_PRODUCER; | |||||
} | |||||
public function isStatusUser(User $user): bool | |||||
{ | |||||
return $user->getStatus() == User::STATUS_ACTIVE; | |||||
} | |||||
/** | /** | ||||
* Retourne l'utilisateur courant. | * Retourne l'utilisateur courant. | ||||
* | * |
use common\logic\AbstractContainer; | use common\logic\AbstractContainer; | ||||
use common\logic\User\User\Repository\UserRepository; | use common\logic\User\User\Repository\UserRepository; | ||||
use common\logic\User\User\Repository\UserRepositoryQuery; | use common\logic\User\User\Repository\UserRepositoryQuery; | ||||
use common\logic\User\User\Service\AuthorizationChecker; | |||||
use common\logic\User\User\Service\NewsletterManager; | use common\logic\User\User\Service\NewsletterManager; | ||||
use common\logic\User\User\Service\NewsletterUtils; | |||||
use common\logic\User\User\Service\UserBuilder; | use common\logic\User\User\Service\UserBuilder; | ||||
use common\logic\User\User\Service\UserDefinition; | use common\logic\User\User\Service\UserDefinition; | ||||
use common\logic\User\User\Service\UserNotifier; | use common\logic\User\User\Service\UserNotifier; | ||||
use common\logic\User\User\Service\UsersCreditCsvGenerator; | use common\logic\User\User\Service\UsersCreditCsvGenerator; | ||||
use common\logic\User\User\Service\UserSolver; | use common\logic\User\User\Service\UserSolver; | ||||
use common\logic\User\User\Service\UserUtils; | |||||
class UserContainer extends AbstractContainer | class UserContainer extends AbstractContainer | ||||
{ | { | ||||
UserNotifier::class, | UserNotifier::class, | ||||
UsersCreditCsvGenerator::class, | UsersCreditCsvGenerator::class, | ||||
NewsletterManager::class, | NewsletterManager::class, | ||||
AuthorizationChecker::class, | |||||
]; | ]; | ||||
} | } | ||||
{ | { | ||||
return NewsletterManager::getInstance(); | return NewsletterManager::getInstance(); | ||||
} | } | ||||
public function getAuthorizationChecker(): AuthorizationChecker | |||||
{ | |||||
return AuthorizationChecker::getInstance(); | |||||
} | |||||
} | } |
use common\logic\AbstractModule; | use common\logic\AbstractModule; | ||||
use common\logic\User\User\Repository\UserRepository; | use common\logic\User\User\Repository\UserRepository; | ||||
use common\logic\User\User\Service\AuthorizationChecker; | |||||
use common\logic\User\User\Service\NewsletterManager; | use common\logic\User\User\Service\NewsletterManager; | ||||
use common\logic\User\User\Service\UserBuilder; | use common\logic\User\User\Service\UserBuilder; | ||||
use common\logic\User\User\Service\UserDefinition; | use common\logic\User\User\Service\UserDefinition; | ||||
* @mixin UserNotifier | * @mixin UserNotifier | ||||
* @mixin UsersCreditCsvGenerator | * @mixin UsersCreditCsvGenerator | ||||
* @mixin NewsletterManager | * @mixin NewsletterManager | ||||
* @mixin AuthorizationChecker | |||||
*/ | */ | ||||
class UserModule extends AbstractModule | class UserModule extends AbstractModule | ||||
{ | { | ||||
{ | { | ||||
return $this->container; | return $this->container; | ||||
} | } | ||||
public function getAuthorizationChecker(): AuthorizationChecker | |||||
{ | |||||
return AuthorizationChecker::getInstance(); | |||||
} | |||||
} | } |
use common\helpers\MeanPayment; | use common\helpers\MeanPayment; | ||||
use common\logic\Payment\Model\Payment; | use common\logic\Payment\Model\Payment; | ||||
use producer\models\CreditForm; | use producer\models\CreditForm; | ||||
use yii\data\ActiveDataProvider; | |||||
use yii\filters\VerbFilter; | use yii\filters\VerbFilter; | ||||
class CreditController extends ProducerBaseController | class CreditController extends ProducerBaseController | ||||
{ | { | ||||
return [ | return [ | ||||
'verbs' => [ | 'verbs' => [ | ||||
'class' => VerbFilter::className(), | |||||
'class' => VerbFilter::class, | |||||
'actions' => [ | 'actions' => [ | ||||
'stripe-verification' => ['post'], | 'stripe-verification' => ['post'], | ||||
], | ], |