LotusScript to Make a new web user able to log in immediately

1–2 minutes

read

Bill offered some advice yesterday about a problem I’ve been having with new user registrations for Defectr.

What was happening was that a new user would register, everything would work fine but it took up to 15 minutes for the new account to work. I thought I had tried all combinations of solution but am also running the Defectr registrations in a Directory Assistance NAB (ie not the primary NAB on the server) so assumed that that was the source of the problem. But Bill’s posting spurred me to have another quick look and it seems like I’ve got it fixed now.

All of the work I had been doing was around refreshing views in the NAB in which the users were being created, it never occurred to me to refresh the same views in the main NAB but when I did the new account worked straight away. I have no idea why this would be the case, any idea you admin types?

Anyway, this is the code I now run when a new user registers:

.lotusscript { font-family: sans-serif; font-size: 9pt; color: black; }
.ls-comment { color: green; }
.ls-quote { color: black; }
.ls-datatype { color: black; }
.ls-operator { color: blue; }
.ls-keyword { color: blue; }
.ls-statement { color: blue; }
.ls-function { color: blue; }
.ls-class { color: black; }
.ls-constant { color: purple; }

Option Public Option Declare Use "OpenLogFunctions" Use "slnnotesdll" Sub UpdateNAB On Error Goto Whoops Dim commander As New nnotesdll Dim sess As New NotesSession Dim strError As String Dim server As String Dim scommand As String Dim strResponse As String Server = sess.CurrentDatabase.Server sCommand = |load updall names.nsf -t "($ServerAccess)" -r| strResponse="" strError=commander.rConsole(Server,sCommand,strResponse) Sleep 1 sCommand = |load updall names.nsf -t "($Users)" -r| strResponse="" strError=commander.rConsole(Server,sCommand,strResponse) Sleep 1 sCommand = |dbcache flush| strResponse="" strError=commander.rConsole(Server,sCommand,strResponse) Sleep 1 sCommand = "Tell Adminp Process People" strResponse="" strError=commander.rConsole(Server,sCommand,strResponse) Sleep 1 sCommand = "Show nlcache reset" strResponse="" strError=commander.rConsole(Server,sCommand,strResponse) Exit Sub Whoops: Call LogError() gResponse = "ERROR: " + Error Exit Sub End Sub
This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.

Tags: Show-N-Tell Thursday

6 responses to “LotusScript to Make a new web user able to log in immediately”

  1. I have run into this issue also. It has to do with the name lookup cache that was introduced in R6 for performance reasons. Of course, this issue only affects users that are registered via the web, which is even more frustrating. I just wish that Lotus would have a sever command like “Tell server PickUpNewUsers” so we wouldn’t have to jury rig it. I have never tried refreshing the views, but the nlcache reset has always been my friend.

    Sean—

  2. Wow.. I usually just go for the refreshing the two views.. A dbcache refresh in the middle is going to really punish the server performance – especially if you’re registering lots of users…

    —* Bill

  3. I’m not doing hundreds a day so I’m not too worried and I’d rather have the thing working. But knowing that you know your stuff in this area I’ll try removing it to see what happens.

    Matt

  4. Using a standard addressbook, I’ve not had any problems creating new web users with these commands (or equivalent) Set nabFullNameView = NabDB.GetView(“($LDAPCN)”)Call nabFullNameView.RefreshSet nabServerAccessView = NabDB.GetView(“($ServerAccess)”)Call nabServerAccessView.RefreshSet nabUserAccessView = NabDB.GetView(“($Users)”)Call nabUserAccessView.RefreshThey then have imediate access.Once you have the users login information, you can actually populate the login box for them and log them in automatically.See http://www.dwightwilbanks.org/dwightwilbanks/blog.nsf/d6plinks/DWIS-6QKN9N“ rel=”nofollow”>http://www.dwightwilbanks.org/dwightwilbanks/blog.nsf/d6plinks/DWIS-6QKN9N as an exampleWhat I’m struggling with right now is, I’ve got existing users that are already logged in, I’m granting the new group access in a WQS and need the new privileges to take affect right away.This one really has me scratching my head, the server is caching the credenitals and nothign I have been able to do will force the server to re-cache consistantly.I’ve even tried bouncing the user to a new virtual host on the same server (with strange and inconstant results)Has anyone had any luck with group changes?

  5. Nice example Dwight, I may well “borrow” that myself.

    Have you tried the “show nlcache reset” command? That seems to be the most powerful of the commands to do with security caching.

    Matt

  6. Oh man, I just fixed this same problem in the OpenNTF registration db a couple months back. Pretty much used the same approach as Dwight, with the addition of logic for both the main and the directory assistance NAB. I also used the delayupdates = false line which may fix your issue Dwight. Here’s a snippet:

    ******************************************************************************************************Set dbNab = s.GetDatabase(db.Server, “internal\Other_Directory.nsf”)Set dbMainNab = s.GetDatabase(db.Server, “names.nsf”)…’OpenNTF uses two Directories, where the person docs are created in the DA directory’and the group maintenance occurs in the Main Directory (names.nsf)’we therefore need to make sure the appropriate views in both get updated immediatelydbNab.DelayUpdates = False dbMainNab.DelayUpdates = False ‘KP addd this line to ensure the group views are updated in main nab

    Dim nabFullNameView As NotesViewDim nabServerAccessView As NotesViewDim nabUserView As NotesViewDim MainnabFullNameView As NotesViewDim MainnabServerAccessView As NotesView

    Set nabFullNameView = dbNAB.GetView(“($LDAPCN)”)Set nabUserView = dbNAB.GetView(“($Users)”)Set nabServerAccessView = dbNAB.GetView(“($ServerAccess)”)Set MainnabFullNameView = dbMainNAB.GetView(“($VIMPeople)”)Set MainnabServerAccessView = dbMainNAB.GetView(“($ServerAccess)”)

    Call nabFullNameView.RefreshCall nabUserView .RefreshCall nabServerAccessView.RefreshCall MainnabFullNameView.RefreshCall MainnabServerAccessView.Refresh******************************************************************************************************

Leave a Reply

Discover more from Matt White

Subscribe now to keep reading and get access to the full archive.

Continue reading