diff --git a/include/User.h b/include/User.h index d66f113e7b..ee57ed35ba 100644 --- a/include/User.h +++ b/include/User.h @@ -193,9 +193,7 @@ protected: PoolObjectSQL(id,_username,-1,_gid,table), ObjectCollection("GROUPS"), password(_password), enabled(_enabled) - { - add_collection_id(_gid); //Adds the primary group to the collection - }; + { }; virtual ~User(){}; diff --git a/src/um/UserPool.cc b/src/um/UserPool.cc index eb56592f6f..ae896b742b 100644 --- a/src/um/UserPool.cc +++ b/src/um/UserPool.cc @@ -145,6 +145,8 @@ int UserPool::allocate ( // Build a new User object user = new User(-1, gid, username, password, enabled); + user->add_collection_id(gid); //Adds the primary group to the collection + // Insert the Object in the pool *oid = PoolSQL::allocate(user, error_str); diff --git a/src/um/test/UserPoolTest.cc b/src/um/test/UserPoolTest.cc index f3b3ac425b..c90dd971cb 100644 --- a/src/um/test/UserPoolTest.cc +++ b/src/um/test/UserPoolTest.cc @@ -198,13 +198,13 @@ public: CPPUNIT_ASSERT( oid == 0 ); session = "one_user_test:wrong_password"; - oid = user_pool->authenticate( session, oid, gid ); + rc = user_pool->authenticate( session, oid, gid ); CPPUNIT_ASSERT( rc == false ); CPPUNIT_ASSERT( oid == -1 ); CPPUNIT_ASSERT( gid == -1 ); session = "unknown_user:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8"; - oid = user_pool->authenticate( session, oid, gid ); + rc = user_pool->authenticate( session, oid, gid ); CPPUNIT_ASSERT( rc == false ); CPPUNIT_ASSERT( oid == -1 ); CPPUNIT_ASSERT( gid == -1 );