Search code examples
phpyii2rbac

Access to /admin/* in Yii2 mdmsoft/yii2-admin


How to grant access to /admin/* in Yii2 mdmsoft/yii2-admin for specific role only?


Solution

  • I've been playing with this all day and I have finally worked it out. I wanted to deny the use of mdm to everyone who wasn't admin. I was expecting to be able to set up a deny rule then allow access to it for some users but it doesn't seem to work like this.

    The basic principle is deny everything then allow you to create permissions (or roles) specifying the routes you want to allow.

    I have written a full step-by-step article on how to configure Yii2 mdmsoft/yii2-admin to restrict access to a particular module, which explains how to set it all up and configure it.