3

I am using BjyAuthorize to control access in my project.

Everything working as expected with hard coded settings in module.bjyauthorize.global.php file. But my requirement is to set users dynamically and assign their user levels dynamically.

So I want to connect this file to DB tables some how and dynamically load settings. Please someone help me to get my thing done

Thank you

Ariks
  • 101
  • 12

2 Answers2

1

You have to create your own Providers or Guards that will load the settings from the database. See BjyAuthorize\Provider\Role\ZendDb or BjyAuthorize\Provider\Role\ObjectRepositoryProvider.

0

You can set settings in the Module class.

use Zend\Mvc\MvcEvent;

class Module
{
    public function onBootstrap(MvcEvent $event)
    {
        $serviceManager = $event->getApplication()->getServiceManager();
        $authorizeService = $serviceManager->get('BjyAuthorize\Service\Authorize');
        // settings
    }
}
  • Thank you. In this way, do I need to add this code to each and every module seperately..? – Ariks Jun 14 '13 at 11:35
  • Depending on what exactly to configure. You can set all settings in your `Application` module. – Gocha Ossinkine Jun 14 '13 at 12:37
  • Thank you. Lets say now I wanna set "guards"( or "rule_providers","resource_providers" or any appeared in _module.bjyauthorize.global.php_) in this manner. How to approach..? – Ariks Jun 17 '13 at 05:33
  • Maybe I'm a little misunderstood the question. This version can also be, but better look at my other answer. – Gocha Ossinkine Jun 18 '13 at 10:29