Stephane Baillargeon
2008-03-13 18:46:00 UTC
I'm using a 32bit integer (BitFill) enum to store the user rights.
Example:
enum EUserRights
{
eRIGHTS_NONE = 0x00000000, // No rights at all
eRIGHTS_CREATE = 0x00000001, // Create
eRIGHTS_MODIFY = 0x00000002, // Modify
eRIGHTS_DELETE = 0x00000004, // Delete
eRIGHTS_SEARCH = 0x00000008, // Search
eRIGHTS_USER = 0x00000010, // User
eRIGHTS_ROLE = 0x00000020, // Role
...
...
...
eRIGHTS_LOGIN = 0x08000000, // Login
eRIGHTS_HAVE_ALL_RIGHTS = 0xFFFFFFFF // All rights
};
The Tag property of TMenuItems are used to enable or disable (validate if user has rights to access). My problem is this. What happens if I need more than 32 enumerators to represent the rights? Can someone give me ideas? Do I need to use 64bit or 128bit? I imagine that Big operating systems such as Fedora Core & Windows have thousands of rights... Is my approach good?
Thank You!
Example:
enum EUserRights
{
eRIGHTS_NONE = 0x00000000, // No rights at all
eRIGHTS_CREATE = 0x00000001, // Create
eRIGHTS_MODIFY = 0x00000002, // Modify
eRIGHTS_DELETE = 0x00000004, // Delete
eRIGHTS_SEARCH = 0x00000008, // Search
eRIGHTS_USER = 0x00000010, // User
eRIGHTS_ROLE = 0x00000020, // Role
...
...
...
eRIGHTS_LOGIN = 0x08000000, // Login
eRIGHTS_HAVE_ALL_RIGHTS = 0xFFFFFFFF // All rights
};
The Tag property of TMenuItems are used to enable or disable (validate if user has rights to access). My problem is this. What happens if I need more than 32 enumerators to represent the rights? Can someone give me ideas? Do I need to use 64bit or 128bit? I imagine that Big operating systems such as Fedora Core & Windows have thousands of rights... Is my approach good?
Thank You!