About This Code
Brief Description:
UserRegistration Class
Contributor:
Davy Vanherbergen
Notes Version:
R5.x, R6.x
Last Modified:
10 Sep 2004
OpenNTF Disclaimer
All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.
Code / Description
The UserRegistration class allows you to register new users.
It is similar to the NotesRegistration class, but has extra functionality.
Supported properties (extra properties not available in the NotesRegistration class are marked with an X)
- firstName as string
- midInitial as string
- lastName as string
- shortName as string
- password as string
- passwordQuality as integer
- setInternetPassword as variant
- internetAddress as string
X mailSystem as string ('NOTES','NONE','VIM','CCMAIL')
X mailFileTemplate as string
- mailFilename as string
- mailServer as string
X mailFileAccesslevel as string ('MANAGER','DESIGNER','EDITOR')
- createMailFileNow as variant
X createMailFileUsingAdminP as variant
X createFTIndex as variant
X mailQuota as integer
X mailThreshold as integer
- isNorthAmerican as variant
- storeIDinNAB as variant
- storeIDinFile as variant
- idFile as string
X setupProfile as string
- uniqueOrgUnit as string
- location as string
X localAdmin as variant
- comment as string
- altLanguage as string
- AlternateName as string
- altOrgUnit as string
X createNABEntry as variant
X createIDFile as variant
X addToGroups as variant (array of groups to add user to)
Constructor
new(registrationServer As String, certifierID As String, certifierpwd As String , expirationDate As notesdatetime )
Methods
register(force as variant) 'if force=true, then existing nabentry is updated
setStringItem(itemname, itemvalue) 'adds an extra item to the person document
Usage / Example
Sub Click(Source As Button)
'calc expiry date
Dim expdate As New notesdatetime(Now)
Call expdate.adjustyear(2)
'init userregistration class
Dim userReg As UserRegistration
Set userReg = New UserRegistration("regserver", "c:\certfile.id","certpwd", expdate)
userReg.firstname = "Albert"
userReg.MidInitial = "R"
userReg.LastName = "Edison"
userReg.ShortName = "dude"
userReg.InternetAddress = "albert@science.com"
userReg.MailFileName = "mail\albert.nsf"
userReg.MailServer = "server1"
userReg.password = "secret"
userReg.passwordQuality = 4
userReg.mailFileTemplate = "StdR4Mail"
userReg.storeIDInFile = True
userReg.IDFile = "c:\albert.id"
userReg.localadmin = "LocalDomainAdmins"
userReg.location = "Heaven"
userReg.comment = " - - Registered via UserRegistration Class"
userReg.createIDFile = True
userReg.createNABEntry = True
userReg.createMailFileNow = False
userReg.createMailFileUsingAdminP = True
'set groups to add user to
Dim mygroups(1) As String
mygroups(0) = "All users"
mygroups(1) = "Special users"
userReg.addToGroups = mygroups
'set extra items to add to person document
Call userReg.setStringItem("CompanyName","Acme")
Call userReg.setStringItem("OfficePhoneNumber","555-123568")
'register
Call userReg.register(True)
End Sub
Code Attachments
Comments
Posted by Gino Matthys on 05/24/2005 04:43:24 AMNSD on function SECKFMGetCertifierCtx
Hi Davy,
Using your class with R6.5.3 results in a notes crash on the function SECKFMGetCertifierCtx.
Any idea where to look ?
Regards,
############################################################
### FATAL THREAD 1/9 [ NLNOTES:047c:0648]
### FP=0x0012e794, PC=0x60069ba6, SP=0x0012e794, stksize=0
### EAX=0x00000000, EBX=0x04e003e8, ECX=0x45443d4f, EDX=0x00000000
### ESI=0x45443d4f, EDI=0xffffffff, CS=0x0000001b, SS=0x00000023
### DS=0x00000023, ES=0x00000023, FS=0x0000003b, GS=0x00000000 Flags=0x00010246
Exception code: c0000005 (ACCESS_VIOLATION)
Posted by Weber Leou on 04/13/2006 08:44:31 PMHow to avoid promting for cert password input screen
Hi Davy,
We want to auto processing everything with scheduled agent, but it failed with ...
"error message: Could not create certifier context. - passwords error..."
Although this line has defined the cert password, but it still prompt for password input when running locally.
Set userReg = New UserRegistration("regserver", "c:\certfile.id","certpwd", expdate)
Is any other setting we are missing?
My server is R5.013.
Thank you for your excellent class!