Have the fetch tag dialog show a warning for robot accounts without access
Before this change, we'd show the squash pulling command with the proper credentials, but it then 403s on the end user.
This commit is contained in:
parent
7aeaf2344e
commit
b535e222b8
5 changed files with 108 additions and 2 deletions
|
@ -18,6 +18,7 @@ angular.module('quay').directive('fetchTagDialog', function () {
|
|||
$scope.currentEntity = null;
|
||||
$scope.currentRobot = null;
|
||||
$scope.formats = [];
|
||||
$scope.currentRobotHasPermission = null;
|
||||
|
||||
UserService.updateUserIn($scope, updateFormats);
|
||||
|
||||
|
@ -58,6 +59,7 @@ angular.module('quay').directive('fetchTagDialog', function () {
|
|||
}
|
||||
|
||||
$scope.currentRobot = null;
|
||||
$scope.currentRobotHasPermission = null;
|
||||
|
||||
var parts = entity.name.split('+');
|
||||
var namespace = parts[0];
|
||||
|
@ -71,6 +73,15 @@ angular.module('quay').directive('fetchTagDialog', function () {
|
|||
ApiService.getRobot(orgname, null, params).then(function(resp) {
|
||||
$scope.currentRobot = resp;
|
||||
}, ApiService.errorDisplay('Cannot download robot token'));
|
||||
|
||||
var permParams = {
|
||||
'repository': $scope.repository.namespace + '/' + $scope.repository.name,
|
||||
'username': entity.name
|
||||
};
|
||||
|
||||
ApiService.getUserTransitivePermission(null, permParams).then(function(resp) {
|
||||
$scope.currentRobotHasPermission = resp['permissions'].length > 0;
|
||||
});
|
||||
});
|
||||
|
||||
$scope.getCommand = function(format, robot) {
|
||||
|
@ -106,6 +117,7 @@ angular.module('quay').directive('fetchTagDialog', function () {
|
|||
$scope.currentFormat = null;
|
||||
$scope.currentEntity = null;
|
||||
$scope.currentRobot = null;
|
||||
$scope.currentRobotHasPermission = null;
|
||||
|
||||
$scope.clearCounter++;
|
||||
|
||||
|
|
Reference in a new issue