setAdministeredUser(oAam.createUser(sNickName, getPassword(), getFirstName(), getLastName(), oGrp));
String sUsrs = Users.top(oSes).getDocument().id();
DocumentIndexer oIdx = oSes.getDocumentIndexer();
SortableList<Document> oLst = (SortableList<Document>) oSes.getDms().query("User$email='"+getEmail()+"'");
if (!oLst.isEmpty()) {
Log.out.error("E-mail address "+getEmail()+" already belongs to another user");
throw new IllegalArgumentException("E-mail address "+getEmail()+" already belongs to another user");
}
Dms oDms = oSes.getDms();
Document oDoc = oDms.newDocument(oDms.getDocumentType("User"), oDms.getDocument(sUsrs));
oDoc.save("");
setDocument(oDoc);
AttributeMultiValue oUid = oDoc.attribute("user_id");
oUid.set(oDoc.id());
AttributeMultiValue oUuid = oDoc.attribute("user_uuid");
oUuid.set(sNickName);
AttributeMultiValue oAttr = oDoc.attribute("email");
oAttr.set(getEmail());
AttributeMultiValue oActv = oDoc.attribute("active");
oActv.set(getStringNull("active","1"));
AttributeMultiValue oSrvs = oDoc.attribute("allowed_services");
oSrvs.set(String.valueOf(CaptureService.INVOICES.toInt())+","+String.valueOf(CaptureService.BILLNOTES.toInt()));
AttributeMultiValue oPassw = oDoc.attribute("password");
oPassw.set(ACL.encript(getPassword(), ACL.PWD_DTIP_RC4_64));
AttributeMultiValue oApr = oDoc.attribute("can_approve");
oApr.set("1");
AttributeMultiValue oStl = oDoc.attribute("can_settle");
oStl.set("1");
AttributeMultiValue oPre = oDoc.attribute("can_premium");
oPre.set("1");
oDoc.save("");
oIdx.indexDocument(oDoc);
put("user_id", oDoc.id());
put("user_uuid", sNickName);
put("can_approve", "1");
put("can_settle", "1");