View Issue Details

IDProjectCategoryView StatusLast Update
0007138OXID eShop (all versions)2.5. Administer userspublic2024-12-04 15:41
Reportertte Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
Product Version6.1.5 
Summary0007138: Deleting users won't delete user references left in other tables
DescriptionInvoking the user model's delete() function in Application/Model/User.php will call several other functions which should take care of deleting the remaining user references from various tables.

However, the invoked functions always try to get the user's ID using $this->getId() instead of using the $oxid param which might be present in the parent delete() function. This results in user references not being deleted properly from other tables while the original user has already been removed from oxuser.
Steps To ReproduceDelete a user account in the shop's backend.
TagsNo tags attached.
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Relationships

has duplicate 0007146 closedQA Deleting User in the admin interface does not delete related data 

Activities

QA

2020-05-19 09:11

administrator   ~0013226

Last edited: 2020-05-19 09:13

Reproduced in 6.2.1

ideas for a solution:
Either extend the method \OxidEsales\EshopCommunity\Application\Model\User::delete to set the object property by hand:
    public function delete($oxid = null)
    {
        if (!$oxid) {
            $oxid = $this->getId();
        }
        if (!$oxid) {
            return false;
        }
        
        if ($oxid && !$this->_sOXID) {  // <-- new
            $this->_sOXID = $oxid;      // <-- new
        }                               // <-- new


Or set the property by the calling controller: \OxidEsales\EshopCommunity\Application\Controller\Admin\AdminListController::deleteEntry
    public function deleteEntry()
    {
        $delete = oxNew($this->_sListClass);

        //disabling deletion for derived items
        if ($delete->isDerived()) {
            return;
        }

        $delete->setId($this->getEditObjectId()); // <-- new
        $blDelete = $delete->delete($this->getEditObjectId());


-MK