PermissionService - About contexts and stuff

Ok,
I am trying to implement the whole PermissionService thing and i really don`t like how the contexts are represented:

public Map<Set<Context>,Map<String,Boolean>> getAllPermissions()

That’s a Map with a Set of Contexts as key for another Map as value with a String as key for a boolean as value… or something like this.

What speeches against something like:

public Map<Permission,Boolean> getAllPermissions()

public interface Permission {
    public String getIdentifier();
    public Set<Context> getContexts();
}

I’m sure i am missing something though… Are there any thoughts about this?

A lot of permissions operations are done based on context – so it makes sense to index by context when looking up permissions – the same way a lot of permissions plugins Bukkitside did a Map<String/World/, Map<String, Boolean>>.

That saves the issue of making permissions plugins create a PermissionAssignment implementation that every single permission assignment has to be wrapped with.

That makes sense, but doesn’t this or the whole SubjectData still take away a lot of freedom on the implementation?
E.g: if i want to store my permissions in an Mysql-table and manage them through a webinterface, i have to query everything out the table and order it into different maps based on the context.
And that misses the whole “meant to represent what’s ‘in the file’, rather than the higher-level query methods” thing, doesn’t it?

Edit: Also, if i call the “GetALLtheStuff” method, i am most likely not trying to get a permission, based on a context? Or why would there be a getPermissions(Set<Context>) method? :smiley: