Quote:
Are there any plans to support maps whose values are collections?
Probably not
First, in general, it is typically not good design to assign permissions or entitlements to a particualr user. Typically, users are aggregated into groups and the association is made on the group.
You'll notice I did not say I use "resources" as the basis for my entitlements; I use "use cases". A use case bundles a resource along with some particular action on that resource ("create company", for example).
But given your setup, I would do this with bitmasking and a Hibernate UserType to perform the bit decoding/encoding. When investigating Hibernate, we modelled part of an older system which had basically the same permission setup you describe (except permissions mapped to groups). The way I modelled that was to create a Permission class which defined bean attributes for all the defined permissions in the system ("create", "update", etc). In the database, this was all kept in a single column using bitmasking where a custom UserType mapped the integer value of the column to the appropriate Permission attribute values. The Group class then had a map of permissions keyed by a resource.
I see the allure of using a collection for this, but the bitmasking approach is far more efficient in terms of DB storage and JVM memory and resource usage. The UserType centralizes dealing with the bitmasking stuff leaving other parts of the system to simply deal with a Permission instance.
Quote:
...if you don't know ahead of time...
Its funny how often I hear this and how often I see systems with exactly four... A bitmask based on a java long will be enough I'd be willing to bet.