KEYCLOAK-2424 Add delete role button to client role list

This commit is contained in:
Stian Thorgersen 2016-02-02 14:32:58 +01:00
parent 00e50111b1
commit 6c106dc681
2 changed files with 18 additions and 3 deletions

View file

@ -18,11 +18,23 @@ module.controller('ClientTabCtrl', function(Dialog, $scope, Current, Notificatio
};
});
module.controller('ClientRoleListCtrl', function($scope, $location, realm, client, roles) {
module.controller('ClientRoleListCtrl', function($scope, $location, realm, client, roles, $route, RoleById, Notifications, Dialog) {
$scope.realm = realm;
$scope.roles = roles;
$scope.client = client;
$scope.removeRole = function(role) {
Dialog.confirmDelete(role.name, 'role', function() {
RoleById.remove({
realm: realm.realm,
role: role.id
}, function () {
$route.reload();
Notifications.success("The role has been deleted.");
});
});
};
$scope.$watch(function() {
return $location.path();
}, function() {

View file

@ -10,7 +10,7 @@
<table class="table table-striped table-bordered">
<thead>
<tr>
<th class="kc-table-actions" colspan="4" data-ng-show="access.manageClients">
<th class="kc-table-actions" colspan="5" data-ng-show="access.manageClients">
<div class="pull-right">
<a class="btn btn-default" href="#/create/role/{{realm.realm}}/clients/{{client.id}}">{{:: 'add-role' | translate}}</a>
</div>
@ -20,7 +20,7 @@
<th>{{:: 'role-name' | translate}}</th>
<th>{{:: 'composite' | translate}}</th>
<th>{{:: 'description' | translate}}</th>
<th>{{:: 'actions' | translate}}</th>
<th colspan="2">{{:: 'actions' | translate}}</th>
</tr>
</thead>
<tbody>
@ -31,6 +31,9 @@
<td class="kc-action-cell">
<button class="btn btn-default btn-block btn-sm" kc-open="/realms/{{realm.realm}}/clients/{{client.id}}/roles/{{role.id}}">{{:: 'edit' | translate}}</button>
</td>
<td class="kc-action-cell">
<button class="btn btn-default btn-block btn-sm" data-ng-click="removeRole(role)">{{:: 'delete' | translate}}</button>
</td>
</tr>
<tr data-ng-show="!roles || roles.length == 0">
<td>{{:: 'no-client-roles-available' | translate}}</td>