Merge pull request #660 from coreos-inc/superuser

Superuser Panel Improvements
This commit is contained in:
josephschorr 2015-10-30 14:32:16 -04:00
commit 4ae940aede
3 changed files with 80 additions and 5 deletions

View file

@ -160,6 +160,31 @@
}, errorHandler)
};
$scope.setSuperuser = function(user, status) {
var setSuperuser = function() {
var params = {
'username': user.username
};
var data = {
'superuser': status
};
ApiService.changeInstallUser(data, params).then(function(resp) {
$scope.requiresRestart = true;
}, ApiService.errorDisplay('Could not change user'));
};
var msg = 'Note: This change, once applied, will require your installation ' +
'to be restarted to take effect';
bootbox.confirm(msg, function(status) {
if (status) {
setSuperuser();
}
});
};
$scope.showDeleteUser = function(user) {
if (user.username == UserService.currentUser().username) {
bootbox.dialog({

View file

@ -106,6 +106,7 @@
<thead>
<td style="width: 24px;"></td>
<td>Name</td>
<td>Admin E-mail</td>
<td style="width: 24px;"></td>
</thead>
@ -117,6 +118,9 @@
<td>
{{ current_org.name }}
</td>
<td>
<a href="mailto:{{ current_org.email }}">{{ current_org.email }}</a>
</td>
<td style="text-align: center;">
<span class="cor-options-menu">
<span class="cor-option" option-click="askRenameOrganization(current_org)">
@ -140,9 +144,13 @@
</div>
<div ng-show="users">
<div class="manager-header" header-title="Users">
<button class="create-button btn btn-primary" ng-click="showCreateUser()">
<button class="create-button btn btn-primary" ng-click="showCreateUser()"
quay-show="Config.AUTHENTICATION_TYPE == 'Database'">
<i class="fa fa-plus" style="margin-right: 6px;"></i>Create User
</button>
<span class="co-alert co-alert-info" quay-show="Config.AUTHENTICATION_TYPE != 'Database'">
Note: <span class="registry-name"></span> is configured to use external authentication, so users can only be created in that system
</span>
</div>
<div class="filter-box" collection="users" filter-model="search" filter-name="Users"></div>
@ -177,14 +185,27 @@
<td style="text-align: center;">
<span class="cor-options-menu"
ng-if="user.username != current_user.username && !current_user.super_user">
<span class="cor-option" option-click="showChangeEmail(current_user)">
<span class="cor-option" option-click="setSuperuser(current_user, true)"
quay-show="!current_user.super_user">
<i class="fa">&Omega;</i>
Make Superuser
</span>
<span class="cor-option" option-click="setSuperuser(current_user, false)"
quay-show="current_user.super_user">
<i class="fa">&omega;</i>
Remove Superuser
</span>
<span class="cor-option" option-click="showChangeEmail(current_user)"
quay-show="Config.AUTHENTICATION_TYPE == 'Database'">
<i class="fa fa-envelope-o"></i> Change E-mail Address
</span>
<span class="cor-option" option-click="showChangePassword(current_user)">
<span class="cor-option" option-click="showChangePassword(current_user)"
quay-show="Config.AUTHENTICATION_TYPE == 'Database'">
<i class="fa fa-key"></i> Change Password
</span>
<span class="cor-option" option-click="sendRecoveryEmail(current_user)"
quay-show="Features.MAILING">
quay-show="Features.MAILING && Config.AUTHENTICATION_TYPE == 'Database'">
<i class="fa fa-envelope"></i> Send Recovery E-mail
</span>
<span class="cor-option" option-click="showDeleteUser(current_user)">