Refactored to get the permissions from the roles.