Page 1 of 1

Zend Permission Rbac

Posted: Wed Feb 14, 2018 3:50 pm
by marc6891
Hi friends,

Recently, I am learning zend framework 3, so I need to help, please. I have read a example docszendframeworkcom/zend-permissions-rbac/ but this example is very short because It don't explain where I can use Rbac, that is to say, I don't know where I have to place the code. Have I write the code in file Module.php? Have I make a class....? I only want to have two role admin and user. I would like to learn how to use it.

Someone can guide me?

Thank very much.

Re: Zend Permission Rbac

Posted: Sun Feb 18, 2018 11:00 am
by kian6526
You may do it in an action controller, or in the factory of controller include an instance of role object in constructor of controller, or create a service, include the service in constructor of the factory of controller and in that service include role object and related methods to return role object in action controller so by calling the service and its method you access the role object of yours
Good Luck
Kian William

Re: Zend Permission Rbac

Posted: Sun Feb 18, 2018 11:34 am
by kian6526
Also you may give the role in onDispatch event of the controller of yours when a user registers or an admin logs in.
Kian William