Helo,
We use zimbra with samba so we deploy zimbra_posixaccount, but with 1000+ users (provisioned by an other code in php by soap) when we try to create new user, in the zimbra administration interface, the "next id" procedure fail and return always 1000. We think there is a trouble in this code :
/opt/zimbra/jetty/webapps/service/zimlet/zimbra_posixaccount/zimbra_posixaccount.
js Code:
ZaPosixAccount.getNextUid = function () {
var soapDoc = AjxSoapDoc.create("GetLDAPEntriesRequest", "urn:zimbraAdmin", null);
soapDoc.set("ldapSearchBase", zimbra_posixaccount.ldapSuffix);
soapDoc.set("query", "(objectClass=posixAccount)");
soapDoc.set("sortBy", ZaPosixAccount.A_uidNumber);
soapDoc.set("sortAscending", "false");
soapDoc.set("limit", "1");
var getPosixAccountsCommand = new ZmCsfeCommand();
var params = new Object();
params.soapDoc = soapDoc;
var nextId = !isNaN(zimbra_posixaccount.uidBase) ? parseInt(zimbra_posixaccount.uidBase) + 1 : 10001;
try {
var resp = getPosixAccountsCommand.invoke(params).Body.GetLDAPEntriesResponse.LDAPEntry[0];
if(resp) {
var acc = new ZaPosixAccount(new Object());;
acc.initFromJS(resp);
nextId = parseInt(acc.attrs[ZaPosixAccount.A_uidNumber])+1;
}
} catch (ex) {
//do nothing - fallback to default id for now, ideally should show a warning
}
return nextId;
} we think this code sort the result by alphanumerical order and not numerical order
Code:
var soapDoc = AjxSoapDoc.create("GetLDAPEntriesRequest", "urn:zimbraAdmin", null);
soapDoc.set("ldapSearchBase", zimbra_posixaccount.ldapSuffix);
soapDoc.set("query", "(objectClass=posixAccount)");
soapDoc.set("sortBy", ZaPosixAccount.A_uidNumber);
soapDoc.set("sortAscending", "false");
soapDoc.set("limit", "1"); so 999 is greater than 1xxx
and the next id returned by this code is 999+1 = 1000
I think it could be cool if we can specify the type of sort
Code:
soapDoc.set("sortType", "num"); or the sort function detect by them self the type of the column and switch to the right sort.
What did you think about that we find ?
Thank's for reading me
