So the app we are writing has certain privileges a user can have, and at first we just made a simple bitmask and saved each privilege as a separate bit and stored the final value into our DB table as a long. But now we have so many permissions that the value won't fit as a long in the database anymore. I suppose we could store it as a string rather than a long and do a conversion, but it makes me wonder if this is the best way to approach the problem.
ex: user has permission 1-3-5-7
his security value is 2^0 + 2^2 + 2^4 + 2^7 = 149
but once I have 100 permissions this approach seems a bit messy, as calculating 2^99 seems expensive and hard to look at in a DB table (that would have to be stored as a string since it's bigger than a long). So does anyone have a different approach to solving this problem when the number of permissions gets very large that works quickly and is not too complicated?