add generic view permission control to repository