Liferay:通过SOAP webservices创建用户

时间:2015-07-21 13:37:40

标签: soap liferay liferay-6

我正在尝试使用远程SOAP调用在Liferay中创建一个新用户。 这就是我到目前为止所做的(时髦):

public UserSoap addUser(UserInfo ui, String password) {
    def companyPort = companyServiceLocator.getPortal_CompanyService(new URL(companyBaseUrl))
    def userPort = serviceLocator.getPortal_UserService(new URL(userBaseUrl))
    // FIXME: this should come from configuration as well
    def company = companyPort.getCompanyByVirtualHost('localhost')
    def sites = new WebsiteSoap[0]
    def sc = new ServiceContext()
    sc.indexingEnabled = true
    sc.assetEntryVisible = true
    sc.companyId = company.companyId
    def newUs = userPort.addUser(company.getCompanyId(), false, password, password, false, ui.username, ui.email, 0, null, 'IT', ui.name, null, ui.surname, 0, 0, true, 1, 1, 1970, '', new long[0], new long[0], new long[0], new long[0], new AddressSoap[0], new EmailAddressSoap[0], new PhoneSoap[0], sites, new AnnouncementsDeliverySoap[0], false, sc)
    userPort.updateStatus(newUs.userId, 0, sc)
    userPort.updateAgreedToTermsOfUse(newUs.userId, true)
    newUs
}

执行此操作时没有错误,用户可用但未与任何站点关联。我该怎么做?同样调用三种不同的服务来插入单个用户并不是最佳的。

0 个答案:

没有答案