From 932fa562275661fe0a29d7455e25b15837d899ac Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 10 Nov 2016 15:28:20 -0500 Subject: [PATCH] Fix name collision between the two organization delete calls Fixes #2104 The collision was causing the frontend to try to call the *superuser* method (in local, where superuser is enabled), but on prod (where it isn't), it was calling the normal method, which takes a different parameter name --- endpoints/api/organization.py | 2 +- static/js/services/user-service.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/endpoints/api/organization.py b/endpoints/api/organization.py index 29585b3f1..3f9beb869 100644 --- a/endpoints/api/organization.py +++ b/endpoints/api/organization.py @@ -204,7 +204,7 @@ class Organization(ApiResource): @require_scope(scopes.ORG_ADMIN) @require_fresh_login - @nickname('deleteOrganization') + @nickname('deleteAdminedOrganization') def delete(self, orgname): """ Deletes the specified organization. """ permission = AdministerOrganizationPermission(orgname) diff --git a/static/js/services/user-service.js b/static/js/services/user-service.js index c64fdffa1..256605c14 100644 --- a/static/js/services/user-service.js +++ b/static/js/services/user-service.js @@ -181,6 +181,7 @@ function(ApiService, CookieService, $rootScope, Config, $location) { return; } + var errorDisplay = ApiService.errorDisplay('Could not delete namespace', callback); var deleteNamespaceItself = function() { info.progress = 1; info.progressMessage = 'Deleting namespace...'; @@ -194,10 +195,10 @@ function(ApiService, CookieService, $rootScope, Config, $location) { }, errorDisplay); } else { var delParams = { - 'name': info.organization.name + 'orgname': info.organization.name }; - ApiService.deleteOrganization(null, delParams).then(function(resp) { + ApiService.deleteAdminedOrganization(null, delParams).then(function(resp) { // Reload the user. userService.load(); callback(true); @@ -235,7 +236,6 @@ function(ApiService, CookieService, $rootScope, Config, $location) { 'public': false }; - var errorDisplay = ApiService.errorDisplay('Could not delete namespace', callback); ApiService.listRepos(null, params).then(function(resp) { repositories = resp['repositories']; deleteAllRepos();