xpages使用登录名和电子邮件向names.nsf注册一个匿名用户

时间:2017-07-05 08:25:42

标签: xpages xpages-ssjs

案例:创建一个Web应用程序,通过服务器上的Name.nsf注册用户。

用户A

用户B

表示有2个数据库相关。

第一个数据库:匿名(web)允许通过数据库键入信息。

第二个数据库:Names.nsf

第一个带有"完整"的数据库访问用户必须允许以名称nsf创建用户或为用户创建电子邮件地址!

问题

我只需要在服务器视图($ VIMPeopleByLastName)中链接names.nsf并创建这些网络用户的文档吗?

3 个答案:

答案 0 :(得分:0)

查看有关目录服务的文档。听起来这就是所需的方法。

答案 1 :(得分:0)

自从我使用NAB(交换,到处交换)以来,一直都是这样。但是,如果我记得这很简单....以前,通过xpage,我让用户填写用户名和一些细节,然后当你提交时,调用一个关闭并在NAB中创建帐户的lotuScript代理?我相信它曾用于检查用户不存在,设置htttpPassword字段,更改日期到现在,用户名,公司,电子邮件地址等 - 代理可以使用有权写入NAB的用户的权限运行。然后它创建帐户,生成密码,并用于通过电子邮件发送用户随后可以设置自己密码的链接

答案 2 :(得分:0)

我找到了使用Notes代理来更新它的解决方案。我不确定xpages javascript写它的方式。下面是我使用NotesRegistration的脚本:RegisterNewUser

Option Public
Option Declare

Sub Initialize
'   this agent use on [register] button locate on [request form] xpages

Dim s As New NotesSession, db As NotesDatabase, a As NotesAgent
Dim doc As NotesDocument
Set db = s.Currentdatabase
Set a = s.Currentagent
Set doc = s.Documentcontext     '   uidoc 

Dim certid As String 'full path of cert id
Dim certpasswd As String
Dim OU As String
Dim lastname As String
Dim firstname As String
Dim middleinit As String
Dim usrIdpath As String
Dim mailsvr As String
Dim mailfile As String
Dim userpasswd As String
Dim internetpath As String

Dim depvw As NotesView, depdoc As NotesDocument
Set depvw = db.Getview("Department sort by dept")
Set depdoc = depvw.Getdocumentbykey(doc.Dept(0), True)
If Not depdoc Is Nothing Then
    certid = depdoc.IdPath(0)                                       '   full path of cert id
    certpasswd = depdoc.IdPassword(0)                               '   Cert id password(password)
    OU = depdoc.Dept(0)                                             '   Application (department to register)
    lastname= doc.SelectMail(0)                                     '   current document selected mail (person)
    firstname = ""      '                                            [din't used]
    middleinit = ""                                                 '   [din't used]
    usrIdpath = depdoc.DptIdStor(0) +doc.SelectMail(0)+ ".id"       '   user path
    mailsvr = depdoc.MailSvr(0)                                     '   mail svr
    mailfile = depdoc.MailLocation(0)+doc.SelectMail(0)             '   Mail\person
    userpasswd= depdoc.UserPassword(0)                              '   User password
    internetpath = doc.SelectMail(0)+depdoc.InternetPath(0)         '   mail address

End If

Dim reg As New NotesRegistration
Dim dt As Variant
dt = DateNumber(Year(Today)+1, Month(Today), Day(Today))

reg.RegistrationServer = mailsvr        '"CN=ServerOne/O=dev"
reg.CreateMailDb = True                 '
reg.CertifierIDFile = certid            '"C:\IBM\Domino\data\office.id"
reg.Expiration = dt
reg.IDType = ID_HIERARCHICAL
reg.MinPasswordLength = 1               ' password strength
reg.IsNorthAmerican = True
reg.OrgUnit = OU                        '"Application"
reg.RegistrationLog = "log.nsf"
reg.UpdateAddressBook = True
reg.StoreIDInAddressBook = True
reg.MailInternetAddress =  internetpath '"person@devsv1.pcs.com.my"


Call reg.RegisterNewUser(lastname, _    ' last name
usridpath, _                            '"C:\IBM\Domino\data\ +name+.id"    ' file to be created
mailsvr, _                              '"CN=ServerOne/O=dev"               ' mail server
firstname, _                            '                                   ' first name
middleInit, _                           '                                   ' middle initial
certpasswd, _                           '"office"                           ' certifier password
"", _                                   ' location field
"", _                                   ' comment field
mailfile, _                             '"mail\person.nsf"                 ' mail file
"", _                                   ' Forwarding domain
userpasswd, _                           '"password", _                   ' user password
NOTES_DESKTOP_CLIENT)                   ' user type


End Sub