Commit 76c06a68 authored by haemmer's avatar haemmer

Corrected a sorting issue and added a fix for the case where an IdP as a...

Corrected a sorting issue and added a fix for the case where an IdP as a category that is not defined
parent 85233aff
......@@ -889,12 +889,28 @@ function sortIdentityProviders(&$IDProviders){
}
if ($IDProvider['Type'] == 'unknown'){
$unknownCategory[] = $IDProvider;
$unknownCategory[$entityId] = $IDProvider;
} else {
$orderedCategories[$IDProvider['Type']]['IdPs'][$entityId] = $IDProvider;
}
}
// Relocate all IdPs for which no category with a name was defined
$toremoveCategories = array();
foreach ($orderedCategories as $category => $object){
if (!isset($object['data'])){
foreach ($object['IdPs'] as $entityId => $IDProvider){
$unknownCategory[$entityId] = $IDProvider;
}
$toremoveCategories[] = $category;
}
}
// Remove categories without descriptions
foreach ($toremoveCategories as $category){
unset($orderedCategories[$category]);
}
// Add category 'unknown' if not present
if (!isset($orderedCategories['unknown'])){
$orderedCategories['unknown']['data'] = array (
......@@ -925,8 +941,8 @@ function sortIdentityProviders(&$IDProviders){
foreach ($object['IdPs'] as $entityId => $IDProvider){
$IDProviders[$entityId] = $IDProvider;
}
}
}
/******************************************************************************/
......@@ -935,7 +951,7 @@ function sortUsingTypeIndexAndName($a, $b){
global $language;
if ($a['Type'] != $b['Type']){
return strcmp($b['Type'], $a['Type']);
return strcmp($a['Type'], $b['Type']);
} elseif (isset($a['Index']) && isset($b['Index']) && $a['Index'] != $b['Index']){
return strcmp($a['Index'], $b['Index']);
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment