View Issue Details

IDProjectCategoryView StatusLast Update
0003218OXID eShop (all versions)1.05. Userspublic2015-05-04 15:34
ReporterAdrian.Kirchner Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.5.1 revision 38045 
Fixed in Version4.5.6 revision 40808 
Summary0003218: oxUser::addToGroup() stores wrong entity in oxUser::_oGroups attribute
DescriptionInstead of adding the oxGroups instance to the class internal $_oGroups attribute, addToGroup() stores the relation representation oxObject2Group instance in this attribute as you can see here: http://docu.oxid-esales.com/CE/sourcecodedocumentation/4.5.1.38045/oxuser_8php_source.html#l00803

This misbehavior causes major problems for all group related tasks such as oxUser::removeFromGroup() and makes user group based sql statements useless (see oxActionList::_getUserGroupFilter()) if they are processed at the same request as addToGroup() was called.
Steps To Reproduce$oUser = oxNew('oxUser');
$oUser->load('oxdefaultadmin');

$oGroup = oxNew('oxGroups');
$oGroup->setId('newgroup');

$oUser->addToGroup($oGroup->getId());

foreach($oUser->getUserGroups() as $sGroupOxid=>$oGroup)
{
    printf("%-9s - %-14s - %-32s\n", $sGroupOxid, get_class($oGroup), $oGroup->getId());
}

// ignore this -> only for reproducibility
oxDb::getDb()->Execute("DELETE FROM oxobject2group WHERE oxgroupsid = 'newgroup'");


Expected result:
----------------
oxidadmin - oxGroups - oxidadmin
newgroup - oxGroups - newgroup

Actual result:
--------------
oxidadmin - oxGroups - oxidadmin
newgroup - oxObject2Group - 82061831685d3f8bfb82f192914e1
TagsNo tags attached.
ThemeBoth
BrowserAll
PHP Versionany
Database Versionany

Activities

svetlana

2011-11-22 14:28

reporter   ~0005434

@developers please check from source code

mindaugas.rimgaila

2011-12-06 16:25

reporter   ~0005462

After user is assigned to the new user group set oxGroups object in user groups cache