Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SWITCHwayf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Guillaume Rousse
SWITCHwayf
Commits
27481749
Commit
27481749
authored
Sep 26, 2013
by
haemmer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Order of categories is now preserved
parent
23b21ef1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
26 deletions
+24
-26
functions.php
functions.php
+24
-26
No files found.
functions.php
View file @
27481749
...
...
@@ -868,34 +868,44 @@ function convertToShibDSStructure($IDProviders){
/******************************************************************************/
// Sorts the IDProviders array
function
sortIdentityProviders
(
&
$IDProviders
){
$sortedIDProviders
=
Array
();
$orderedCategories
=
Array
();
// Create array with categories and IdPs in categories
$unknownCategory
=
array
();
foreach
(
$IDProviders
as
$entityId
=>
$IDProvider
){
// Skip incomplete descriptions
if
(
!
is_array
(
$IDProvider
)
||
!
isset
(
$IDProvider
[
'Name'
])){
continue
;
}
// Add categories
if
(
$IDProvider
[
'Type'
]
==
'category'
){
$orderedCategories
[
$entityId
][
'data'
]
=
$IDProvider
;
}
}
// Add category 'unknown' if not present
if
(
!
isset
(
$orderedCategories
[
'unknown'
])){
$orderedCategories
[
'unknown'
][
'data'
]
=
array
(
'Name'
=>
'Unknown'
,
'Type'
=>
'category'
,
);
}
foreach
(
$IDProviders
as
$entityId
=>
$IDProvider
){
// Skip categories
if
(
$IDProvider
[
'Type'
]
==
'category'
){
continue
;
}
}
// Skip incomplete descriptions
if
(
!
is_array
(
$IDProvider
)
||
!
isset
(
$IDProvider
[
'Name'
])){
continue
;
}
// Sanitize category
if
(
!
isset
(
$IDProvider
[
'Type'
])){
$IDProvider
[
'Type'
]
=
'unknown'
;
}
if
(
$IDProvider
[
'Type'
]
==
'unknown'
){
$unknownCategory
[
$entityId
]
=
$IDProvider
;
}
else
{
$orderedCategories
[
$IDProvider
[
'Type'
]][
'IdPs'
][
$entityId
]
=
$IDProvider
;
}
// Add IdP
$orderedCategories
[
$IDProvider
[
'Type'
]][
'IdPs'
][
$entityId
]
=
$IDProvider
;
}
// Relocate all IdPs for which no category with a name was defined
...
...
@@ -914,23 +924,12 @@ function sortIdentityProviders(&$IDProviders){
unset
(
$orderedCategories
[
$category
]);
}
// Add category 'unknown' if not present
if
(
!
isset
(
$orderedCategories
[
'unknown'
])){
$orderedCategories
[
'unknown'
][
'data'
]
=
array
(
'Name'
=>
'Unknown'
,
'Type'
=>
'category'
,
);
}
// Push unknown category to the end
$orderedCategories
[
'unknown'
][
'IdPs'
]
=
$unknownCategory
;
// Recompose $IDProviders
$IDProviders
=
Array
();
foreach
(
$orderedCategories
as
$category
=>
$object
){
// Skip category if it contains no IdPs
if
(
count
(
$object
[
'IdPs'
])
<
1
){
if
(
!
isset
(
$object
[
'IdPs'
])
||
count
(
$object
[
'IdPs'
])
<
1
){
continue
;
}
...
...
@@ -945,7 +944,6 @@ function sortIdentityProviders(&$IDProviders){
$IDProviders
[
$entityId
]
=
$IDProvider
;
}
}
}
/******************************************************************************/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment