Add ability for super users to take ownership of namespaces

Fixes #1395
This commit is contained in:
Joseph Schorr 2016-06-07 18:12:11 -04:00
parent f75949d533
commit 20816804e5
14 changed files with 280 additions and 94 deletions

View file

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