Add back in the ability to create users
This commit is contained in:
parent
4ca877c1d4
commit
cac19cac57
4 changed files with 91 additions and 3 deletions
|
@ -37,6 +37,7 @@ def get_services():
|
||||||
@show_if(features.SUPER_USERS)
|
@show_if(features.SUPER_USERS)
|
||||||
class SuperUserGetLogsForService(ApiResource):
|
class SuperUserGetLogsForService(ApiResource):
|
||||||
""" Resource for fetching the kinds of system logs in the system. """
|
""" Resource for fetching the kinds of system logs in the system. """
|
||||||
|
@require_fresh_login
|
||||||
@nickname('getSystemLogs')
|
@nickname('getSystemLogs')
|
||||||
def get(self, service):
|
def get(self, service):
|
||||||
""" Returns the logs for the specific service. """
|
""" Returns the logs for the specific service. """
|
||||||
|
@ -63,6 +64,7 @@ class SuperUserGetLogsForService(ApiResource):
|
||||||
@show_if(features.SUPER_USERS)
|
@show_if(features.SUPER_USERS)
|
||||||
class SuperUserSystemLogServices(ApiResource):
|
class SuperUserSystemLogServices(ApiResource):
|
||||||
""" Resource for fetching the kinds of system logs in the system. """
|
""" Resource for fetching the kinds of system logs in the system. """
|
||||||
|
@require_fresh_login
|
||||||
@nickname('listSystemLogServices')
|
@nickname('listSystemLogServices')
|
||||||
def get(self):
|
def get(self):
|
||||||
""" List the system logs for the current system. """
|
""" List the system logs for the current system. """
|
||||||
|
@ -80,6 +82,7 @@ class SuperUserSystemLogServices(ApiResource):
|
||||||
@show_if(features.SUPER_USERS)
|
@show_if(features.SUPER_USERS)
|
||||||
class SuperUserLogs(ApiResource):
|
class SuperUserLogs(ApiResource):
|
||||||
""" Resource for fetching all logs in the system. """
|
""" Resource for fetching all logs in the system. """
|
||||||
|
@require_fresh_login
|
||||||
@nickname('listAllLogs')
|
@nickname('listAllLogs')
|
||||||
@parse_args
|
@parse_args
|
||||||
@query_param('starttime', 'Earliest time from which to get logs. (%m/%d/%Y %Z)', type=str)
|
@query_param('starttime', 'Earliest time from which to get logs. (%m/%d/%Y %Z)', type=str)
|
||||||
|
|
|
@ -4414,6 +4414,16 @@ pre.command:before {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-row .labels {
|
||||||
|
float: right;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-row .labels .label {
|
||||||
|
text-transform: uppercase;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.form-change input {
|
.form-change input {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
|
|
|
@ -2820,7 +2820,7 @@ function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService,
|
||||||
|
|
||||||
$scope.logsCounter = 0;
|
$scope.logsCounter = 0;
|
||||||
$scope.newUser = {};
|
$scope.newUser = {};
|
||||||
$scope.createdUsers = [];
|
$scope.createdUser = null;
|
||||||
$scope.systemUsage = null;
|
$scope.systemUsage = null;
|
||||||
$scope.debugServices = null;
|
$scope.debugServices = null;
|
||||||
$scope.debugLogs = null;
|
$scope.debugLogs = null;
|
||||||
|
@ -2828,6 +2828,11 @@ function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService,
|
||||||
$scope.logsScrolled = false;
|
$scope.logsScrolled = false;
|
||||||
$scope.csrf_token = window.__token;
|
$scope.csrf_token = window.__token;
|
||||||
|
|
||||||
|
$scope.showCreateUser = function() {
|
||||||
|
$scope.createdUser = null;
|
||||||
|
$('#createUserModal').modal('show');
|
||||||
|
};
|
||||||
|
|
||||||
$scope.viewSystemLogs = function(service) {
|
$scope.viewSystemLogs = function(service) {
|
||||||
if ($scope.pollChannel) {
|
if ($scope.pollChannel) {
|
||||||
$scope.pollChannel.stop();
|
$scope.pollChannel.stop();
|
||||||
|
@ -2907,14 +2912,18 @@ function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService,
|
||||||
|
|
||||||
$scope.createUser = function() {
|
$scope.createUser = function() {
|
||||||
$scope.creatingUser = true;
|
$scope.creatingUser = true;
|
||||||
|
$scope.createdUser = null;
|
||||||
|
|
||||||
var errorHandler = ApiService.errorDisplay('Cannot create user', function() {
|
var errorHandler = ApiService.errorDisplay('Cannot create user', function() {
|
||||||
$scope.creatingUser = false;
|
$scope.creatingUser = false;
|
||||||
|
$('#createUserModal').modal('hide');
|
||||||
});
|
});
|
||||||
|
|
||||||
ApiService.createInstallUser($scope.newUser, null).then(function(resp) {
|
ApiService.createInstallUser($scope.newUser, null).then(function(resp) {
|
||||||
$scope.creatingUser = false;
|
$scope.creatingUser = false;
|
||||||
$scope.newUser = {};
|
$scope.newUser = {};
|
||||||
$scope.createdUsers.push(resp);
|
$scope.createdUser = resp;
|
||||||
|
$scope.loadUsers();
|
||||||
}, errorHandler)
|
}, errorHandler)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div class="page-content" quay-show="Features.SUPER_USERS && showInterface">
|
<div class="page-content" quay-show="Features.SUPER_USERS && showInterface">
|
||||||
<div class="cor-title">
|
<div class="cor-title">
|
||||||
<span class="cor-title-link"></span>
|
<span class="cor-title-link"></span>
|
||||||
<span class="cor-title-content">Enterprise Registry Setup</span>
|
<span class="cor-title-content">Enterprise Registry Management</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="cor-tab-panel">
|
<div class="cor-tab-panel">
|
||||||
|
@ -101,6 +101,10 @@
|
||||||
<div class="filter-input">
|
<div class="filter-input">
|
||||||
<input id="log-filter" class="form-control" placeholder="Filter Users" type="text" ng-model="search.$">
|
<input id="log-filter" class="form-control" placeholder="Filter Users" type="text" ng-model="search.$">
|
||||||
</div>
|
</div>
|
||||||
|
<button class="btn btn-primary" style="vertical-align: top; margin-left: 10px;"
|
||||||
|
ng-click="showCreateUser()">
|
||||||
|
<i class="fa fa-plus" style="margin-right: 6px;"></i>Create User
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
@ -117,6 +121,15 @@
|
||||||
<span class="avatar" hash="current_user.avatar" size="24"></span>
|
<span class="avatar" hash="current_user.avatar" size="24"></span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
<span class="labels">
|
||||||
|
<span class="label label-default" ng-if="user.username == current_user.username">
|
||||||
|
You
|
||||||
|
</span>
|
||||||
|
<span class="label label-primary"
|
||||||
|
ng-if="current_user.super_user">
|
||||||
|
Superuser
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
{{ current_user.username }}
|
{{ current_user.username }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -167,6 +180,59 @@
|
||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Modal message dialog -->
|
||||||
|
<div class="modal fade" id="createUserModal">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h4 class="modal-title">Create New User</h4>
|
||||||
|
</div>
|
||||||
|
<form name="createUserForm" ng-submit="createUser()">
|
||||||
|
<div class="modal-body" ng-show="createdUser">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<th>Username</th>
|
||||||
|
<th>E-mail address</th>
|
||||||
|
<th>Temporary Password</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tr class="user-row">
|
||||||
|
<td>{{ createdUser.username }}</td>
|
||||||
|
<td>{{ createdUser.email }}</td>
|
||||||
|
<td>{{ createdUser.password }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" ng-show="creatingUser">
|
||||||
|
<div class="quay-spinner"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" ng-show="!creatingUser && !createdUser">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Username</label>
|
||||||
|
<input class="form-control" type="text" ng-model="newUser.username" ng-pattern="/^[a-z0-9_]{4,30}$/" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Email address</label>
|
||||||
|
<input class="form-control" type="email" ng-model="newUser.email" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer" ng-show="createdUser">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer" ng-show="!creatingUser && !createdUser">
|
||||||
|
<button class="btn btn-primary" type="submit" ng-disabled="!createUserForm.$valid">
|
||||||
|
Create User
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div><!-- /.modal-dialog -->
|
||||||
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
<!-- Modal message dialog -->
|
<!-- Modal message dialog -->
|
||||||
<div class="modal fade" id="changePasswordModal">
|
<div class="modal fade" id="changePasswordModal">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
|
|
Reference in a new issue