Add ability for super users to take ownership of namespaces
Fixes #1395
This commit is contained in:
parent
f75949d533
commit
20816804e5
14 changed files with 280 additions and 94 deletions
|
@ -223,6 +223,14 @@ angular.module('quay').directive('logsView', function () {
|
|||
'service_key_extend': 'Change of expiration of service key {kid} from {old_expiration_date} to {expiration_date}',
|
||||
'service_key_rotate': 'Automatic rotation of service key {kid} by {user_agent}',
|
||||
|
||||
'take_ownership': function(metadata) {
|
||||
if (metadata.was_user) {
|
||||
return 'Superuser {superuser} took ownership of user namespace {namespace}';
|
||||
} else {
|
||||
return 'Superuser {superuser} took ownership of organization {namespace}';
|
||||
}
|
||||
},
|
||||
|
||||
// Note: These are deprecated.
|
||||
'add_repo_webhook': 'Add webhook in repository {repo}',
|
||||
'delete_repo_webhook': 'Delete webhook in repository {repo}'
|
||||
|
@ -279,6 +287,7 @@ angular.module('quay').directive('logsView', function () {
|
|||
'service_key_delete': 'Delete Service Key',
|
||||
'service_key_extend': 'Extend Service Key Expiration',
|
||||
'service_key_rotate': 'Automatic rotation of Service Key',
|
||||
'take_ownership': 'Take Namespace Ownership',
|
||||
|
||||
// Note: these are deprecated.
|
||||
'add_repo_webhook': 'Add webhook',
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
})
|
||||
}]);
|
||||
|
||||
function SuperuserCtrl($scope, $timeout, ApiService, Features, UserService, ContainerService, AngularPollChannel, CoreDialog) {
|
||||
function SuperuserCtrl($scope, $timeout, $location, ApiService, Features, UserService, ContainerService, AngularPollChannel, CoreDialog) {
|
||||
if (!Features.SUPER_USERS) {
|
||||
return;
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
|||
$scope.dashboardActive = false;
|
||||
$scope.currentConfig = null;
|
||||
$scope.serviceKeysActive = false;
|
||||
$scope.takeOwnershipInfo = null;
|
||||
|
||||
$scope.setDashboardActive = function(active) {
|
||||
$scope.dashboardActive = active;
|
||||
|
@ -261,6 +262,25 @@
|
|||
});
|
||||
};
|
||||
|
||||
$scope.askTakeOwnership = function(entity, is_org) {
|
||||
$scope.takeOwnershipInfo = {
|
||||
'entity': entity,
|
||||
'is_org': is_org
|
||||
};
|
||||
};
|
||||
|
||||
$scope.takeOwnership = function(info, callback) {
|
||||
var errorDisplay = ApiService.errorDisplay('Could not take ownership of namespace', callback);
|
||||
var params = {
|
||||
'namespace': info.entity.username || info.entity.name
|
||||
};
|
||||
|
||||
ApiService.takeOwnership(null, params).then(function() {
|
||||
callback(true);
|
||||
$location.path('/organization/' + params.namespace);
|
||||
}, errorDisplay)
|
||||
};
|
||||
|
||||
$scope.askDisableUser = function(user) {
|
||||
var message = 'Are you sure you want to disable this user? ' +
|
||||
'They will be unable to login, pull or push.'
|
||||
|
|
Reference in a new issue