/** * Update or create LDAP profile of an existing user profile with provided LDAP user informations. * * @param xwikiUserName the name of the XWiki user to update LDAP profile. * @param dn the dn to store in the LDAP profile. * @param uid the uid to store in the LDAP profile. * @throws XWikiException error when storing information in user profile. */ public void updateLDAPObject(String xwikiUserName, String dn, String uid) throws XWikiException { XWikiDocument userDocument = this.context.getWiki().getDocument(XWIKI_USER_SPACE + "." + xwikiUserName, this.context); boolean needsUpdate = updateLDAPObject(userDocument, dn, uid); if (needsUpdate) { this.context.getWiki().saveDocument(userDocument, "Update LDAP user profile", this.context); } }
LDAPProfileXClass ldapXClass = new LDAPProfileXClass(context); if (ldapXClass.updateLDAPObject(createdUserProfile, ldapDN, ldapUid)) { context.getWiki().saveDocument(createdUserProfile, "Created user profile from LDAP server", context);
needsUpdate |= ldaXClass.updateLDAPObject(userProfile, ldapDN, ldapUid);
/** * Update or create LDAP profile of an existing user profile with provided LDAP user informations. * * @param xwikiUserName the name of the XWiki user to update LDAP profile. * @param dn the dn to store in the LDAP profile. * @param uid the uid to store in the LDAP profile. * @throws XWikiException error when storing information in user profile. */ public void updateLDAPObject(String xwikiUserName, String dn, String uid) throws XWikiException { XWikiDocument userDocument = this.context.getWiki().getDocument(new LocalDocumentReference(XWIKI_USER_SPACE, xwikiUserName), this.context); boolean needsUpdate = updateLDAPObject(userDocument, dn, uid); if (needsUpdate) { this.context.getWiki().saveDocument(userDocument, "Update LDAP user profile", this.context); } }
if (ldapXClass.updateLDAPObject(createdUserProfile, ldapDN, ldapUid)) { context.getWiki().saveDocument(createdUserProfile, "Created user profile from LDAP server", context);
needsUpdate |= ldaXClass.updateLDAPObject(userProfile, ldapDN, ldapUid);