CryoEnix
Regular
Hey guys, long time no speak - I've got a bit of an issue here, but I'm sure one of you will be able to help...
Lets say that I've got several applications with a number of permissions allowed for each, stored within a single long data type:
App A is worth 1
App B is worth 2
App C is worth 4
App D is worth 8
App E is worth 16
App F is worth 32
And so on, ad infinitum.
Now the problem is, say if I need to know if the user has an access code of 45, how can I calculate whether he has access to application C or not - I know there's an algorithm for it, I just can't put my finger on it...
Lets say that I've got several applications with a number of permissions allowed for each, stored within a single long data type:
App A is worth 1
App B is worth 2
App C is worth 4
App D is worth 8
App E is worth 16
App F is worth 32
And so on, ad infinitum.
Now the problem is, say if I need to know if the user has an access code of 45, how can I calculate whether he has access to application C or not - I know there's an algorithm for it, I just can't put my finger on it...