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 {
|
else {
|
||||||
string cmd_output = ret["stdout"]:"";
|
string cmd_output = ret["stdout"]:"";
|
||||||
list<string> realmIdList = splitstring(cmd_output, "\n");
|
list<string> realmIdList = splitstring(cmd_output, "\n");
|
||||||
map<string, map> realms = $[];
|
list<map> realms = [];
|
||||||
|
|
||||||
// Read the information about each realm
|
// Read the information about each realm
|
||||||
foreach(string realmId, realmIdList, {
|
foreach(string realmId, realmIdList, {
|
||||||
@ -369,7 +369,7 @@ global boolean Read() {
|
|||||||
y2error("Missing auth.policy info for " + realmId);
|
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);
|
y2error("Failed to create " + iaRealmsFile);
|
||||||
|
|
||||||
// Add the real information to auth.policy and iaRealms.xml files
|
// Add the real information to auth.policy and iaRealms.xml files
|
||||||
map<string, map> realms = (map<string, map>) CasaAts::Settings["CONFIG_CASAATS_REALMS"]:$[];
|
list<map> realms = (list<map>) CasaAts::Settings["CONFIG_CASAATS_REALMS"]:[];
|
||||||
foreach (string key, map realm, realms, {
|
foreach (map realm, realms, {
|
||||||
// Pull the realm parameters into local variables
|
// Pull the realm parameters into local variables
|
||||||
string realmId = realm["REALM_ID"]:"";
|
string realmId = realm["REALM_ID"]:"";
|
||||||
boolean eDirType = realm["EDIR_TYPE"]:true;
|
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 max = 0;
|
||||||
integer items = 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 = [];
|
list<term> table_items = [];
|
||||||
boolean direct_access = CasaAts::Settings["CONFIG_CASAATS_DIRECT_ACCESS"]:false;
|
boolean direct_access = CasaAts::Settings["CONFIG_CASAATS_DIRECT_ACCESS"]:false;
|
||||||
boolean web_access = CasaAts::Settings["CONFIG_CASAATS_WEB_ACCESS"]:false;
|
boolean web_access = CasaAts::Settings["CONFIG_CASAATS_WEB_ACCESS"]:false;
|
||||||
integer reconfig_interval = CasaAts::Settings["CONFIG_CASAATS_RECONFIG_INTERVAL"]:60;
|
integer reconfig_interval = CasaAts::Settings["CONFIG_CASAATS_RECONFIG_INTERVAL"]:60;
|
||||||
|
|
||||||
// Read list of search roots already configured for this realm
|
// Read list of realms already configured
|
||||||
foreach (string key, map realm, realms, {
|
foreach (map realm, realms, {
|
||||||
term item = `item(`id(max));
|
term item = `item(`id(max));
|
||||||
item = add(item, realm["REALM_ID"]:"");
|
item = add(item, realm["REALM_ID"]:"");
|
||||||
table_items = add(table_items, item);
|
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;
|
term item = cur_item[0]:nil;
|
||||||
|
|
||||||
// Find the realm associated with this item
|
// Find the realm associated with this item
|
||||||
map realm = lookup(realms, item[1]:"", nil);
|
map realm = realms[cur]:nil;
|
||||||
if (realm == nil) continue;
|
if (realm == nil) continue;
|
||||||
|
|
||||||
y2milestone("Realm id : %1", realm["REALM_ID"]:"");
|
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);
|
map editedRealm = AuthRealmEditDialog(realm);
|
||||||
if (editedRealm == nil) continue;
|
if (editedRealm == nil) continue;
|
||||||
|
|
||||||
// Update the realm map and the table
|
// Update the realm list and the table
|
||||||
realms = remove(realms, realm["REALM_ID"]:"");
|
realms[cur] = editedRealm;
|
||||||
realms = add(realms, editedRealm["REALM_ID"]:"", editedRealm);
|
|
||||||
item[1] = editedRealm["REALM_ID"]:"";
|
item[1] = editedRealm["REALM_ID"]:"";
|
||||||
|
|
||||||
table_items = maplist(term e, table_items, {
|
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"]:"");
|
y2milestone("Realm id : %1", realm["REALM_ID"]:"");
|
||||||
|
|
||||||
// Add the realm to the realm map and the table
|
// Add the realm to the realm map and the table
|
||||||
realms = add(realms, realm["REALM_ID"]:"", realm);
|
realms = add(realms, realm);
|
||||||
term item = nil;
|
term item = nil;
|
||||||
item = `item(`id(max));
|
item = `item(`id(max));
|
||||||
item = add(item, realm["REALM_ID"]:"");
|
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;
|
return cur != e[0, 0]:nil;
|
||||||
});
|
});
|
||||||
|
|
||||||
term item = cur_item[0]:nil;
|
realms = remove(realms, cur);
|
||||||
map realm = lookup(realms, item[1]:"", nil);
|
|
||||||
if (realm == nil) continue;
|
|
||||||
realms = remove(realms, realm["REALM_ID"]:"");
|
|
||||||
|
|
||||||
UI::ChangeWidget(`id(`table), `Items, table_items);
|
UI::ChangeWidget(`id(`table), `Items, table_items);
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user