diff --git a/endpoints/api/discovery.py b/endpoints/api/discovery.py index a9faf9ae2..c688feb4e 100644 --- a/endpoints/api/discovery.py +++ b/endpoints/api/discovery.py @@ -65,6 +65,7 @@ def swagger_route_data(include_internal=False, compact=False): models = {} tags = [] tags_added = set() + operationIds = set() for rule in app.url_map.iter_rules(): endpoint_method = app.view_functions[rule.endpoint] @@ -125,13 +126,20 @@ def swagger_route_data(include_internal=False, compact=False): logger.debug('Unable to find method for %s in class %s', method_name, view_class) continue + operationId = method_metadata(method, 'nickname') operation_swagger = { - 'operationId': method_metadata(method, 'nickname'), + 'operationId': operationId, 'parameters': [], } - if operation_swagger['operationId'] is None: + + if operationId is None: continue + if operationId in operationIds: + raise Exception('Duplicate operation Id: %s' % operationId) + + operationIds.add(operationId) + if not compact: operation_swagger.update({ 'description': method.__doc__.strip() if method.__doc__ else '', 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/endpoints/api/team.py b/endpoints/api/team.py index 361337b84..d1ef774ac 100644 --- a/endpoints/api/team.py +++ b/endpoints/api/team.py @@ -361,7 +361,7 @@ class InviteTeamMember(ApiResource): @path_param('teamname', 'The name of the team') class TeamPermissions(ApiResource): """ Resource for listing the permissions an org's team has in the system. """ - @nickname('getTeamPermissions') + @nickname('getOrganizationTeamPermissions') def get(self, orgname, teamname): """ Returns the list of repository permissions for the org's team. """ permission = AdministerOrganizationPermission(orgname) diff --git a/static/js/services/roles-service.js b/static/js/services/roles-service.js index 89def37ab..b192e715d 100644 --- a/static/js/services/roles-service.js +++ b/static/js/services/roles-service.js @@ -80,7 +80,7 @@ angular.module('quay').factory('RolesService', ['UtilService', 'Restangular', 'A 'teamname': entityName }; - ApiService.getTeamPermissions(null, params).then(function(resp) { + ApiService.getOrganizationTeamPermissions(null, params).then(function(resp) { callback(resp.permissions); }, errorHandler); } else if (entityKind == 'robot') { 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();