Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

42 lines
1.3KB

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