Added userHasPermission function and permission loading