Merge pull request #1975 from thomasdarimont/issue/KEYCLOAK-2256
KEYCLOAK-2256 - Guarantee deterministic ordering for custom user attributes in admin console.
This commit is contained in:
commit
01c408ba68
2 changed files with 29 additions and 1 deletions
|
@ -2372,6 +2372,34 @@ module.filter('capitalize', function() {
|
|||
};
|
||||
});
|
||||
|
||||
/*
|
||||
* Guarantees a deterministic property iteration order.
|
||||
* See: http://www.2ality.com/2015/10/property-traversal-order-es6.html
|
||||
*/
|
||||
module.filter('toOrderedMapSortedByKey', function(){
|
||||
return function(input){
|
||||
|
||||
if(!input){
|
||||
return input;
|
||||
}
|
||||
|
||||
var keys = Object.keys(input);
|
||||
|
||||
if(keys.length <= 1){
|
||||
return input;
|
||||
}
|
||||
|
||||
keys.sort();
|
||||
|
||||
var result = {};
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
result[keys[i]] = input[keys[i]];
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
});
|
||||
|
||||
module.directive('kcSidebarResize', function ($window) {
|
||||
return function (scope, element) {
|
||||
function resize() {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="(key, value) in user.attributes">
|
||||
<tr ng-repeat="(key, value) in user.attributes | toOrderedMapSortedByKey">
|
||||
<td>{{key}}</td>
|
||||
<td><input ng-model="user.attributes[key]" class="form-control" type="text" name="{{key}}" id="attribute-{{key}}" /></td>
|
||||
<td class="kc-action-cell">
|
||||
|
|
Loading…
Reference in a new issue