-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
enhancementNew feature or requestNew feature or request
Description
We would like to add another class to domino_java_tools to create a new Domino user. This should be similar to #10
I found an API to register a user: Registration/registerNewUser. We have previously used this API - here is the relevant snippet:
Database db=session.getCurrentDatabase();
View userView=db.getView("People");
...
//****************************check the short Name if already exist*****************************************
ViewEntryCollection vec = userView.getAllEntries();
ViewEntry tmpentry;
ViewEntry entry = vec.getFirstEntry();
Document tempDoc=null;
boolean ifHasShortName=false;
while (entry != null) {
System.out.println("Entry is at position " + entry.getPosition('.'));
tempDoc=entry.getDocument();
if( ShortName.equals(tempDoc.getItemValueString("ShortName"))){
ifHasShortName=true;
System.out.print(ShortName+":"+tempDoc.getItemValueString("ShortName"));
break;
};
tmpentry = vec.getNextEntry();
entry.recycle();
entry = tmpentry;
}
if(ifHasShortName==false){
System.out.print("No ShourtName repeat");
}else{
System.out.print("Have shortName repeat");
pw.println("<flag value=\"failed the user has register,shortName repeat,please check the shortName\" />");
pw.println("</executeFlag>");
return ;
}
//*********************************************************************
Registration reg = session.createRegistration();
//check if create an mail db
if(IfCreateMailDb.equals("")){
IfCreateMailDb="1";
}
if(IfCreateMailDb.equals("1")){
reg.setCreateMailDb(true);
}
if(IfCreateMailDb.equals("0")){
reg.setCreateMailDb(false);
}
reg.setRegistrationServer(ServerName);
//reg.setCreateMailDb(true);
reg.setCertifierIDFile("cert.id");
dt.adjustYear(10);
System.out.print("expirationDate:"+dt.toString());
reg.setExpiration(dt);
reg.setIDType(Registration.ID_HIERARCHICAL);
reg.setMinPasswordLength(5); // password strength
reg.setNorthAmerican(true);
if(OrgUnitName.length()!=0){
reg.setOrgUnit(OrgUnitName);
}
reg.setRegistrationLog("log.nsf");
reg.setUpdateAddressBook(true);
reg.setStoreIDInAddressBook(true);
reg.setShortName(ShortName);
reg.setSynchInternetPassword(true);
if (reg.registerNewUser(LastName, // last name
userIdFilePath, // file to be created
ServerName, // mail server
FirstName, // first name
"", // middle initial
certPassword, // certifier password
"", // location field
"", // comment field
mailFilePath, // mail file
"", // forwarding domain
UserPassword)) //user password
{
// success case
}
else {
// report error
}
Also note that we have created users with One-Touch Setup, but I'm not sure we can use this outside the registration process.
"registerUsers": {
"defaults": {
"saveIDToPersonDocument": {{ auto_register_users_save_id_to_person_doc | lower }},
"password": "{{ auto_register_users_password }}",
"enableFullTextIndex": {{ auto_register_users_enable_full_text_index | lower }},
"certificateExpirationMonths": {{ auto_register_users_cert_expiry_months | int }}
},
"users": [
{
"firstName": "{{ domino_dev_user_first_name }}",
"lastName": "{{ domino_dev_user_last_name }}",
"shortName": "{{ domino_dev_user_short_name }}",
"password": "{{ domino_dev_user_id_password }}",
"internetAddress": "{{ domino_dev_user_short_name }}@{{ settings.domain }}",
"mailFilePath": "mail/{{ domino_dev_user_short_name }}.nsf",
"enableFullTextIndex": {{ auto_register_users_enable_full_text_index | lower}},
"IDFilePath": "{{ domino_home_dir }}/ids/{{ domino_dev_user_id }}",
"certificateExpirationMonths": {{ auto_register_users_cert_expiry_months | int }}
}
]
},
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request