publik: prefer wcs from same entity as the user (#8780)
This commit is contained in:
parent
a6ce35785c
commit
da0c113336
|
@ -109,9 +109,18 @@ $(function() {
|
|||
$(data.services).each(function(auth_index, auth_element) {
|
||||
if (auth_element.slug !== element.slug) return;
|
||||
if (auth_element.roles.length == 0) return;
|
||||
element.preferred = (data.ou__uuid == auth_element.ou__uuid);
|
||||
services_to_consider.push(element);
|
||||
});
|
||||
});
|
||||
if (services_to_consider.length > 1) {
|
||||
/* if there are multiple wcs, reduce the list to those from
|
||||
* the same organizational unit as the user
|
||||
*/
|
||||
services_to_consider = services_to_consider.filter(
|
||||
function(element) { return element.preferred == true; }
|
||||
);
|
||||
}
|
||||
if (services_to_consider.length == 1) {
|
||||
/* only handle the case with a single service, for now */
|
||||
var element = services_to_consider[0];
|
||||
|
|
Loading…
Reference in New Issue