KEYCLOAK-1427 Add remove user button to all user tabs

This commit is contained in:
Stian Thorgersen 2015-07-21 13:53:35 +02:00
parent f43e4200da
commit b04ac6cdba
8 changed files with 31 additions and 36 deletions

View file

@ -266,6 +266,21 @@ module.controller('UserListCtrl', function($scope, realm, User, UserImpersonatio
}); });
module.controller('UserTabCtrl', function($scope, $location, Dialog, Notifications, Current) {
$scope.removeUser = function() {
Dialog.confirmDelete($scope.user.id, 'user', function() {
$scope.user.$remove({
realm : Current.realm.realm,
userId : $scope.user.id
}, function() {
$location.url("/realms/" + Current.realm.realm + "/users");
Notifications.success("The user has been deleted.");
}, function() {
Notifications.error("User couldn't be deleted");
});
});
};
});
module.controller('UserDetailCtrl', function($scope, realm, user, User, UserFederationInstances, UserImpersonation, RequiredActions, $location, Dialog, Notifications) { module.controller('UserDetailCtrl', function($scope, realm, user, User, UserFederationInstances, UserImpersonation, RequiredActions, $location, Dialog, Notifications) {
$scope.realm = realm; $scope.realm = realm;
@ -396,20 +411,6 @@ module.controller('UserDetailCtrl', function($scope, realm, user, User, UserFede
$scope.cancel = function() { $scope.cancel = function() {
$location.url("/realms/" + realm.realm + "/users"); $location.url("/realms/" + realm.realm + "/users");
}; };
$scope.remove = function() {
Dialog.confirmDelete($scope.user.id, 'user', function() {
$scope.user.$remove({
realm : realm.realm,
userId : $scope.user.id
}, function() {
$location.url("/realms/" + realm.realm + "/users");
Notifications.success("The user has been deleted.");
}, function() {
Notifications.error("User couldn't be deleted");
});
});
};
}); });
module.controller('UserCredentialsCtrl', function($scope, realm, user, User, UserCredentials, Notifications, Dialog) { module.controller('UserCredentialsCtrl', function($scope, realm, user, User, UserCredentials, Notifications, Dialog) {

View file

@ -4,8 +4,6 @@
<li>{{user.username}}</li> <li>{{user.username}}</li>
</ol> </ol>
<h1>{{user.username|capitalize}}</h1>
<kc-tabs-user></kc-tabs-user> <kc-tabs-user></kc-tabs-user>
<form class="form-horizontal" name="realmForm" novalidate> <form class="form-horizontal" name="realmForm" novalidate>

View file

@ -4,8 +4,6 @@
<li>{{user.username}}</li> <li>{{user.username}}</li>
</ol> </ol>
<h1>{{user.username|capitalize}}</h1>
<kc-tabs-user></kc-tabs-user> <kc-tabs-user></kc-tabs-user>
<table class="table table-striped table-bordered"> <table class="table table-striped table-bordered">

View file

@ -4,8 +4,6 @@
<li>{{user.username}}</li> <li>{{user.username}}</li>
</ol> </ol>
<h1>{{user.username|capitalize}}</h1>
<kc-tabs-user></kc-tabs-user> <kc-tabs-user></kc-tabs-user>
<form class="form-horizontal" name="userForm" novalidate> <form class="form-horizontal" name="userForm" novalidate>

View file

@ -5,10 +5,6 @@
<li data-ng-show="create">Add User</li> <li data-ng-show="create">Add User</li>
</ol> </ol>
<h1 data-ng-hide="create">{{user.username|capitalize}}<i id="removeUser" class="pficon pficon-delete clickable" data-ng-show="!create && access.manageUsers && !changed"
data-ng-click="remove()"></i></h1>
<h1 data-ng-show="create">Add User</h1>
<kc-tabs-user></kc-tabs-user> <kc-tabs-user></kc-tabs-user>
<form class="form-horizontal" name="userForm" novalidate kc-read-only="!access.manageUsers"> <form class="form-horizontal" name="userForm" novalidate kc-read-only="!access.manageUsers">

View file

@ -4,8 +4,6 @@
<li>{{user.username}}</li> <li>{{user.username}}</li>
</ol> </ol>
<h1>{{user.username|capitalize}}</h1>
<kc-tabs-user></kc-tabs-user> <kc-tabs-user></kc-tabs-user>
<table class="table table-striped table-bordered"> <table class="table table-striped table-bordered">

View file

@ -4,8 +4,6 @@
<li>{{user.username}}</li> <li>{{user.username}}</li>
</ol> </ol>
<h1>{{user.username|capitalize}}</h1>
<kc-tabs-user></kc-tabs-user> <kc-tabs-user></kc-tabs-user>
<table class="table table-striped table-bordered"> <table class="table table-striped table-bordered">

View file

@ -1,8 +1,16 @@
<ul class="nav nav-tabs" data-ng-show="!create"> <div data-ng-controller="UserTabCtrl">
<li ng-class="{active: !path[4] && path[0] != 'create'}"><a href="#/realms/{{realm.realm}}/users/{{user.id}}">Attributes</a></li> <h1 data-ng-hide="create">
<li ng-class="{active: path[4] == 'user-credentials'}" data-ng-show="access.manageUsers"><a href="#/realms/{{realm.realm}}/users/{{user.id}}/user-credentials">Credentials</a></li> {{user.username|capitalize}}
<li ng-class="{active: path[4] == 'role-mappings'}" ><a href="#/realms/{{realm.realm}}/users/{{user.id}}/role-mappings">Role Mappings</a></li> <i id="removeUser" class="pficon pficon-delete clickable" data-ng-show="!create && access.manageUsers" data-ng-click="removeUser()"></i>
<li ng-class="{active: path[4] == 'consents'}"><a href="#/realms/{{realm.realm}}/users/{{user.id}}/consents">Consents</a></li> </h1>
<li ng-class="{active: path[4] == 'sessions'}" ><a href="#/realms/{{realm.realm}}/users/{{user.id}}/sessions">Sessions</a></li> <h1 data-ng-show="create">Add User</h1>
<li ng-class="{active: path[4] == 'federated-identity' || path[1] == 'federated-identity'}" data-ng-show="user.federatedIdentities != null"><a href="#/realms/{{realm.realm}}/users/{{user.id}}/federated-identity">Identity Provider Links</a></li>
</ul> <ul class="nav nav-tabs" data-ng-show="!create">
<li ng-class="{active: !path[4] && path[0] != 'create'}"><a href="#/realms/{{realm.realm}}/users/{{user.id}}">Attributes</a></li>
<li ng-class="{active: path[4] == 'user-credentials'}" data-ng-show="access.manageUsers"><a href="#/realms/{{realm.realm}}/users/{{user.id}}/user-credentials">Credentials</a></li>
<li ng-class="{active: path[4] == 'role-mappings'}" ><a href="#/realms/{{realm.realm}}/users/{{user.id}}/role-mappings">Role Mappings</a></li>
<li ng-class="{active: path[4] == 'consents'}"><a href="#/realms/{{realm.realm}}/users/{{user.id}}/consents">Consents</a></li>
<li ng-class="{active: path[4] == 'sessions'}" ><a href="#/realms/{{realm.realm}}/users/{{user.id}}/sessions">Sessions</a></li>
<li ng-class="{active: path[4] == 'federated-identity' || path[1] == 'federated-identity'}" data-ng-show="user.federatedIdentities != null"><a href="#/realms/{{realm.realm}}/users/{{user.id}}/federated-identity">Identity Provider Links</a></li>
</ul>
</div>