Creating and Removing permissions as used in modules
Posted: Sat Oct 23, 2010 3:53 pm
Fellow module builders,
When preparing an upgrade for a module, I had the idea to look a bit deeper into the security settings of the module I'm working on.
Some permission settings should be added (no problem I would just prepare a CreatePermission line in the upgrade php).
I leave alone if I need to change at this moment.
However I found that if I earlier had prepared some, for me nice sounding, permission and I want to remove it (either via the upgrade or the removal of the complete module), I could without knowing it, remove the permission of another module as well.
Let's take as example that my module has templates. In the install program I've used 'Modify Templates' with CreatePermission. No problem probably, since a check will be done for earlier existance (I've not checked this). Next step that I take is to remove the unistall the module. This would have as one of the statements RemovePermission. Hmmm, well 'Modify Templates' would be removed as well. But wait a minute, this is also the setting for the designer group. Without checking up front I have removed a large part of the security.
Either the table permissions should be extended with the module name (as from GetName()) or every module builder needs to use a prefix or some unique code in the name of the permission.
Especially with the growing number of modules this might lead to problems for end users/implementors.
What do you think would be a good solution to this.
Duketown
When preparing an upgrade for a module, I had the idea to look a bit deeper into the security settings of the module I'm working on.
Some permission settings should be added (no problem I would just prepare a CreatePermission line in the upgrade php).
I leave alone if I need to change at this moment.
However I found that if I earlier had prepared some, for me nice sounding, permission and I want to remove it (either via the upgrade or the removal of the complete module), I could without knowing it, remove the permission of another module as well.
Let's take as example that my module has templates. In the install program I've used 'Modify Templates' with CreatePermission. No problem probably, since a check will be done for earlier existance (I've not checked this). Next step that I take is to remove the unistall the module. This would have as one of the statements RemovePermission. Hmmm, well 'Modify Templates' would be removed as well. But wait a minute, this is also the setting for the designer group. Without checking up front I have removed a large part of the security.
Either the table permissions should be extended with the module name (as from GetName()) or every module builder needs to use a prefix or some unique code in the name of the permission.
Especially with the growing number of modules this might lead to problems for end users/implementors.
What do you think would be a good solution to this.
Duketown