Refactoring code, using repository hash to find permissions file and not passing it as a parameter