Add entity groups
Fix permissions
Fix PermissionDirective
Merge pull request #1416 from erwinwinder/master

Entity groups and refactor
Merge remote-tracking branch 'upstream/master'