0
我試圖在OpenIDM中開發自定義js端點,其中我更新了用我在腳本中生成的兩個屬性(otpexpiry
和otpvalue
)搜索的用戶。OpenIDM更新用戶屬性通過自定義端點
我openidm/conf/endpoint-otp.json
添加了一個JSON的conf鏈接:
{
"context" : "endpoint/otp/*",
"type" : "text/javascript",
"file" : "script/otp.js"
}
這是我的腳本openidm/script/otp.js
:
(function() {
if(request.method === "update") {
var five_minutes = 5 * 60 * 1000;
var timestamp = new Date().getTime();
var otpexpiry = timestamp + five_minutes;
var otpvalue = Math.floor(Math.random() * 9999);
/* Not sure of this code below I have to update the user searched with " otpdate : otpexpiry " and "otp : otpvalue "*/
var u = request.value;
var id = "managed/user/" + u._id;
if (id != null) {
openidm['update'](...);
}
return {
method: "update",
resourceName: request.resourcePath,
revision: request.revision,
parameters: request.additionalParameters,
patch: request.patchpperations,
context: context.current
};
} else {
throw { code: 500, message: "Unknown request type " + request.method};
}
})();
如何更新用戶的兩個變量找遍?