You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sm...@apache.org on 2022/02/26 17:07:48 UTC

[directory-fortress-core] branch controls created (now 9de78b4)

This is an automated email from the ASF dual-hosted git repository.

smckinney pushed a change to branch controls
in repository https://gitbox.apache.org/repos/asf/directory-fortress-core.git.


      at 9de78b4  + mod method to set ldap controls

This branch includes the following new commits:

     new 9de78b4  + mod method to set ldap controls

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[directory-fortress-core] 01/01: + mod method to set ldap controls

Posted by sm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

smckinney pushed a commit to branch controls
in repository https://gitbox.apache.org/repos/asf/directory-fortress-core.git

commit 9de78b477427437727f1f739db432b093ae6bcdd
Author: Shawn McKinney <sm...@symas.com>
AuthorDate: Sat Feb 26 11:07:42 2022 -0600

    + mod method to set ldap controls
---
 .../fortress/core/ldap/LdapDataProvider.java       | 26 ++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java b/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
index cb8802b..aa81c25 100644
--- a/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
@@ -326,6 +326,28 @@ public abstract class LdapDataProvider
     protected void modify( LdapConnection connection, String dn, List<Modification> mods,
         FortEntity entity, boolean setRelaxControl ) throws LdapException
     {
+        Control setControl = null;
+        if ( setRelaxControl )
+        {
+            setControl = new RelaxControlImpl();
+        }
+        modify( connection, dn, mods, entity, setControl );
+    }
+
+
+    /**
+     * Update exiting ldap entry to the directory.  Add audit context.
+     *
+     * @param connection handle to ldap connection.
+     * @param dn         contains distinguished node of entry.
+     * @param mods       contains data to modify.
+     * @param entity     contains audit context.
+     * @param setControl add specified control to the request
+     * @throws LdapException in the event system error occurs.
+     */
+    protected void modify( LdapConnection connection, String dn, List<Modification> mods,
+        FortEntity entity, Control setControl ) throws LdapException
+    {
         COUNTERS.incrementMod();
         audit( mods, entity );
         ModifyRequest modRequest = new ModifyRequestImpl();
@@ -334,9 +356,9 @@ public abstract class LdapDataProvider
         {
             modRequest.addModification( mod );
         }
-        if ( setRelaxControl )
+        if ( setControl != null )
         {
-            modRequest.addControl( new RelaxControlImpl() );
+            modRequest.addControl( setControl );
         }
         modRequest.setName( new Dn( dn ) );
         ModifyResponse response = connection.modify( modRequest );