Restructure for improved scope.
Move userHasRole function out of jenkinsDeploy.
Make unit tests pass.