Refactor user roles, resources and permissions