3
votes

I am looking to create an Xpage self registration site that registers users onto the Domino name and address book. I am just doing a proof of concept.

I will put the code below, but it is a fairly simple matter of capturing the user details, dropping their details and password into the NAB and then, hey presto the user should be able to immediately log into the app.nsf.

At the moment I am manually putting the user into a group that is listed in the ACL as manager on app.nsf (for testing, I am putting them in the group prior to creating the user - just mentioning it in case it is important).

It basically works, BUT, there is a rather large delay. As in, it takes many minutes and sometimes more. After some research I discovered the console command "show nlcache reset" and a lotusscript/java/javascript code version of it. But it seems to have no effect, either coded or manually from the console - (there is also no response from the console that the command has been initiated, just a new line, is this normal?).

The only quirky thing is that the OU=99123456789 (or something similar, it is a company identifier). So a user will look something like this Fred Citizen/99123456789/Domain (don't think this should matter). The user will however log in as "Fred Citizen" and password.

Any ideas?

We are running 9.0.1

Thanks in advance. Cheers Damien

Code Below:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

 <xp:this.data>
  <xp:dominoDocument var="userreg" databaseName="names.nsf"
  formName="Person">
  </xp:dominoDocument>
 </xp:this.data>

 <fieldset class="userreg">
  <label for="FirstName">First Name</label>
  <xp:inputText id="FirstName" value="#{userreg.FirstName}">
  </xp:inputText>
  <br />
  <label for="LastName">Last Name</label>
  <xp:inputText id="LastName" value="#{userreg.LastName}">
  </xp:inputText>
  <br />

  <label for="CompanyName">Company Name - ABN</label>
  <xp:inputText id="CompanyName" value="#{userreg.CompanyName}">
  </xp:inputText>
  <br />
  <label for="Level0_1">Service ID</label>
  <xp:inputText id="Level0_1" value="#{userreg.Level0_1}">
  </xp:inputText>
  <br />
  <label for="HTTPPassword">Password</label>
  <xp:inputText id="HTTPPassword" value="#{userreg.HTTPPassword}"
    password="true">
  </xp:inputText>
  <br />
  <label for="InternetAddress">Email Address</label>
  <xp:inputText id="InternetAddress" value="#{userreg.InternetAddress}">
  </xp:inputText>
  <br />

  <xp:text escape="true" id="type" value="#{userreg.type}"
  rendered="false">
  </xp:text>

  <xp:button value="Register" id="userreg_submit">
   <xp:eventHandler event="onclick" submit="true"
   refreshMode="complete">
    <xp:this.action>


        <xp:actionGroup>
            <xp:actionGroup>
                <xp:actionGroup>

                    <xp:modifyField name="type" value="Person">
                    </xp:modifyField>

                    <xp:modifyField name="FullName">
                        <xp:this.value><![CDATA[#{javascript:var fullNameArray = new Array();

var first = getComponent("FirstName").getValue();
var last = getComponent("LastName").getValue();
var abn = getComponent("CompanyName").getValue();
fullNameArray[0]= "CN=" + first + " " + last + "/OU=" + abn + "/O=RR1"; 
fullNameArray[1] = first + " " + last;

return fullNameArray;
}]]></xp:this.value>
                    </xp:modifyField>
                    <xp:saveDocument></xp:saveDocument>

                </xp:actionGroup>

            </xp:actionGroup>

        </xp:actionGroup>
    </xp:this.action>
   </xp:eventHandler>
  </xp:button>
  <xp:br></xp:br>
  <xp:br></xp:br></fieldset></xp:view>
2
Have you refreshed the $Users view in he NAB before sending the show nlcache reset command? - Sven Hasselbach
My thought: do not allow users to create any identity, they can make duplicates -> security backdoor. - Frantisek Kossuth
Frantisek is right: You should NOT allow anonymous users to create a person doc directly in the names.nsf. To be secure, they have to create a request in a different database, and an agent has to process the request in a names.nsf. - Sven Hasselbach
A show nlcache reset shouldn't be necessary: as Sven mentioned: do a refresh of the $Users view in the directory (and optionally the $Groups view). BTW: I don't agree with the two comments above on creating person docs directly, although you might want to add an activation step to the process (send link to email to require activation) and check for duplicate email addresses. I would also consider registering these users in (at least) a separate OU and optionally a secondary directory. - Mark Leusink
@user1539369 Damien, can you post that as the answer to your question, then you can 'accept' it as the answer and the upvotes will pour in. Welcome to StackOverflow! - David Navarre

2 Answers

2
votes

I had the same issue with my portal users registering and have been able to over come this with the following code. It's virtually instant. This code is in my register button after my bean creates the user in the nab and updates all the groups, acl etc....

sessionAsSigner.sendConsoleCommand( session.getServerName(), "lo updall yourNabDBName -t ($VIMGroups)" );

sessionAsSigner.sendConsoleCommand( session.getServerName(), "lo updall yourNabDBName -t ($Users)" );

sessionAsSigner.sendConsoleCommand( session.getServerName(), "lo updall yourNabDBName -t ($ServerAccess)" );

sessionAsSigner.sendConsoleCommand( session.getServerName(), "sh nl r" );

0
votes

For a lotuscript version of this you need to manually refresh a couple of views in the nab and then it worked.

Dim nabFullNameView As NotesView
Dim nabServerAccessView As NotesView
Dim nabUsersView As notesview 
Set nabUsersView = dbNAB.GetView("($Users)") 
Set nabFullNameView = dbNAB.GetView("($LDAPCN)")
Set nabServerAccessView = dbNAB.GetView("($ServerAccess)")

Call nabFullNameView.Refresh
Call nabServerAccessView.Refresh
Call nabUsersView.Refresh

'Closing session commits person document to NAB.
Call s.Close