You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SponsorshipController.php 1.3KB

пре 6 месеци
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace backend\controllers;
  3. use backend\controllers\BackendController;
  4. use domain\Feature\Feature\Feature;
  5. use yii\filters\AccessControl;
  6. class SponsorshipController extends BackendController
  7. {
  8. public function behaviors()
  9. {
  10. return [
  11. 'access' => [
  12. 'class' => AccessControl::class,
  13. 'rules' => [
  14. [
  15. 'allow' => true,
  16. 'roles' => ['@'],
  17. 'matchCallback' => function ($rule, $action) {
  18. return
  19. $this->getFeatureModule()->getChecker()->isEnabled(Feature::ALIAS_SPONSORSHIP)
  20. && $this->getUserModule()
  21. ->getAuthorizationChecker()
  22. ->isGrantedAsProducer($this->getUserCurrent());
  23. }
  24. ],
  25. ],
  26. ],
  27. ];
  28. }
  29. public function actionIndex()
  30. {
  31. $producerCurrent = $this->getProducerCurrent();
  32. return $this->render('index', [
  33. 'producer' => $producerCurrent,
  34. 'producersGodsonsArray' => $this->getProducerModule()->getRepository()->findProducersSponsorshipGodsons($producerCurrent)
  35. ]);
  36. }
  37. }