Add superuser abilities: create user, show logs. Also fix the super users UI to show the user drop down and make all superuser API calls require fresh login
This commit is contained in:
parent
039d53ea6c
commit
d9c7e92637
6 changed files with 225 additions and 29 deletions
|
@ -1,4 +1,4 @@
|
|||
<div class="container" quay-show="Features.SUPER_USERS">
|
||||
<div class="container" quay-show="Features.SUPER_USERS && showInterface">
|
||||
<div class="alert alert-info">
|
||||
This panel provides administrator access to <strong>super users of this installation of the registry</strong>. Super users can be managed in the configuration for this installation.
|
||||
</div>
|
||||
|
@ -10,18 +10,64 @@
|
|||
<li class="active">
|
||||
<a href="javascript:void(0)" data-toggle="tab" data-target="#users" ng-click="loadUsers()">Users</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0)" data-toggle="tab" data-target="#create-user">Create User</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:void(0)" data-toggle="tab" data-target="#logs" ng-click="loadLogs()">System Logs</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="col-md-10">
|
||||
<div class="tab-content">
|
||||
<!-- Logs tab -->
|
||||
<div id="logs" class="tab-pane">
|
||||
<div class="logsView" makevisible="logsCounter" all-logs="true"></div>
|
||||
</div>
|
||||
|
||||
<!-- Create user tab -->
|
||||
<div id="create-user" class="tab-pane">
|
||||
<span class="quay-spinner" ng-show="creatingUser"></span>
|
||||
<form name="createUserForm" ng-submit="createUser()" ng-show="!creatingUser">
|
||||
<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>
|
||||
|
||||
<button class="btn btn-primary" type="submit" ng-disabled="!createUserForm.$valid">Create User</button>
|
||||
</form>
|
||||
|
||||
<div style="margin-top: 20px; padding-top: 20px; border-top: 1px solid #eee;" ng-show="createdUsers.length">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th>Username</th>
|
||||
<th>E-mail address</th>
|
||||
<th>Temporary Password</th>
|
||||
</thead>
|
||||
|
||||
<tr ng-repeat="created_user in createdUsers"
|
||||
class="user-row">
|
||||
<td>{{ created_user.username }}</td>
|
||||
<td>{{ created_user.email }}</td>
|
||||
<td>{{ created_user.password }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Users tab -->
|
||||
<div id="users" class="tab-pane active">
|
||||
<div class="quay-spinner" ng-show="!users"></div>
|
||||
<div class="alert alert-error" ng-show="usersError">
|
||||
{{ usersError }}
|
||||
</div>
|
||||
</div>
|
||||
<div ng-show="users">
|
||||
<div class="side-controls">
|
||||
<div class="result-count">
|
||||
|
@ -37,8 +83,7 @@
|
|||
<thead>
|
||||
<th>Username</th>
|
||||
<th>E-mail address</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th style="width: 24px;"></th>
|
||||
</thead>
|
||||
|
||||
<tr ng-repeat="current_user in (users | filter:search | orderBy:'username' | limitTo:100)"
|
||||
|
@ -51,19 +96,20 @@
|
|||
<td>
|
||||
<a href="mailto:{{ current_user.email }}">{{ current_user.email }}</a>
|
||||
</td>
|
||||
<td class="user-class">
|
||||
<span ng-if="current_user.super_user">Super user</span>
|
||||
</td>
|
||||
<td>
|
||||
<div class="dropdown" ng-if="user.username != current_user.username && !user.super_user">
|
||||
<td style="text-align: center;">
|
||||
<i class="fa fa-ge fa-lg" ng-if="current_user.super_user" data-title="Super User" bs-tooltip></i>
|
||||
<div class="dropdown" style="text-align: left;" ng-if="user.username != current_user.username && !current_user.super_user">
|
||||
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-ellipsis-h"></i>
|
||||
<i class="caret"></i>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<ul class="dropdown-menu pull-right">
|
||||
<li>
|
||||
<a href="javascript:void(0)" ng-click="showChangePassword(current_user)">
|
||||
<i class="fa fa-key"></i> Change Password
|
||||
</a>
|
||||
<a href="javascript:void(0)" ng-click="sendRecoveryEmail(current_user)" quay-show="Features.MAILING">
|
||||
<i class="fa fa-envelope"></i> Send Recovery Email
|
||||
</a>
|
||||
<a href="javascript:void(0)" ng-click="showDeleteUser(current_user)">
|
||||
<i class="fa fa-times"></i> Delete User
|
||||
</a>
|
||||
|
|
Reference in a new issue