0

我正在使用 Confluence 4.2.5 (build 3284) 和 CAS SSO 连接到我的 LDAP 服务器,并且希望能够在用户更改密码时从 LDAP 服务器调用 synchroniseUserDirectories() 以便即时更改。

它现在的工作方式是用户必须等待 Confluence 运行它的定期 LDAP 同步,这可能会让他们感到不安。

我曾尝试使用 XML-RPC 接口调用 changeUserPassword()(作为管理员),但它不起作用。该操作引发异常“更改用户密码时出错...”。我认为这是因为用户是在 LDAP 中定义的,但我无法确定,因为异常消息并不清楚原因。

这是我希望能够使用的示例代码。它不起作用。

#!/usr/bin/env python
import xmlrpclib

url = 'https://docs.example.com'
admin_user = 'frobisher'
admin_pass = 'supersecretstuff'
username = 'bigbob'
new_password = 'bigbobsbigsecret'

server = xmlrpclib.ServerProxy(url + '/rpc/xmlrpc')
token = server.confluence2.login(admin_user, admin_pass)

# CITATION: https://developer.atlassian.com/display/CONFDEV/Remote+Confluence+Methods
# this doesn't exist but would be my preferred approach. 
# It raises a NoSuchMethodException exception.
server.confluence2.synchroniseUserDirectories(token)

# this throws a general exception, because of the LDAP? The message
# wasn't clear about the source of the problem.
#server.confluence2.changeUserPassword(token,
#                                      username,
#                                      password)

server.confluence2.logout(token)

有没有办法使用 SOAP 或 REST 来做到这一点?我担心 REST,因为它听起来仍然是一个原型。

如果这些方法都不起作用,考虑到这必须是从 LDAP 服务器到 Confluence 服务器的推送操作,是否可以使用简单的插件来完成?我没有编写插件的经验,但我偶尔会做一些 java 工作。

任何提示将不胜感激。

4

1 回答 1

0

最简洁的答案是不”。同步远程用户目录的能力在 Confluence 中没有作为远程操作公开。

长答案是“是”,您可以编写一个插件来做到这一点。如果您已经熟悉 java,那么最好的答案可能就是向您展示一些我编写的执行类似功能的源代码:https ://bitbucket.org/jaysee00/confluence-user-sync-api 这个插件为您提供 SOAP、XML-RPC 和 JSON-RPC 方法来强制将单个用户帐户从远程目录同步到 Confluence。

这可能适合您的目的,但我想可以编辑此插件的源代码并将其更改为同步整个目录。

于 2013-05-17T07:01:56.057 回答