fix userIsInRole check when user is null and add test