commit
127ee40f23
7 changed files with 38 additions and 10 deletions
|
@ -278,6 +278,8 @@ function roleControl($scope, realm, role, roles, applications,
|
||||||
|
|
||||||
if (!role.id) return;
|
if (!role.id) return;
|
||||||
|
|
||||||
|
$scope.compositeSwitch = role.composite;
|
||||||
|
$scope.compositeSwitchDisabled = role.composite;
|
||||||
$scope.realmRoles = angular.copy(roles);
|
$scope.realmRoles = angular.copy(roles);
|
||||||
$scope.selectedRealmRoles = [];
|
$scope.selectedRealmRoles = [];
|
||||||
$scope.selectedRealmMappings = [];
|
$scope.selectedRealmMappings = [];
|
||||||
|
@ -316,6 +318,7 @@ function roleControl($scope, realm, role, roles, applications,
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.addRealmRole = function() {
|
$scope.addRealmRole = function() {
|
||||||
|
$scope.compositeSwitchDisabled=true;
|
||||||
$http.post('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
$http.post('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
||||||
$scope.selectedRealmRoles).success(function() {
|
$scope.selectedRealmRoles).success(function() {
|
||||||
for (var i = 0; i < $scope.selectedRealmRoles.length; i++) {
|
for (var i = 0; i < $scope.selectedRealmRoles.length; i++) {
|
||||||
|
@ -331,6 +334,7 @@ function roleControl($scope, realm, role, roles, applications,
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.deleteRealmRole = function() {
|
$scope.deleteRealmRole = function() {
|
||||||
|
$scope.compositeSwitchDisabled=true;
|
||||||
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
||||||
{data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
{data : $scope.selectedRealmMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
||||||
for (var i = 0; i < $scope.selectedRealmMappings.length; i++) {
|
for (var i = 0; i < $scope.selectedRealmMappings.length; i++) {
|
||||||
|
@ -346,6 +350,7 @@ function roleControl($scope, realm, role, roles, applications,
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.addApplicationRole = function() {
|
$scope.addApplicationRole = function() {
|
||||||
|
$scope.compositeSwitchDisabled=true;
|
||||||
$http.post('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
$http.post('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
||||||
$scope.selectedApplicationRoles).success(function() {
|
$scope.selectedApplicationRoles).success(function() {
|
||||||
for (var i = 0; i < $scope.selectedApplicationRoles.length; i++) {
|
for (var i = 0; i < $scope.selectedApplicationRoles.length; i++) {
|
||||||
|
@ -361,6 +366,7 @@ function roleControl($scope, realm, role, roles, applications,
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.deleteApplicationRole = function() {
|
$scope.deleteApplicationRole = function() {
|
||||||
|
$scope.compositeSwitchDisabled=true;
|
||||||
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
$http.delete('/auth/rest/admin/realms/' + realm.realm + '/roles-by-id/' + role.id + '/composites',
|
||||||
{data : $scope.selectedApplicationMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
{data : $scope.selectedApplicationMappings, headers : {"content-type" : "application/json"}}).success(function() {
|
||||||
for (var i = 0; i < $scope.selectedApplicationMappings.length; i++) {
|
for (var i = 0; i < $scope.selectedApplicationMappings.length; i++) {
|
||||||
|
|
|
@ -52,6 +52,10 @@
|
||||||
required> -->
|
required> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group clearfix block">
|
||||||
|
<label for="compositeSwitch" class="control-label">Composite Roles</label>
|
||||||
|
<input ng-model="compositeSwitch" name="compositeSwitch" id="compositeSwitch" ng-disabled="compositeSwitchDisabled" onoffswitch />
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<div class="form-actions" data-ng-show="create">
|
<div class="form-actions" data-ng-show="create">
|
||||||
<button type="submit" kc-save class="primary" data-ng-show="changed">Save
|
<button type="submit" kc-save class="primary" data-ng-show="changed">Save
|
||||||
|
@ -70,7 +74,7 @@
|
||||||
Delete
|
Delete
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<fieldset data-ng-show="!create">
|
<fieldset data-ng-show="!create && (compositeSwitch || role.composite)">
|
||||||
<legend collapsed><span class="text">Composite Realm Roles</span> </legend>
|
<legend collapsed><span class="text">Composite Realm Roles</span> </legend>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="controls changing-selectors">
|
<div class="controls changing-selectors">
|
||||||
|
@ -98,7 +102,7 @@
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset ng-show="applications.length > 0 && !create">
|
<fieldset ng-show="applications.length > 0 && !create && (compositeSwitch || role.composite)">
|
||||||
<legend collapsed><span class="text">Composite Application Roles</span> </legend>
|
<legend collapsed><span class="text">Composite Application Roles</span> </legend>
|
||||||
<div class="form-group input-select">
|
<div class="form-group input-select">
|
||||||
<label for="applications">Application</label>
|
<label for="applications">Application</label>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<caption data-ng-show="roles && roles.length > 0" class="hidden">Table of realm roles</caption>
|
<caption data-ng-show="roles && roles.length > 0" class="hidden">Table of realm roles</caption>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="rcue-table-actions" colspan="2">
|
<th class="rcue-table-actions" colspan="3">
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<a class="button" href="#/create/role/{{realm.realm}}/applications/{{application.name}}">Add Role</a>
|
<a class="button" href="#/create/role/{{realm.realm}}/applications/{{application.name}}">Add Role</a>
|
||||||
<!-- <button class="remove disabled">Remove</button> -->
|
<!-- <button class="remove disabled">Remove</button> -->
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr data-ng-show="roles && roles.length > 5">
|
<tr data-ng-show="roles && roles.length > 5">
|
||||||
<th class="rcue-table-actions" colspan="2">
|
<th class="rcue-table-actions" colspan="3">
|
||||||
<div class="search-comp clearfix">
|
<div class="search-comp clearfix">
|
||||||
<input type="text" placeholder="Search..." class="search">
|
<input type="text" placeholder="Search..." class="search">
|
||||||
<button class="icon-search" tooltip-placement="right"
|
<button class="icon-search" tooltip-placement="right"
|
||||||
|
@ -47,12 +47,13 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Role Name</th>
|
<th>Role Name</th>
|
||||||
|
<th>Composite</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tfoot data-ng-show="roles && roles.length > 5"> <!-- todo -->
|
<tfoot data-ng-show="roles && roles.length > 5"> <!-- todo -->
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="3">
|
||||||
<div class="table-nav">
|
<div class="table-nav">
|
||||||
<a href="#" class="first disabled">First page</a><a href="#" class="prev disabled">Previous
|
<a href="#" class="first disabled">First page</a><a href="#" class="prev disabled">Previous
|
||||||
page</a><span><strong>1-8</strong> of <strong>10</strong></span><a href="#"
|
page</a><span><strong>1-8</strong> of <strong>10</strong></span><a href="#"
|
||||||
|
@ -65,6 +66,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="role in roles">
|
<tr ng-repeat="role in roles">
|
||||||
<td><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles/{{role.name}}">{{role.name}}</a></td>
|
<td><a href="#/realms/{{realm.realm}}/applications/{{application.name}}/roles/{{role.name}}">{{role.name}}</a></td>
|
||||||
|
<td>{{role.composite}}</td>
|
||||||
<td>{{role.description}}</td>
|
<td>{{role.description}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -47,6 +47,10 @@
|
||||||
<textarea rows="5" cols="50" id="description" name="description" data-ng-model="role.description"></textarea>
|
<textarea rows="5" cols="50" id="description" name="description" data-ng-model="role.description"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group clearfix block">
|
||||||
|
<label for="compositeSwitch" class="control-label">Composite Roles</label>
|
||||||
|
<input ng-model="compositeSwitch" name="compositeSwitch" id="compositeSwitch" ng-disabled="compositeSwitchDisabled" onoffswitch />
|
||||||
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<div class="form-actions" data-ng-show="create">
|
<div class="form-actions" data-ng-show="create">
|
||||||
<button type="submit" kc-save class="primary" data-ng-show="changed">Save
|
<button type="submit" kc-save class="primary" data-ng-show="changed">Save
|
||||||
|
@ -66,7 +70,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<fieldset data-ng-show="!create">
|
<fieldset data-ng-show="!create && (compositeSwitch || role.composite)">
|
||||||
<legend collapsed><span class="text">Composite Realm Roles</span> </legend>
|
<legend collapsed><span class="text">Composite Realm Roles</span> </legend>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="controls changing-selectors">
|
<div class="controls changing-selectors">
|
||||||
|
@ -94,7 +98,7 @@
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset ng-show="applications.length > 0 && !create">
|
<fieldset ng-show="applications.length > 0 && !create && (compositeSwitch || role.composite)">
|
||||||
<legend collapsed><span class="text">Composite Application Roles</span> </legend>
|
<legend collapsed><span class="text">Composite Application Roles</span> </legend>
|
||||||
<div class="form-group input-select">
|
<div class="form-group input-select">
|
||||||
<label for="applications">Application</label>
|
<label for="applications">Application</label>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<table data-ng-hide="!roles || roles.length == 0">
|
<table data-ng-hide="!roles || roles.length == 0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="rcue-table-actions" colspan="2">
|
<th class="rcue-table-actions" colspan="3">
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<a class="button" href="#/create/role/{{realm.realm}}">Add Role</a>
|
<a class="button" href="#/create/role/{{realm.realm}}">Add Role</a>
|
||||||
<!-- <button class="remove disabled">Remove</button> -->
|
<!-- <button class="remove disabled">Remove</button> -->
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr data-ng-show="roles && roles.length > 5">
|
<tr data-ng-show="roles && roles.length > 5">
|
||||||
<th class="rcue-table-actions" colspan="2">
|
<th class="rcue-table-actions" colspan="3">
|
||||||
<div class="search-comp clearfix">
|
<div class="search-comp clearfix">
|
||||||
<input type="text" placeholder="Search..." class="search">
|
<input type="text" placeholder="Search..." class="search">
|
||||||
<button class="icon-search" tooltip-placement="right"
|
<button class="icon-search" tooltip-placement="right"
|
||||||
|
@ -47,12 +47,13 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Role Name</th>
|
<th>Role Name</th>
|
||||||
|
<th>Composite</th>
|
||||||
<th>Description</th>
|
<th>Description</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tfoot data-ng-show="roles && roles.length > 5"> <!-- todo -->
|
<tfoot data-ng-show="roles && roles.length > 5"> <!-- todo -->
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="3">
|
||||||
<div class="table-nav">
|
<div class="table-nav">
|
||||||
<a href="#" class="first disabled">First page</a><a href="#" class="prev disabled">Previous
|
<a href="#" class="first disabled">First page</a><a href="#" class="prev disabled">Previous
|
||||||
page</a><span><strong>1-8</strong> of <strong>10</strong></span><a href="#"
|
page</a><span><strong>1-8</strong> of <strong>10</strong></span><a href="#"
|
||||||
|
@ -65,6 +66,7 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="role in roles">
|
<tr ng-repeat="role in roles">
|
||||||
<td><a href="#/realms/{{realm.realm}}/roles/{{role.name}}">{{role.name}}</a></td>
|
<td><a href="#/realms/{{realm.realm}}/roles/{{role.name}}">{{role.name}}</a></td>
|
||||||
|
<td>{{role.composite}}</td>
|
||||||
<td>{{role.description}}</td>
|
<td>{{role.description}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -12,6 +12,7 @@ public class RoleRepresentation {
|
||||||
protected String id;
|
protected String id;
|
||||||
protected String name;
|
protected String name;
|
||||||
protected String description;
|
protected String description;
|
||||||
|
protected boolean composite;
|
||||||
protected Composites composites;
|
protected Composites composites;
|
||||||
|
|
||||||
public static class Composites {
|
public static class Composites {
|
||||||
|
@ -80,4 +81,12 @@ public class RoleRepresentation {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isComposite() {
|
||||||
|
return composite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComposite(boolean composite) {
|
||||||
|
this.composite = composite;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class ModelToRepresentation {
|
||||||
rep.setId(role.getId());
|
rep.setId(role.getId());
|
||||||
rep.setName(role.getName());
|
rep.setName(role.getName());
|
||||||
rep.setDescription(role.getDescription());
|
rep.setDescription(role.getDescription());
|
||||||
|
rep.setComposite(role.isComposite());
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue