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 2019/04/19 19:31:42 UTC

[directory-fortress-core] branch master updated: FC-267 - cleanup the autoincrement of ids

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

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


The following commit(s) were added to refs/heads/master by this push:
     new f7a2377  FC-267 - cleanup the autoincrement of ids
f7a2377 is described below

commit f7a237719be798522d34aedc98f865d750ecd2bc
Author: Shawn McKinney <sm...@apache.org>
AuthorDate: Fri Apr 19 14:31:37 2019 -0500

    FC-267 - cleanup the autoincrement of ids
---
 .../apache/directory/fortress/core/ConfigMgr.java  | 15 +++-
 .../directory/fortress/core/impl/ConfigDAO.java    | 45 +++++++++-
 .../fortress/core/impl/ConfigMgrImpl.java          |  9 ++
 .../directory/fortress/core/impl/ConfigP.java      | 20 ++++-
 .../directory/fortress/core/impl/RoleDAO.java      | 73 +++++++++-------
 .../directory/fortress/core/impl/UserDAO.java      | 98 +++++++++++-----------
 .../fortress/core/rest/ConfigMgrRestImpl.java      |  9 ++
 .../directory/fortress/core/util/Config.java       | 40 +++++----
 8 files changed, 202 insertions(+), 107 deletions(-)

