Storing and assigning user rights within an application with an unknown number of plugins
Posted on 2007-07-28
I have an application that uses 0 or more plugins, but I need to assign user rights for access to various parts of the application and then iterate those rights to show or hide / enable or disable / modify menu and UI items appropriately. At the moment users can log in, but only have three levels: basic user, power user, administrator. Anyone with Administrator priveleges can access anything so that is easy enough and short circuits the need to deal with other checks.
All other users, though, may need to be allowed to access part of the system on a read only, read and write, or some other combination such as can add but cannot delete.
In trying to determine the best way to store and process this information I have considered a bitwise value, but that only provides 64 permissions and I have no way of knowing how many may be required.
Given that the application uses plugins the plugins need to store some sort of rule that determines who can do what which the host application can then impleent.
Can anybody give me some advice about implementing this type of structure?