diff --git a/static/js/controllers.js b/static/js/controllers.js index 1dbade8eb..ad452a7ea 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -778,8 +778,16 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope var params = {'repository': namespace + '/' + name}; $rootScope.title = 'Loading Repository...'; $scope.repository = ApiService.getRepoAsResource(params).get(function(repo) { + if (!repo.can_write) { + $rootScope.title = 'Unknown builds'; + $scope.accessDenied = true; + return; + } + $rootScope.title = 'Repository Builds'; $scope.repo = repo; + + getBuildInfo(); }); }; @@ -800,7 +808,6 @@ function RepoBuildCtrl($scope, Restangular, ApiService, $routeParams, $rootScope }; fetchRepository(); - getBuildInfo(); } function RepoAdminCtrl($scope, Restangular, ApiService, $routeParams, $rootScope) { @@ -1053,8 +1060,13 @@ function RepoAdminCtrl($scope, Restangular, ApiService, $routeParams, $rootScope }; $scope.repository = ApiService.getRepoAsResource(params).get(function(repo) { - $scope.repo = repo; + if (!repo.can_admin) { + $rootScope.title = 'Forbidden'; + $scope.accessDenied = true; + return; + } + $scope.repo = repo; $rootScope.title = 'Settings - ' + namespace + '/' + name; $rootScope.description = 'Administrator settings for ' + namespace + '/' + name + ': Permissions, webhooks and other settings'; diff --git a/static/partials/repo-admin.html b/static/partials/repo-admin.html index 5c1b90393..e241360cf 100644 --- a/static/partials/repo-admin.html +++ b/static/partials/repo-admin.html @@ -1,5 +1,8 @@