Gets the permitted actions for a user.
When AccessControlList is not modified after calling getPermission,
for each action returned by this method, checkPermission(user, groups, action) is true,
for other actions, checkPermission(user, groups, action) is false.
1. If the user is the owner, then return the permission in the owner entry;
2. Else if the user matches the name of one of the named user entries, then return the AND
result of the permission in this entry and the mask ;
3. Else if at least one of the groups is the owning group or matches the name of one of the
named group entries, then for the named group entries that match a member of groups, merge
the permissions in these entries and return the merged permission ANDed with the mask;
4. Otherwise, return the permission in the other entry.