Rules are easy for things like 'is admin' or role === 'Readers'
However, for group based security it's harder if not impossible.
I have a user and that user is a member of a set of groups
Then I have a document and that document is readable by anyone in its own set of groups.
Is this model possible? I don't think it is... If there were set theoretic code then this would be straight forward. Even loops. But now I don't think I can see if there's overlap.
One HACK could be via regex... I haven't tried this but I could compile one of the maps into a OR regexp and see if it matches