Xpages SSJS创建管理过程 [英] Xpages SSJS Create Administration Process

查看:113
本文介绍了Xpages SSJS创建管理过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能使SSJS CreateAdministrationProcess正常工作吗?我已经搜索了正常运行的代码,但找不到任何代码.

Has anyone been able to get SSJS CreateAdministrationProcess to work? I have searched for functioning code but was not able to find any.

我正在尝试在SSJS中创建一个adminP请求来设置用户密码.我不能在url方法中使用?changepassword,因为我们不允许网络用户访问NAB.

I am trying to create an adminP request in SSJS to set a users password. I can't use the ?changepassword in the url method because we do not allow web users access to the NAB.

我正在使用OAUTH,当我尝试哈希并将密码直接更新到NAB时,没有管理员请求,这会在当前客户端会话中造成问题,将其注销,然后将其锁定.

I am using OAUTH and when I try to hash and update the password directly to the NAB it without an adminp request, it creates problems with the current client session, logging them out and then locking them out.

我认为这是因为我更改了服务器上而不是客户端上的凭据令牌,当它意识到这一点时,它认为我正在尝试一遍又一遍地进行身份验证并将我拒之门外.

I assume this is because I changed the credential tokens on the server but not on the client and when it realizes this it thinks I'm trying to authenticate over and over and locks me out.

如果我无法使SSJS工作,我将在Lotusscript代理中编写它,然后从SSJS调用该代理,但是出于后代的缘故,我想直接从JSJS获得AdminP请求.

If I can't get the SSJS to work I am going to write it in a lotusscript agent and call the agent from SSJS, but for posterity sake I wanted to get AdminP requests to work from SSJS directly.

这是我的代码:

var hashednew = session.hashPassword(thenewpw)
nabDoc.replaceItemValue("HTTPPassword",hashednew)
var dt:NotesDateTime = session.createDateTime("Today 12");
nabDoc.replaceItemValue("HTTPPasswordChangeDate",dt)
dt.recycle()
var nabServerAccessView:NotesView = nabDB.getView("($ServerAccess)")
nabDB.DelayUpdates = false;
var AdminP=sessionAsSigner.CreateAdministrationProcess("abcServerName/Co")
var AdminPNoteId=AdminP.SetUserPasswordSettings(@Name("[ABBREVIATE]" ,@UserName()), 0, 0, 0, True)
nabDoc.save(true,true)
nabServerAccessView.refresh()

它在行崩溃:

var AdminP=sessionAsSigner.CreateAdministrationProcess("abcServerName/Co")

,服务器错误为:

Error calling method 'CreateAdministrationProcess(string)' on an object of type 'lotus.domino.local.Session [Static Java Interface Wrapper, lotus.domino.local.Session: lotus.d

后续行动,

实际上,我发布的原始代码不仅仅包含大小写问题.我能够使它正常工作,但是我直接更新到NAB的方式是错误的.我找到了一种使用SSJS和以下代码段进行密码更改的更好方法,这很简单.当然,您必须首先验证旧密码和新密码的复杂性,但是一旦完成,就可以运行以下命令:

The original code I posted had more than the uppercase/lowercase issue, in practice. I was able to get it to work, but the way I was updating to the NAB directly was wrong. I found a better way to do the password change using SSJS with the following snippet, and it's pretty simple. Of course you have to validate the old password and complexity of the new password first, but once you've done that you can run the following:

try {
var AdminP=sessionAsSignerWithFullAccess.createAdministrationProcess(server)
var chgPW=AdminP.changeHTTPPassword(theuser,theoldpw,thenewpw)
} catch(e) {print("AdminProcess configure error: " + e)}

推荐答案

我认为问题在于命名约定-Java方法以小写字母开头.

In my opinion the problem is in naming convention - Java methods start with lower case letters.

var AdminP=sessionAsSigner.createAdministrationProcess("abcServerName/Co")
var AdminPNoteId=AdminP.setUserPasswordSettings(@Name("[ABBREVIATE]" ,@UserName()), 0, 0, 0, True)

这篇关于Xpages SSJS创建管理过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