Refactor policies, services and templates to view repos from an external context (issue #2)