Loading src/BjyAuthorize/Guard/AbstractGuard.php +8 −6 Changes for src/BjyAuthorize/Guard/AbstractGuard.php: 8 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -48,20 +48,22 @@ abstract class AbstractGuard extends AbstractListenerAggregate implements } /** * @return mixed * @return void */ public function processConfig() { $this->makeRules($this->config); $this->makeRules(); } /** * @param array $rules * */ protected function makeRules(array $rules) protected function makeRules() { $rules = $this->config; foreach ($rules as $rule) { $rule['roles'] = (array) $rule['roles']; $rule['roles'] = (array) ($rule['roles'] ?? null); $rule['action'] = isset($rule['action']) ? (array) $rule['action'] : array(null); foreach ($this->extractResourcesFromRule($rule) as $resource) { Loading Loading @@ -98,7 +100,7 @@ abstract class AbstractGuard extends AbstractListenerAggregate implements $rules = array(); foreach ($this->rules as $resource => $ruleData) { $rule = array(); $rule[] = $ruleData['roles']; $rule[] = (array) ($ruleData['roles'] ?? null); $rule[] = $resource; if (isset($ruleData['assertion'])) { Loading src/BjyAuthorize/Module.php +5 −7 Changes for src/BjyAuthorize/Module.php: 5 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace BjyAuthorize; use Interop\Container\ContainerInterface; use Zend\EventManager\AbstractListenerAggregate; use Zend\EventManager\EventInterface; use Zend\ModuleManager\Feature\AutoloaderProviderInterface; Loading @@ -9,7 +10,6 @@ use Zend\ModuleManager\Feature\BootstrapListenerInterface; use Zend\ModuleManager\Feature\ConfigProviderInterface; use Zend\ModuleManager\Feature\ControllerPluginProviderInterface; use Zend\ModuleManager\Feature\ViewHelperProviderInterface; use Zend\ServiceManager\AbstractPluginManager; /** * BjyAuthorize Module Loading Loading @@ -52,10 +52,9 @@ class Module implements { return array( 'factories' => array( 'isAllowed' => function (AbstractPluginManager $pluginManager) { $serviceLocator = $pluginManager; 'isAllowed' => function (ContainerInterface $container) { /* @var $authorize \BjyAuthorize\Service\Authorize */ $authorize = $serviceLocator->get('BjyAuthorize\Service\Authorize'); $authorize = $container->get('BjyAuthorize\Service\Authorize'); return new View\Helper\IsAllowed($authorize); } Loading @@ -70,10 +69,9 @@ class Module implements { return array( 'factories' => array( 'isAllowed' => function (AbstractPluginManager $pluginManager) { $serviceLocator = $pluginManager; 'isAllowed' => function (ContainerInterface $container) { /* @var $authorize \BjyAuthorize\Service\Authorize */ $authorize = $serviceLocator->get('BjyAuthorize\Service\Authorize'); $authorize = $container->get('BjyAuthorize\Service\Authorize'); return new Controller\Plugin\IsAllowed($authorize); } Loading src/BjyAuthorize/Service/BaseProvidersServiceFactory.php +2 −1 Changes for src/BjyAuthorize/Service/BaseProvidersServiceFactory.php: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ abstract class BaseProvidersServiceFactory implements FactoryInterface foreach ($config[static::PROVIDER_SETTING] as $providerName => $providerConfig) { if ($container->has($providerName)) { $provider = $container->get($providerName); if ($provider instanceof ProviderInterface) { if (method_exists($provider, 'setConfig')) { // if ($provider instanceof ProviderInterface) { $provider->setConfig($providerConfig); $provider->processConfig(); } Loading Loading
src/BjyAuthorize/Guard/AbstractGuard.php +8 −6 Changes for src/BjyAuthorize/Guard/AbstractGuard.php: 8 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -48,20 +48,22 @@ abstract class AbstractGuard extends AbstractListenerAggregate implements } /** * @return mixed * @return void */ public function processConfig() { $this->makeRules($this->config); $this->makeRules(); } /** * @param array $rules * */ protected function makeRules(array $rules) protected function makeRules() { $rules = $this->config; foreach ($rules as $rule) { $rule['roles'] = (array) $rule['roles']; $rule['roles'] = (array) ($rule['roles'] ?? null); $rule['action'] = isset($rule['action']) ? (array) $rule['action'] : array(null); foreach ($this->extractResourcesFromRule($rule) as $resource) { Loading Loading @@ -98,7 +100,7 @@ abstract class AbstractGuard extends AbstractListenerAggregate implements $rules = array(); foreach ($this->rules as $resource => $ruleData) { $rule = array(); $rule[] = $ruleData['roles']; $rule[] = (array) ($ruleData['roles'] ?? null); $rule[] = $resource; if (isset($ruleData['assertion'])) { Loading
src/BjyAuthorize/Module.php +5 −7 Changes for src/BjyAuthorize/Module.php: 5 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace BjyAuthorize; use Interop\Container\ContainerInterface; use Zend\EventManager\AbstractListenerAggregate; use Zend\EventManager\EventInterface; use Zend\ModuleManager\Feature\AutoloaderProviderInterface; Loading @@ -9,7 +10,6 @@ use Zend\ModuleManager\Feature\BootstrapListenerInterface; use Zend\ModuleManager\Feature\ConfigProviderInterface; use Zend\ModuleManager\Feature\ControllerPluginProviderInterface; use Zend\ModuleManager\Feature\ViewHelperProviderInterface; use Zend\ServiceManager\AbstractPluginManager; /** * BjyAuthorize Module Loading Loading @@ -52,10 +52,9 @@ class Module implements { return array( 'factories' => array( 'isAllowed' => function (AbstractPluginManager $pluginManager) { $serviceLocator = $pluginManager; 'isAllowed' => function (ContainerInterface $container) { /* @var $authorize \BjyAuthorize\Service\Authorize */ $authorize = $serviceLocator->get('BjyAuthorize\Service\Authorize'); $authorize = $container->get('BjyAuthorize\Service\Authorize'); return new View\Helper\IsAllowed($authorize); } Loading @@ -70,10 +69,9 @@ class Module implements { return array( 'factories' => array( 'isAllowed' => function (AbstractPluginManager $pluginManager) { $serviceLocator = $pluginManager; 'isAllowed' => function (ContainerInterface $container) { /* @var $authorize \BjyAuthorize\Service\Authorize */ $authorize = $serviceLocator->get('BjyAuthorize\Service\Authorize'); $authorize = $container->get('BjyAuthorize\Service\Authorize'); return new Controller\Plugin\IsAllowed($authorize); } Loading
src/BjyAuthorize/Service/BaseProvidersServiceFactory.php +2 −1 Changes for src/BjyAuthorize/Service/BaseProvidersServiceFactory.php: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -32,7 +32,8 @@ abstract class BaseProvidersServiceFactory implements FactoryInterface foreach ($config[static::PROVIDER_SETTING] as $providerName => $providerConfig) { if ($container->has($providerName)) { $provider = $container->get($providerName); if ($provider instanceof ProviderInterface) { if (method_exists($provider, 'setConfig')) { // if ($provider instanceof ProviderInterface) { $provider->setConfig($providerConfig); $provider->processConfig(); } Loading