Changed the structure used to hold realms from a map to a list in order
to avoid having the order in which the realms are entered altered.
This commit is contained in:
parent
af1d4dc18c
commit
33b820c1eb
@ -280,7 +280,7 @@ global boolean Read() {
|
||||
else {
|
||||
string cmd_output = ret["stdout"]:"";
|
||||
list<string> realmIdList = splitstring(cmd_output, "\n");
|
||||
map<string, map> realms = $[];
|
||||
list<map> realms = [];
|
||||
|
||||
// Read the information about each realm
|
||||
foreach(string realmId, realmIdList, {
|
||||
@ -369,7 +369,7 @@ global boolean Read() {
|
||||
y2error("Missing auth.policy info for " + realmId);
|
||||
}
|
||||
|
||||
realms[realmId] = realm;
|
||||
realms = add(realms, realm);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -637,8 +637,8 @@ global boolean Write() {
|
||||
y2error("Failed to create " + iaRealmsFile);
|
||||
|
||||
// Add the real information to auth.policy and iaRealms.xml files
|
||||
map<string, map> realms = (map<string, map>) CasaAts::Settings["CONFIG_CASAATS_REALMS"]:$[];
|
||||
foreach (string key, map realm, realms, {
|
||||
list<map> realms = (list<map>) CasaAts::Settings["CONFIG_CASAATS_REALMS"]:[];
|
||||
foreach (map realm, realms, {
|
||||
// Pull the realm parameters into local variables
|
||||
string realmId = realm["REALM_ID"]:"";
|
||||
boolean eDirType = realm["EDIR_TYPE"]:true;
|
||||
|
@ -736,14 +736,14 @@ zero means that the server only reads its configuration during start up.</p>
|
||||
|
||||
integer max = 0;
|
||||
integer items = 0;
|
||||
map<string, map> realms = (map<string, map>) CasaAts::Settings["CONFIG_CASAATS_REALMS"]:$[];
|
||||
list<map> realms = (list<map>) CasaAts::Settings["CONFIG_CASAATS_REALMS"]:[];
|
||||
list<term> table_items = [];
|
||||
boolean direct_access = CasaAts::Settings["CONFIG_CASAATS_DIRECT_ACCESS"]:false;
|
||||
boolean web_access = CasaAts::Settings["CONFIG_CASAATS_WEB_ACCESS"]:false;
|
||||
integer reconfig_interval = CasaAts::Settings["CONFIG_CASAATS_RECONFIG_INTERVAL"]:60;
|
||||
|
||||
// Read list of search roots already configured for this realm
|
||||
foreach (string key, map realm, realms, {
|
||||
// Read list of realms already configured
|
||||
foreach (map realm, realms, {
|
||||
term item = `item(`id(max));
|
||||
item = add(item, realm["REALM_ID"]:"");
|
||||
table_items = add(table_items, item);
|
||||
@ -855,7 +855,7 @@ zero means that the server only reads its configuration during start up.</p>
|
||||
term item = cur_item[0]:nil;
|
||||
|
||||
// Find the realm associated with this item
|
||||
map realm = lookup(realms, item[1]:"", nil);
|
||||
map realm = realms[cur]:nil;
|
||||
if (realm == nil) continue;
|
||||
|
||||
y2milestone("Realm id : %1", realm["REALM_ID"]:"");
|
||||
@ -863,9 +863,8 @@ zero means that the server only reads its configuration during start up.</p>
|
||||
map editedRealm = AuthRealmEditDialog(realm);
|
||||
if (editedRealm == nil) continue;
|
||||
|
||||
// Update the realm map and the table
|
||||
realms = remove(realms, realm["REALM_ID"]:"");
|
||||
realms = add(realms, editedRealm["REALM_ID"]:"", editedRealm);
|
||||
// Update the realm list and the table
|
||||
realms[cur] = editedRealm;
|
||||
item[1] = editedRealm["REALM_ID"]:"";
|
||||
|
||||
table_items = maplist(term e, table_items, {
|
||||
@ -886,7 +885,7 @@ zero means that the server only reads its configuration during start up.</p>
|
||||
y2milestone("Realm id : %1", realm["REALM_ID"]:"");
|
||||
|
||||
// Add the realm to the realm map and the table
|
||||
realms = add(realms, realm["REALM_ID"]:"", realm);
|
||||
realms = add(realms, realm);
|
||||
term item = nil;
|
||||
item = `item(`id(max));
|
||||
item = add(item, realm["REALM_ID"]:"");
|
||||
@ -909,10 +908,7 @@ zero means that the server only reads its configuration during start up.</p>
|
||||
return cur != e[0, 0]:nil;
|
||||
});
|
||||
|
||||
term item = cur_item[0]:nil;
|
||||
map realm = lookup(realms, item[1]:"", nil);
|
||||
if (realm == nil) continue;
|
||||
realms = remove(realms, realm["REALM_ID"]:"");
|
||||
realms = remove(realms, cur);
|
||||
|
||||
UI::ChangeWidget(`id(`table), `Items, table_items);
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user