本文整理了Java中com.unboundid.ldap.sdk.LDAPConnection.modify()
方法的一些代码示例,展示了LDAPConnection.modify()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LDAPConnection.modify()
方法的具体详情如下:
包路径:com.unboundid.ldap.sdk.LDAPConnection
类名称:LDAPConnection
方法名:modify
[英]Processes the provided modify request.
[中]处理提供的修改请求。
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
/**
* Processes the provided modify request.
*
* @param modifyRequest The modify request to be processed. It must not be
* {@code null}.
*
* @return The result of processing the modify operation.
*
* @throws LDAPException If the server rejects the modify request, or if a
* problem is encountered while sending the request or
* reading the response.
*/
public LDAPResult modify(final ReadOnlyModifyRequest modifyRequest)
throws LDAPException
{
return modify((ModifyRequest) modifyRequest);
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Processes the provided modify request.
*
* @param modifyRequest The modify request to be processed. It must not be
* {@code null}.
*
* @return The result of processing the modify operation.
*
* @throws LDAPException If the server rejects the modify request, or if a
* problem is encountered while sending the request or
* reading the response.
*/
public LDAPResult modify(final ReadOnlyModifyRequest modifyRequest)
throws LDAPException
{
return modify((ModifyRequest) modifyRequest);
}
代码示例来源:origin: com.redhat.lightblue.ldap/lightblue-ldap-hystrix
@Override
protected LDAPResult run() throws Exception {
return getConnection().modify(dn, mods);
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Applies the provided set of modifications to the specified entry.
*
* @param dn The DN of the entry to modify. It must not be {@code null}.
* @param mods The set of modifications to apply to the target entry. It
* must not be {@code null} or empty. *
* @return The result of processing the modify operation.
*
* @throws LDAPException If the server rejects the modify request, or if a
* problem is encountered while sending the request or
* reading the response.
*/
public LDAPResult modify(final String dn, final Modification... mods)
throws LDAPException
{
ensureNotNull(dn, mods);
return modify(new ModifyRequest(dn, mods));
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
/**
* Applies the provided set of modifications to the specified entry.
*
* @param dn The DN of the entry to modify. It must not be {@code null}.
* @param mods The set of modifications to apply to the target entry. It
* must not be {@code null} or empty. *
* @return The result of processing the modify operation.
*
* @throws LDAPException If the server rejects the modify request, or if a
* problem is encountered while sending the request or
* reading the response.
*/
public LDAPResult modify(final String dn, final Modification... mods)
throws LDAPException
{
ensureNotNull(dn, mods);
return modify(new ModifyRequest(dn, mods));
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
/**
* Applies the provided modification to the specified entry.
*
* @param dn The DN of the entry to modify. It must not be {@code null}.
* @param mod The modification to apply to the target entry. It must not
* be {@code null}.
*
* @return The result of processing the modify operation.
*
* @throws LDAPException If the server rejects the modify request, or if a
* problem is encountered while sending the request or
* reading the response.
*/
public LDAPResult modify(final String dn, final Modification mod)
throws LDAPException
{
ensureNotNull(dn, mod);
return modify(new ModifyRequest(dn, mod));
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
/**
* Applies the provided set of modifications to the specified entry.
*
* @param dn The DN of the entry to modify. It must not be {@code null}.
* @param mods The set of modifications to apply to the target entry. It
* must not be {@code null} or empty.
*
* @return The result of processing the modify operation.
*
* @throws LDAPException If the server rejects the modify request, or if a
* problem is encountered while sending the request or
* reading the response.
*/
public LDAPResult modify(final String dn, final List<Modification> mods)
throws LDAPException
{
ensureNotNull(dn, mods);
return modify(new ModifyRequest(dn, mods));
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Applies the provided modification to the specified entry.
*
* @param dn The DN of the entry to modify. It must not be {@code null}.
* @param mod The modification to apply to the target entry. It must not
* be {@code null}.
*
* @return The result of processing the modify operation.
*
* @throws LDAPException If the server rejects the modify request, or if a
* problem is encountered while sending the request or
* reading the response.
*/
public LDAPResult modify(final String dn, final Modification mod)
throws LDAPException
{
ensureNotNull(dn, mod);
return modify(new ModifyRequest(dn, mod));
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Applies the provided set of modifications to the specified entry.
*
* @param dn The DN of the entry to modify. It must not be {@code null}.
* @param mods The set of modifications to apply to the target entry. It
* must not be {@code null} or empty.
*
* @return The result of processing the modify operation.
*
* @throws LDAPException If the server rejects the modify request, or if a
* problem is encountered while sending the request or
* reading the response.
*/
public LDAPResult modify(final String dn, final List<Modification> mods)
throws LDAPException
{
ensureNotNull(dn, mods);
return modify(new ModifyRequest(dn, mods));
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Processes a modify request from the provided LDIF representation of the
* changes.
*
* @param ldifModificationLines The lines that comprise an LDIF
* representation of a modify change record.
* It must not be {@code null} or empty.
*
* @return The result of processing the modify operation.
*
* @throws LDIFException If the provided set of lines cannot be parsed as an
* LDIF modify change record.
*
* @throws LDAPException If the server rejects the modify request, or if a
* problem is encountered while sending the request or
* reading the response.
*
*/
public LDAPResult modify(final String... ldifModificationLines)
throws LDIFException, LDAPException
{
ensureNotNull(ldifModificationLines);
return modify(new ModifyRequest(ldifModificationLines));
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
/**
* Processes a modify request from the provided LDIF representation of the
* changes.
*
* @param ldifModificationLines The lines that comprise an LDIF
* representation of a modify change record.
* It must not be {@code null} or empty.
*
* @return The result of processing the modify operation.
*
* @throws LDIFException If the provided set of lines cannot be parsed as an
* LDIF modify change record.
*
* @throws LDAPException If the server rejects the modify request, or if a
* problem is encountered while sending the request or
* reading the response.
*
*/
public LDAPResult modify(final String... ldifModificationLines)
throws LDIFException, LDAPException
{
ensureNotNull(ldifModificationLines);
return modify(new ModifyRequest(ldifModificationLines));
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
/**
* Submits a request to cancel the task with the specified task ID. Note that
* some tasks may not support being canceled. Further, for tasks that do
* support being canceled it may take time for the cancel request to be
* processed and for the task to actually be canceled.
*
* @param taskID The task ID of the task to be canceled.
* @param connection The connection to the Directory Server in which to
* perform the operation.
*
* @throws LDAPException If a problem occurs while communicating with the
* Directory Server.
*/
public static void cancelTask(final String taskID,
final LDAPConnection connection)
throws LDAPException
{
// Note: we should use the CANCELED_BEFORE_STARTING state when we want to
// cancel a task regardless of whether it's pending or running. If the
// task is running, the server will convert it to STOPPED_BY_ADMINISTRATOR.
final Modification mod =
new Modification(ModificationType.REPLACE, Task.ATTR_TASK_STATE,
TaskState.CANCELED_BEFORE_STARTING.getName());
connection.modify(getTaskDN(taskID), mod);
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
final LDAPResult result = conn.modify(modifyRequest);
releaseConnection(conn);
return result;
final LDAPResult result = newConn.modify(modifyRequest);
releaseConnection(newConn);
return result;
代码示例来源:origin: hlavki/g-suite-identity-sync
@Override
public void updateAccount(LdapAccount account) throws LdapSystemException {
try (LDAPConnection conn = ldapPool.getConnection()) {
String entryDN = getAccountDN(account.getSubject());
List<Modification> mods = new ArrayList<>();
if (account.getPassword() != null) {
mods.add(new Modification(REPLACE, "userPassword", account.getPassword()));
}
mods.add(new Modification(REPLACE, "givenName", account.getGivenName()));
mods.add(new Modification(REPLACE, "sn", account.getFamilyName()));
mods.add(new Modification(REPLACE, "cn", account.getName()));
mods.add(new Modification(REPLACE, "mail", account.getEmails().toArray(new String[0])));
conn.modify(new ModifyRequest(entryDN, mods));
} catch (LDAPException e) {
throw new LdapSystemException(e);
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-minimal-edition
final LDAPResult result = conn.modify(modifyRequest);
releaseConnection(conn);
return result;
final LDAPResult result = newConn.modify(modifyRequest);
releaseConnection(newConn);
return result;
代码示例来源:origin: hlavki/g-suite-identity-sync
@Override
public void removeGroupMember(String accountDN, String groupName) throws LdapSystemException {
try (LDAPConnection conn = ldapPool.getConnection()) {
LdapGroup group = getGroup(groupName, conn);
if (group == null || !group.getMembersDn().contains(accountDN)) {
log.info("Nothing to do. Account {} is not member of group {}", accountDN, groupName);
} else {
Modification mod = new Modification(DELETE, config.getLdapGroupsMemberAttr(), accountDN);
conn.modify(new ModifyRequest(group.getDn(), mod));
log.info("Remove membership {} from {}", accountDN, group.getName());
if (group.getMembersDn().size() == 1) {
log.info("Removing group {}", group.getName());
conn.delete(group.getDn());
}
}
} catch (LDAPException e) {
throw new LdapSystemException(e);
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
try
modifyResult = ldapConnection.modify(modifyRequest);
代码示例来源:origin: hlavki/g-suite-identity-sync
@Override
public void addGroupMember(String accountDN, String groupName) throws LdapSystemException {
try (LDAPConnection conn = ldapPool.getConnection()) {
LdapGroup group = getGroup(groupName, conn);
if (group != null && group.getMembersDn().contains(accountDN)) {
log.info("Nothing to do. Account {} is already member of group {}", accountDN, group.getName());
} else {
if (group == null) {
log.debug("Creating group {}", groupName);
DN groupDN = new DN(new RDN(GROUP_NAME_ATTR, groupName), new DN(config.getLdapGroupsBaseDN()));
Entry groupEntry = new Entry(groupDN);
groupEntry.addAttribute("objectClass", config.getLdapGroupsObjectClass());
groupEntry.addAttribute(config.getLdapGroupsMemberAttr(), accountDN);
conn.add(groupEntry);
log.info("Group {} added", groupDN);
} else {
Modification mod = new Modification(ADD, config.getLdapGroupsMemberAttr(), accountDN);
conn.modify(new ModifyRequest(group.getDn(), mod));
log.info("Added membership {} to {}", accountDN, group.getName());
}
}
} catch (LDAPException e) {
throw new LdapSystemException(e);
}
}
代码示例来源:origin: com.unboundid/unboundid-ldapsdk-commercial-edition
final LDAPResult result = conn.modify(modifyRequest);
setResponseControls(result);
代码示例来源:origin: hlavki/g-suite-identity-sync
@Override
public LdapGroup createOrUpdateGroup(LdapGroup group) throws LdapSystemException {
try (LDAPConnection conn = ldapPool.getConnection()) {
LdapGroup current = getGroup(group.getName(), conn);
if (current != null) {
Modification[] mods = new Modification[]{
new Modification(REPLACE, GROUP_DESC_ATTR, group.getDescription()),
new Modification(REPLACE, config.getLdapGroupsMemberAttr(), group.getMembersDn().toArray(new String[0]))
};
conn.modify(current.getDn(), mods);
current.setDescription(group.getDescription());
current.setMembersDn(group.getMembersDn());
} else {
String dn = getGroupDN(group.getName());
Entry entry = new Entry(dn);
entry.setAttribute(GROUP_NAME_ATTR, group.getName());
entry.setAttribute(GROUP_DESC_ATTR, group.getDescription());
entry.setAttribute(config.getLdapGroupsMemberAttr(), group.getMembersDn());
entry.setAttribute("objectClass", config.getLdapGroupsObjectClass());
conn.add(entry);
current = new LdapGroup(dn, group.getName(), group.getDescription(), group.getMembersDn());
}
return current;
} catch (LDAPException e) {
throw new LdapSystemException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!