Mapentity permissions refactor