diff --git a/src/main/java/org/apache/directory/fortress/core/ConfigMgr.java b/src/main/java/org/apache/directory/fortress/core/ConfigMgr.java
index b9837ad..d928c4b 100755
--- a/src/main/java/org/apache/directory/fortress/core/ConfigMgr.java
+++ b/src/main/java/org/apache/directory/fortress/core/ConfigMgr.java
@@ -46,6 +46,7 @@ public interface ConfigMgr
      * {@link org.apache.directory.fortress.core.SecurityException} with error
      * {@link org.apache.directory.fortress.core.GlobalErrIds#FT_CONFIG_ALREADY_EXISTS} will be thrown.
      * <h4>required parameters</h4>
+     * @param cfg contains the name and optional attributes.
      * <ul>
      *   <li>{@link Configuration#name} - contains the name of new object being added</li>
      * </ul>
@@ -57,7 +58,6 @@ public interface ConfigMgr
      *   <li>
      * </ul>
      *
-     * @param cfg contains the name and optional attributes.
      * @return {@link Configuration} - contains the configuration entity that was added.
      * @throws org.apache.directory.fortress.core.SecurityException in the event entry already present or other system error.
      */
@@ -69,6 +69,7 @@ public interface ConfigMgr
      * If node does not exist, a {@link org.apache.directory.fortress.core.SecurityException} with error
      * {@link org.apache.directory.fortress.core.GlobalErrIds#FT_CONFIG_NOT_FOUND} will be thrown.
      * <h4>required parameters</h4>
+     * @param cfg contains the name and optional attributes.
      * <ul>
      *   <li>{@link Configuration#name} - contains the name of new object being added</li>
      * </ul>
@@ -80,7 +81,6 @@ public interface ConfigMgr
      *   <li>
      * </ul>
      *
-     * @param cfg contains the name and optional attributes.
      * @return {@link Configuration} - contains the configuration entity that was added.
      * @throws org.apache.directory.fortress.core.SecurityException in the event entry not present or other system error.
      */
@@ -133,4 +133,15 @@ public interface ConfigMgr
      * @throws org.apache.directory.fortress.core.SecurityException in the event entry doesn't exist or other system error.
      */
     Configuration read( String name ) throws SecurityException;
+
+    /**
+     * Read an existing cfg node with given name and return posixIds to caller.  The name is required.  If node doesn't exist,
+     * a {@link org.apache.directory.fortress.core.SecurityException} with error
+     * {@link org.apache.directory.fortress.core.GlobalErrIds#FT_CONFIG_NOT_FOUND} will be thrown.
+     *
+     * @param name attribute is required and maps to 'cn' attribute in 'device' object class.
+     * @return {@link Configuration} entity contains the getPosixIds on the specified node.
+     * @throws org.apache.directory.fortress.core.SecurityException in the event entry doesn't exist or other system error.
+     */
+    Configuration getIds( String name ) throws SecurityException;
 }
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
index 0ad6b55..dd2cefc 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
@@ -92,13 +92,16 @@ final class ConfigDAO extends LdapDataProvider
     {
         SchemaConstants.DEVICE_OC, GlobalIds.PROPS_AUX_OBJECT_CLASS_NAME, GlobalIds.FT_CONFIG_AUX_OBJECT_CLASS_NAME
     };
-
+    private final String[] POSIX_IDS =
+    {
+        GID_NUMBER_SEQUENCE, UID_NUMBER_SEQUENCE
+    };
     private final String[] CONFIG_ATRS =
     {
         SchemaConstants.CN_AT, GlobalIds.PROPS, GID_NUMBER_SEQUENCE, UID_NUMBER_SEQUENCE
-
     };
 
+
     /**
      * Package private default constructor.
      */
@@ -355,6 +358,44 @@ final class ConfigDAO extends LdapDataProvider
         return configuration;
     }
 
+    /**
+     *
+     * @param name
+     * @return
+     * @throws FinderException
+     */
+    Configuration getPosixIds( String name )
+        throws FinderException
+    {
+        Configuration configuration = new Configuration();
+        LdapConnection ld = null;
+        String dn = getDn( name );
+        LOG.debug( "getPosixIds dn [{}]", dn );
+        try
+        {
+            ld = getAdminConnection();
+            Entry findEntry = read( ld, dn, POSIX_IDS );
+            configuration.setName( name );
+            configuration.setUidNumber( getAttribute( findEntry, UID_NUMBER_SEQUENCE ) );
+            configuration.setGidNumber( getAttribute( findEntry, GID_NUMBER_SEQUENCE ) );
+        }
+        catch ( LdapNoSuchObjectException e )
+        {
+            String warning = "getPosixIds COULD NOT FIND ENTRY for dn [" + dn + "]";
+            throw new FinderException( GlobalErrIds.FT_CONFIG_NOT_FOUND, warning, e );
+        }
+        catch ( LdapException e )
+        {
+            String error = "getPosixIds dn [" + dn + "] caught LdapException=" + e;
+            throw new FinderException( GlobalErrIds.FT_CONFIG_READ_FAILED, error, e );
+        }
+        finally
+        {
+            closeAdminConnection( ld );
+        }
+        return configuration;
+    }
+
 
     /**
      *
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java b/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java
index 4ba8dfb..cc1db96 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/ConfigMgrImpl.java
@@ -115,4 +115,13 @@ public class ConfigMgrImpl  extends Manageable implements ConfigMgr, Serializabl
     {
         return cfgP.read(name);
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Configuration getIds(String name) throws SecurityException
+    {
+        return cfgP.readPosixIds(name);
+    }
 }
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/ConfigP.java b/src/main/java/org/apache/directory/fortress/core/impl/ConfigP.java
index efdec90..0471aae 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/ConfigP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/ConfigP.java
@@ -71,7 +71,6 @@ final class ConfigP
      * @return {@link Properties} containing the collection of name/value pairs just added.
      * @throws SecurityException in the event entry already present or other system error.
      */
-    //Properties add( String name, Properties inProps )
     Configuration add(Configuration cfg)
         throws SecurityException
     {
@@ -90,7 +89,6 @@ final class ConfigP
      * @return {@link Properties} containing the collection of name/value pairs to be added to existing node.
      * @throws org.apache.directory.fortress.core.SecurityException in the event entry not present or other system error.
      */
-    //Properties update( String name, Properties inProps )
     Configuration update(Configuration cfg)
         throws SecurityException
     {
@@ -173,10 +171,24 @@ final class ConfigP
     Configuration read( String name )
         throws SecurityException
     {
-        Properties outProps;
         ConfigDAO cfgDao = new ConfigDAO();
         return cfgDao.getConfig( name );
-        //return outProps;
+    }
+
+
+    /**
+     * Read an existing cfg node with given name and return posixIds to caller.  The name is required.  If node doesn't exist,
+     * a {@link SecurityException} with error {@link org.apache.directory.fortress.core.GlobalErrIds#FT_CONFIG_NOT_FOUND} will be thrown.
+     *
+     * @param name attribute is required and maps to 'cn' attribute in 'device' object class.
+     * @return Configuration entity contains the getPosixIds on the specified node.
+     * @throws org.apache.directory.fortress.core.SecurityException in the event entry doesn't exist or other system error.
+     */
+    Configuration readPosixIds( String name )
+        throws SecurityException
+    {
+        ConfigDAO cfgDao = new ConfigDAO();
+        return cfgDao.getPosixIds( name );
     }
 
 
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java
index b1c4040..31695a7 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/RoleDAO.java
@@ -45,11 +45,7 @@ import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.RemoveException;
 import org.apache.directory.fortress.core.UpdateException;
 import org.apache.directory.fortress.core.ldap.LdapDataProvider;
-import org.apache.directory.fortress.core.model.ConstraintUtil;
-import org.apache.directory.fortress.core.model.Graphable;
-import org.apache.directory.fortress.core.model.Group;
-import org.apache.directory.fortress.core.model.ObjectFactory;
-import org.apache.directory.fortress.core.model.Role;
+import org.apache.directory.fortress.core.model.*;
 import org.apache.directory.fortress.core.util.Config;
 import org.apache.directory.fortress.core.util.PropUpdater;
 import org.apache.directory.fortress.core.util.PropUtil;
@@ -180,26 +176,6 @@ final class RoleDAO extends LdapDataProvider implements PropertyProvider<Role>,
             entity.setId();
             entry.add( GlobalIds.FT_IID, entity.getId() );
             entry.add( ROLE_NM, entity.getName() );
-            // If supporting RFC2307 posixGroups && the gidNumber has not already been set.
-            if ( IS_RFC2307 && StringUtils.isEmpty( entity.getGidNumber() ) )
-            {
-                String name = Config.getInstance().getProperty( GlobalIds.CONFIG_REALM );
-                try
-                {
-                    entity.setGidNumber( Config.getInstance().replaceProperty( name, GlobalIds.GID_NUMBER, this ) );
-                }
-                catch ( CfgException ce )
-                {
-                    String error = "create role caught CfgException replacing the GID prop:" + ce.getMessage();
-                    throw new CreateException( GlobalErrIds.ROLE_ADD_FAILED, error, ce );
-                }
-            }
-            // gidNumber is optional:
-            if ( IS_RFC2307 && StringUtils.isNotEmpty( entity.getGidNumber() ) )
-            {
-                entry.add( GlobalIds.GID_NUMBER, entity.getGidNumber() );
-            }
-
             // description field is optional on this object class:
             if ( StringUtils.isNotEmpty( entity.getDescription() ) )
             {
@@ -213,6 +189,13 @@ final class RoleDAO extends LdapDataProvider implements PropertyProvider<Role>,
             // These multi-valued attributes are optional.  The utility function will return quietly if items are not loaded into collection:
             loadAttrs( entity.getParents(), entry, GlobalIds.PARENT_NODES );
 
+            if ( IS_RFC2307 )
+            {
+                // Supporting RFC2307 posixGroups attributes on fortress roles.
+                loadGidNumber( entity );
+                entry.add( GlobalIds.GID_NUMBER, entity.getGidNumber() );
+            }
+
             ld = getAdminConnection();
             add( ld, entry, entity );
         }
@@ -229,7 +212,6 @@ final class RoleDAO extends LdapDataProvider implements PropertyProvider<Role>,
         return entity;
     }
 
-
     /**
      * @param entity
      * @return
@@ -251,12 +233,6 @@ final class RoleDAO extends LdapDataProvider implements PropertyProvider<Role>,
                     SchemaConstants.DESCRIPTION_AT, entity.getDescription() ) );
             }
 
-            if ( IS_RFC2307 && StringUtils.isNotEmpty( entity.getGidNumber() ) )
-            {
-                mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
-                    GlobalIds.GID_NUMBER, entity.getGidNumber() ) );
-            }
-
             if ( entity.isTemporalSet() )
             {
                 String szRawData = ConstraintUtil.setConstraint( entity );
@@ -270,6 +246,12 @@ final class RoleDAO extends LdapDataProvider implements PropertyProvider<Role>,
 
             loadAttrs( entity.getParents(), mods, GlobalIds.PARENT_NODES );
 
+            if ( IS_RFC2307 && StringUtils.isNotEmpty( entity.getGidNumber() ) )
+            {
+                mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
+                        GlobalIds.GID_NUMBER, entity.getGidNumber() ) );
+            }
+
             if ( mods.size() > 0 )
             {
                 ld = getAdminConnection();
@@ -738,6 +720,33 @@ final class RoleDAO extends LdapDataProvider implements PropertyProvider<Role>,
 
 
     /**
+     * Sets the value of gidNumber on Role entity. Will use what's passed in or auto increment current.
+     *
+     * @param entity
+     * @throws CreateException
+     */
+    private void loadGidNumber( Role entity ) throws CreateException
+    {
+        // Generate the value of gidNumber if not passed in by caller:
+        if ( StringUtils.isEmpty( entity.getGidNumber() ) )
+        {
+            List<String> idNumbers = new ArrayList<>();
+            idNumbers.add(GlobalIds.GID_NUMBER);
+            Configuration configuration;
+            try
+            {
+                configuration = Config.getInstance().getIncrementReplacePosixIds(idNumbers, this);
+            }
+            catch (CfgException ce)
+            {
+                String error = "Create role had a problem loading the gidNumber, catching a CfgException:" + ce.getMessage();
+                throw new CreateException(GlobalErrIds.USER_ADD_FAILED, error, ce);
+            }
+            entity.setGidNumber( configuration.getGidNumber() );
+        }
+    }
+
+    /**
      *
      * @param le
      * @param sequence
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
index ce73393..6487467 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
@@ -62,22 +62,10 @@ import org.apache.directory.fortress.core.RemoveException;
 import org.apache.directory.fortress.core.SecurityException;
 import org.apache.directory.fortress.core.UpdateException;
 import org.apache.directory.fortress.core.ldap.LdapDataProvider;
-import org.apache.directory.fortress.core.model.Address;
-import org.apache.directory.fortress.core.model.AdminRole;
-import org.apache.directory.fortress.core.model.ConstraintUtil;
-import org.apache.directory.fortress.core.model.ObjectFactory;
-import org.apache.directory.fortress.core.model.OrgUnit;
+import org.apache.directory.fortress.core.model.*;
 import org.apache.directory.fortress.core.util.PropUpdater;
 import org.apache.directory.fortress.core.util.PropUtil;
-import org.apache.directory.fortress.core.model.PwMessage;
-import org.apache.directory.fortress.core.model.Role;
-import org.apache.directory.fortress.core.model.RoleConstraint;
 import org.apache.directory.fortress.core.model.RoleConstraint.RCType;
-import org.apache.directory.fortress.core.model.Session;
-import org.apache.directory.fortress.core.model.User;
-import org.apache.directory.fortress.core.model.UserAdminRole;
-import org.apache.directory.fortress.core.model.UserRole;
-import org.apache.directory.fortress.core.model.Warning;
 import org.apache.directory.fortress.core.util.Config;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.slf4j.Logger;
@@ -328,7 +316,7 @@ final class UserDAO extends LdapDataProvider implements PropUpdater
 
             // props are optional as well:
             // Add "initial" property here.
-            entity.addProperty( "initAttrArrays", "" );
+            entity.addProperty( "init", "" );
             loadProperties( entity.getProperties(), myEntry, GlobalIds.PROPS );
             // map the userid to the name field in constraint:
             entity.setName( entity.getUserId() );
@@ -340,52 +328,22 @@ final class UserDAO extends LdapDataProvider implements PropUpdater
                 myEntry.add( JPEGPHOTO, entity.getJpegPhoto() );
             }
 
-            // These are the posixAccount attributes specified by RFC2307bis (proposed) IETF standard:
+            // Load the posixAccount attributes required by the RFC2307bis (proposed) IETF standard:
             if ( IS_RFC2307 )
             {
-                // if not set, generate:
-                if ( StringUtils.isEmpty( entity.getUidNumber() ) )
-                {
-                    String name = Config.getInstance().getProperty( GlobalIds.CONFIG_REALM );
-                    try
-                    {
-                        entity.setUidNumber( Config.getInstance().replaceProperty( name, GlobalIds.UID_NUMBER, this ) );
-                    }
-                    catch ( CfgException ce )
-                    {
-                        String error = "create user caught CfgException replacing the UID prop:" + ce.getMessage();
-                        throw new CreateException( GlobalErrIds.USER_ADD_FAILED, error, ce );
-                    }
-                }
+                loadPosixIds( entity );
 
                 // required on PosixAccount:
                 myEntry.add( GlobalIds.UID_NUMBER, entity.getUidNumber() );
-
-                // if not set, generate:
-                if ( StringUtils.isEmpty( entity.getGidNumber() ) )
-                {
-                    String name = Config.getInstance().getProperty( GlobalIds.CONFIG_REALM );
-                    try
-                    {
-                        entity.setGidNumber( Config.getInstance().replaceProperty( name, GlobalIds.GID_NUMBER, this ) );
-                    }
-                    catch ( CfgException ce )
-                    {
-                        String error = "create user caught CfgException replacing the GID prop:" + ce.getMessage();
-                        throw new CreateException( GlobalErrIds.USER_ADD_FAILED, error, ce );
-                    }
-                }
-
-                // required on PosixAccount:
                 myEntry.add( GlobalIds.GID_NUMBER, entity.getGidNumber() );
 
-                // if not set, generate:
+                // if not set, generate a sensible default:
                 if ( StringUtils.isEmpty( entity.getHomeDirectory() ) )
                 {
-                    entity.setHomeDirectory( "not set" );
+                    entity.setHomeDirectory( "/home/" + entity.getUserId() );
                 }
 
-                // required on PosixAccount:
+                // Also required on PosixAccount:
                 myEntry.add( HOME_DIRECTORY, entity.getHomeDirectory() );
             }
 
@@ -2630,6 +2588,48 @@ final class UserDAO extends LdapDataProvider implements PropUpdater
         return uRoles;
     }
 
+    /**
+     * Utility to load posixAccount gidNumber and uidNumber into entry. Handles generation if caller does not set.
+     *
+     * @param entity contains gidNumber and uidNumber values.
+     *
+     * @throws CreateException in the event the configuration handler fails.
+     */
+    private void loadPosixIds( User entity ) throws CreateException
+    {
+        // Were the id numbers passed in or do we need to generate?
+        if ( StringUtils.isEmpty( entity.getUidNumber() ) || StringUtils.isEmpty( entity.getGidNumber() ) )
+        {
+            // Contains list of which attr names to load:
+            List<String> idNumbers = new ArrayList<>();
+            if ( StringUtils.isEmpty( entity.getUidNumber() ) )
+            {
+                idNumbers.add( GlobalIds.UID_NUMBER );
+            }
+            if ( StringUtils.isEmpty( entity.getGidNumber() ) )
+            {
+                idNumbers.add( GlobalIds.GID_NUMBER );
+            }
+            Configuration configuration;
+            try
+            {
+                configuration = Config.getInstance().getIncrementReplacePosixIds( idNumbers, this );
+            }
+            catch ( CfgException ce )
+            {
+                String error = "create user caught CfgException replacing an ID prop:" + ce.getMessage();
+                throw new CreateException( GlobalErrIds.USER_ADD_FAILED, error, ce );
+            }
+            if ( StringUtils.isEmpty( entity.getUidNumber() ) )
+            {
+                entity.setUidNumber( configuration.getUidNumber() );
+            }
+            if ( StringUtils.isEmpty( entity.getGidNumber() ) )
+            {
+                entity.setGidNumber( configuration.getGidNumber() );
+            }
+        }
+    }
 
     /**
      * @param userId
diff --git a/src/main/java/org/apache/directory/fortress/core/rest/ConfigMgrRestImpl.java b/src/main/java/org/apache/directory/fortress/core/rest/ConfigMgrRestImpl.java
index fcfda89..2400908 100644
--- a/src/main/java/org/apache/directory/fortress/core/rest/ConfigMgrRestImpl.java
+++ b/src/main/java/org/apache/directory/fortress/core/rest/ConfigMgrRestImpl.java
@@ -173,4 +173,13 @@ public class ConfigMgrRestImpl implements ConfigMgr
         }
         return retCfg;
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Configuration getIds(String name) throws SecurityException
+    {
+        throw new UnsupportedOperationException( "not implemented" );
+    }
 }
\ No newline at end of file
diff --git a/src/main/java/org/apache/directory/fortress/core/util/Config.java b/src/main/java/org/apache/directory/fortress/core/util/Config.java
index d8b42fc..3bed01c 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/Config.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/Config.java
@@ -22,6 +22,7 @@ package org.apache.directory.fortress.core.util;
 
 import java.net.URL;
 import java.util.Enumeration;
+import java.util.List;
 import java.util.Properties;
 
 import org.apache.commons.configuration.PropertiesConfiguration;
@@ -34,6 +35,7 @@ import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.SecurityException;
 import org.apache.directory.fortress.core.model.Configuration;
+import org.apache.directory.fortress.core.model.Props;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -126,32 +128,34 @@ public final class Config
     }
 
     /**
-     * Replaces property stored in the named configuration node.
-     * Method is synchronized to prevent race condition where two threads access and update the same property value.
+     * Performs auto-increment on a list of key names that map to integer values stored on the current config node of the runtime.
+     * Unfortunately, it's synchronized to prevent a race condition of multiple threads trying to update the same id.
+     * Worse, it doesn't lock meaning not synched across processes and so a temporary workaround until the Apache LDAP API supports RFC 4525 (Modify Increment attribute).
      *
-     * @param name of the config node, mostly likely 'DEFAULT'.
-     * @param key used for the property.
+     * @param props list of attribute names to update on config node.
      * @param propUpdater reference to object that updates to new value.
-     * @return String containing the new value for the property.
+     * @return Configuration entity containing the old values.
      */
-    public synchronized String replaceProperty( String name, String key, PropUpdater propUpdater ) throws CfgException
+    public synchronized Configuration getIncrementReplacePosixIds(List<String> props, PropUpdater propUpdater ) throws CfgException
     {
-        String value;
+        String cfgName = Config.getInstance().getProperty( GlobalIds.CONFIG_REALM );
+        org.apache.directory.fortress.core.model.Configuration inConfig;
         try
         {
             ConfigMgr cfgMgr = ConfigMgrFactory.createInstance();
-            org.apache.directory.fortress.core.model.Configuration inConfig = cfgMgr.read( name );
+            inConfig = cfgMgr.getIds( cfgName );
             org.apache.directory.fortress.core.model.Configuration outConfig = new Configuration();
-            outConfig.setName( name );
-            if( key.equals( GlobalIds.UID_NUMBER ))
+            outConfig.setName( cfgName );
+            for( String name : props )
             {
-                value = inConfig.getUidNumber();
-                outConfig.setUidNumber( propUpdater.newValue( value ) );
-            }
-            else
-            {
-                value = inConfig.getGidNumber();
-                outConfig.setGidNumber( propUpdater.newValue( inConfig.getGidNumber() ) );
+                if( name.equals( GlobalIds.UID_NUMBER ) )
+                {
+                    outConfig.setUidNumber( propUpdater.newValue( inConfig.getUidNumber() ) );
+                }
+                if( name.equals( GlobalIds.GID_NUMBER ) )
+                {
+                    outConfig.setGidNumber( propUpdater.newValue( inConfig.getGidNumber() ) );
+                }
             }
             cfgMgr.update( outConfig );
         }
@@ -160,7 +164,7 @@ public final class Config
             String error = "replaceProperty failed, exception=" + se.getMessage();
             throw new CfgRuntimeException( GlobalErrIds.FT_CONFIG_UPDATE_FAILED, error, se );
         }
-        return value;
+        return inConfig;
     }
 
     /**