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
How do I add permissions from another plugin? #11
Comments
I tried plugins/Plugin/config/permissions.php but it didn't work, any ideas? should that work? |
You could do a Configure::read, apply your rules, then Configure::write inside your plugin's bootstrap file... |
Do I read it like so?
I am doing a
right after the read, but it is outputting blank... |
Ok, I figured out that if I put the following in the plugin bootstrap, it gets overwritten, however, if I put it in an action, it doesn't get overwritten, but also doesn't do me any good at that point, since I cant put it in the bootstrap, where should I put it at?
|
Hi @jeffreyroberts I've answered in SO, let me paste it here too for reference https://stackoverflow.com/a/46034035/365877 You can load permissions.php file from the Plugin as it is doing now, but change the contents of permissions.php to preserve existing permissions defined in configuration, for example: config/permissions.php $permissions = [ // there are more permissions in this config key, defined across your plugins return ['CakeDC/Auth.permissions' => $allPerms]; Then inside each plugin you could have: YOUR_PLUGIN/config/bootstrap.php $permissions = \Cake\Core\Configure::read('MyPermissions'); $permissions = array_merge((array)$permissions, $someMorePermissions); Allowing each plugin to dynamically inject/manage permissions into the app. I've created a c9.io environment with this code here https://ide.c9.io/steinkel/users-35-custom-permissions |
I tried to create a permissions.php file in the plugins/SharpAgent/config directory, however it wasn't loaded...
How can I add in my plugin bootstrap the following?
The text was updated successfully, but these errors were encountered: