Browse Source

[Technique] Mise en place AuthorizationChecker #1328

feature/souke
Guillaume Bourgeois 1 year ago
parent
commit
063f1ea64d
33 changed files with 164 additions and 105 deletions
  1. +3
    -6
      backend/controllers/AccessController.php
  2. +3
    -1
      backend/controllers/CommunicateAdminController.php
  3. +3
    -1
      backend/controllers/CommunicateController.php
  4. +3
    -1
      backend/controllers/CreditController.php
  5. +3
    -6
      backend/controllers/DashboardController.php
  6. +3
    -6
      backend/controllers/DeliveryNoteController.php
  7. +3
    -1
      backend/controllers/DevelopmentController.php
  8. +3
    -2
      backend/controllers/DistributionController.php
  9. +3
    -6
      backend/controllers/DocumentController.php
  10. +3
    -2
      backend/controllers/OrderController.php
  11. +3
    -6
      backend/controllers/PointSaleController.php
  12. +3
    -1
      backend/controllers/ProducerAdminController.php
  13. +3
    -1
      backend/controllers/ProducerController.php
  14. +3
    -6
      backend/controllers/ProducerPriceRangeAdminController.php
  15. +3
    -6
      backend/controllers/ProductCategoryController.php
  16. +3
    -6
      backend/controllers/ProductController.php
  17. +3
    -8
      backend/controllers/QuotationController.php
  18. +3
    -1
      backend/controllers/ReportController.php
  19. +6
    -2
      backend/controllers/SiteController.php
  20. +3
    -1
      backend/controllers/StatsAdminController.php
  21. +3
    -4
      backend/controllers/StatsController.php
  22. +3
    -1
      backend/controllers/SubscriptionController.php
  23. +3
    -5
      backend/controllers/SupportAdminController.php
  24. +3
    -7
      backend/controllers/SupportController.php
  25. +3
    -2
      backend/controllers/TaxRateAdminController.php
  26. +3
    -4
      backend/controllers/UserController.php
  27. +3
    -8
      backend/controllers/UserGroupController.php
  28. +5
    -0
      common/logic/User/User/Model/User.php
  29. +45
    -0
      common/logic/User/User/Service/AuthorizationChecker.php
  30. +15
    -0
      common/logic/User/User/Service/UserSolver.php
  31. +7
    -2
      common/logic/User/User/Wrapper/UserContainer.php
  32. +7
    -0
      common/logic/User/User/Wrapper/UserModule.php
  33. +1
    -2
      producer/controllers/CreditController.php

+ 3
- 6
backend/controllers/AccessController.php View File

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());
} }
] ]
], ],

+ 3
- 1
backend/controllers/CommunicateAdminController.php View File

'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());
} }
] ]
], ],

+ 3
- 1
backend/controllers/CommunicateController.php View File

'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());
} }
] ]
], ],

+ 3
- 1
backend/controllers/CreditController.php View File

'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());
} }
] ]
], ],

+ 3
- 6
backend/controllers/DashboardController.php View File

'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' => [
],
],
]; ];
} }



+ 3
- 6
backend/controllers/DeliveryNoteController.php View File

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());
} }
] ]
], ],

+ 3
- 1
backend/controllers/DevelopmentController.php View File

'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());
} }
] ]
], ],

+ 3
- 2
backend/controllers/DistributionController.php View File

'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());
} }
] ]
], ],

+ 3
- 6
backend/controllers/DocumentController.php View File

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());
} }
] ]
], ],

+ 3
- 2
backend/controllers/OrderController.php View File

'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());
} }
] ]
], ],

+ 3
- 6
backend/controllers/PointSaleController.php View File

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());
} }
], ],
], ],

+ 3
- 1
backend/controllers/ProducerAdminController.php View File

'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());
} }
] ]
], ],

+ 3
- 1
backend/controllers/ProducerController.php View File

'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());
} }
] ]
], ],

+ 3
- 6
backend/controllers/ProducerPriceRangeAdminController.php View File

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());
} }
] ]
], ],

+ 3
- 6
backend/controllers/ProductCategoryController.php View File

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());
} }
], ],
], ],

+ 3
- 6
backend/controllers/ProductController.php View File

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());
} }
] ]
], ],

+ 3
- 8
backend/controllers/QuotationController.php View File

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());
} }
] ]
], ],

+ 3
- 1
backend/controllers/ReportController.php View File

'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());
} }
] ]
], ],

+ 6
- 2
backend/controllers/SiteController.php View File

'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());
} }
], ],
], ],

+ 3
- 1
backend/controllers/StatsAdminController.php View File

'allow' => true, 'allow' => true,
'roles' => ['@'], 'roles' => ['@'],
'matchCallback' => function ($rule, $action) { 'matchCallback' => function ($rule, $action) {
return $this->isUserCurrentAdmin();
return $this->getUserModule()
->getAuthorizationChecker()
->isGrantedAsAdministrator($this->getUserCurrent());
} }
] ]
], ],

+ 3
- 4
backend/controllers/StatsController.php View File

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());
} }
] ]
], ],

+ 3
- 1
backend/controllers/SubscriptionController.php View File

'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());
} }
] ]
], ],

+ 3
- 5
backend/controllers/SupportAdminController.php View File

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());
} }
] ]
], ],

+ 3
- 7
backend/controllers/SupportController.php View File

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());
} }
] ]
], ],

+ 3
- 2
backend/controllers/TaxRateAdminController.php View File

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());
} }
] ]
], ],

+ 3
- 4
backend/controllers/UserController.php View File

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());
} }
] ]
], ],

+ 3
- 8
backend/controllers/UserGroupController.php View File

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());
} }
], ],
], ],

+ 5
- 0
common/logic/User/User/Model/User.php View File

return $this->lastname; return $this->lastname;
} }


public function getStatus(): string
{
return $this->status;
}

/** /**
* @inheritdoc * @inheritdoc
*/ */

+ 45
- 0
common/logic/User/User/Service/AuthorizationChecker.php View File

<?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);
}
}

+ 15
- 0
common/logic/User/User/Service/UserSolver.php View File

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.
* *

+ 7
- 2
common/logic/User/User/Wrapper/UserContainer.php View File

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();
}
} }

+ 7
- 0
common/logic/User/User/Wrapper/UserModule.php View File



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();
}
} }

+ 1
- 2
producer/controllers/CreditController.php View File

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'],
], ],

Loading…
Cancel
Save