From cac19cac579384cfc1a95d2d9ff4ef114df26e01 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 23 Dec 2014 14:25:04 -0500 Subject: [PATCH] Add back in the ability to create users --- endpoints/api/superuser.py | 3 ++ static/css/quay.css | 10 +++++ static/js/controllers.js | 13 ++++++- static/partials/super-user.html | 68 ++++++++++++++++++++++++++++++++- 4 files changed, 91 insertions(+), 3 deletions(-) diff --git a/endpoints/api/superuser.py b/endpoints/api/superuser.py index 8aee02f94..7e337c3b7 100644 --- a/endpoints/api/superuser.py +++ b/endpoints/api/superuser.py @@ -37,6 +37,7 @@ def get_services(): @show_if(features.SUPER_USERS) class SuperUserGetLogsForService(ApiResource): """ Resource for fetching the kinds of system logs in the system. """ + @require_fresh_login @nickname('getSystemLogs') def get(self, service): """ Returns the logs for the specific service. """ @@ -63,6 +64,7 @@ class SuperUserGetLogsForService(ApiResource): @show_if(features.SUPER_USERS) class SuperUserSystemLogServices(ApiResource): """ Resource for fetching the kinds of system logs in the system. """ + @require_fresh_login @nickname('listSystemLogServices') def get(self): """ List the system logs for the current system. """ @@ -80,6 +82,7 @@ class SuperUserSystemLogServices(ApiResource): @show_if(features.SUPER_USERS) class SuperUserLogs(ApiResource): """ Resource for fetching all logs in the system. """ + @require_fresh_login @nickname('listAllLogs') @parse_args @query_param('starttime', 'Earliest time from which to get logs. (%m/%d/%Y %Z)', type=str) diff --git a/static/css/quay.css b/static/css/quay.css index a21db2fbe..ac6d205fe 100644 --- a/static/css/quay.css +++ b/static/css/quay.css @@ -4414,6 +4414,16 @@ pre.command:before { text-transform: uppercase; } +.user-row .labels { + float: right; + white-space: nowrap; +} + +.user-row .labels .label { + text-transform: uppercase; + margin-right: 10px; +} + .form-change input { margin-top: 12px; margin-bottom: 12px; diff --git a/static/js/controllers.js b/static/js/controllers.js index 653ec376b..8f0818b7a 100644 --- a/static/js/controllers.js +++ b/static/js/controllers.js @@ -2820,7 +2820,7 @@ function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService, $scope.logsCounter = 0; $scope.newUser = {}; - $scope.createdUsers = []; + $scope.createdUser = null; $scope.systemUsage = null; $scope.debugServices = null; $scope.debugLogs = null; @@ -2828,6 +2828,11 @@ function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService, $scope.logsScrolled = false; $scope.csrf_token = window.__token; + $scope.showCreateUser = function() { + $scope.createdUser = null; + $('#createUserModal').modal('show'); + }; + $scope.viewSystemLogs = function(service) { if ($scope.pollChannel) { $scope.pollChannel.stop(); @@ -2907,14 +2912,18 @@ function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService, $scope.createUser = function() { $scope.creatingUser = true; + $scope.createdUser = null; + var errorHandler = ApiService.errorDisplay('Cannot create user', function() { $scope.creatingUser = false; + $('#createUserModal').modal('hide'); }); ApiService.createInstallUser($scope.newUser, null).then(function(resp) { $scope.creatingUser = false; $scope.newUser = {}; - $scope.createdUsers.push(resp); + $scope.createdUser = resp; + $scope.loadUsers(); }, errorHandler) }; diff --git a/static/partials/super-user.html b/static/partials/super-user.html index be66343ae..e7411a4a6 100644 --- a/static/partials/super-user.html +++ b/static/partials/super-user.html @@ -1,7 +1,7 @@
- Enterprise Registry Setup + Enterprise Registry Management
@@ -101,6 +101,10 @@
+
@@ -117,6 +121,15 @@
+ + + You + + + Superuser + + {{ current_user.username }} @@ -167,6 +180,59 @@ + + + +