change permissions from array to object according to entity definition