-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added multi app (frontend/backend) support. #309
Conversation
look good to me. Need to be verified |
…apps (frontend/backend). I did not notice, that $module->getUniqueId() returns an empty string when $module is the app itself. Therefore the cache could not differenciate between frontend and backend. Thus resulting in the same routes for all indicated apps.
…l = # and is used as a container for sub-items. If all the subitems are forbidden then this patch removes the parent entry as well.
Bug report: Yii debug disappear in my temp solution is add In other pages, simply add |
What is the status of this pull request? I have tried this modified code with my development. It works fine except that when list routes from backend it display frontend layout? I am trying to find what is the cause of problem and will contribute back. Any recommendations? Thanks all developers here for great extension it made RBAC implementations a lot easier. |
Ok, It works now. I change module layout config from @app/views/layouts/main.php to @backend/views/layouts/main.php. |
Change provided by @firefox747 is very usefull but looks like it introduced issue on Permissions UI: now all available routes are shown on Permissions list. UPD: did fix in pull request #410 |
Problem with menu printing |
Since i would like this extension to work with Yii2s advanced template, i made some modifications.
Basically, if you do not configure anything, this PR still works as the original with support for the basic application template.
You can however configure multiple apps according to your individual (or default advanced) template. For this feature to work i use the Configs->advanced property.
For example, the following array in @common/config/params.php configures this extension to work with the Yii2 advanced template.
advanced needs to be an array. Each item consists of
key: (string) application id as defined in @{app}/config/main.php (app-backend and app-frontend in this configuration) and
value: (array) of configuration files used by the respective application. I use the Yii::getAlias() method, so using aliases works fine.
Now you can set up the module part of this extension only in the backend of your application. There you can access all application wide routes. So you are able, for example, to grant User1 access to the a specific action or controller in the frontend (@app-frontend/demo/some-action), while giving User2 access to the same action or controller in the backend (@app-backend/demo/some-action).
The advanced routes contain the application id as prefix, e.g. @app-backend/admin/* or @app-frontend/*