Add access denied messages to the repo admin and repo build pages when applicable

This commit is contained in:
Joseph Schorr 2014-02-12 21:39:23 -05:00
parent dbb0dcface
commit 889d178336
3 changed files with 21 additions and 3 deletions

View file

@ -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';

View file

@ -1,5 +1,8 @@
<div class="container" ng-show="deleting"><div class="quay-spinner"></div></div>
<div class="resource-view" resource="repository" error-message="'No repository found'"></div>
<div class="container repo repo-admin" ng-show="accessDenied">
You do not have permission to view this page
</div>
<div class="container repo repo-admin" ng-show="repo && !deleting">
<div class="header row">
<a href="{{ '/repository/' + repo.namespace + '/' + repo.name }}" class="back"><i class="fa fa-chevron-left"></i></a>

View file

@ -1,5 +1,8 @@
<div class="resource-view" resource="repository" error-message="'No repository found'"></div>
<div class="container repo repo-build" ng-show="repo && !deleting">
<div class="container repo repo-build" ng-show="accessDenied">
You do not have permission to view this page
</div>
<div class="container repo repo-build" ng-show="repo">
<div class="header row">
<a href="{{ '/repository/' + repo.namespace + '/' + repo.name }}" class="back"><i class="fa fa-chevron-left"></i></a>
<h3>