by eggsurplus

Control what your users can access and save time, money, and frustrations. Lock down sensitive data in SugarCRM or SuiteCRM to specific groups or teams. Supports unlimited assigned users, unlimited group assignments to records, custom layouts for each group, login/sudo capabilities and much more.

Free Trial

By clicking you consent to share your profile with the developer

#3054 - Duplicate in securitygroups_records Tables

Closed Bug? created by Faten Salhieh 7 years ago
Dears we found that securitygroups_records has alot of duplicate records with same** (securitygroup_id,record_id,module),** after we check we see that function addGroupToRecord in file (modules/SecurityGroups/SecurityGroup.php) contain ** ($query = "insert into securitygroups_records(id,securitygroup_id,record_id,module,date_modified,deleted) " ."values( '".create_guid()."','".$securitygroup_id."','$record_id','$module',".db_convert('','today').",0) ";) ** which is not check if the record already existor not , so pleas can you check ?
  1. madnan member avatar

    Faten Salhieh

    7 years ago

    am using logic hook with $sg->addGroupToRecord

  2. eggsurplus member avatar

    eggsurplus Provider Affiliate

    7 years ago

    Yes, that is an unused, internal function. If you are using it, which is fine, you will need to check to see if an existing record exists prior.

    This function was for pre-6.3.0 in the Mass Assign functionality and was used at that time in this manner:

                    $query = "SELECT * FROM securitygroups_records WHERE securitygroup_id='$groupFocus->id' AND record_id='$id' AND module='$sugarbean->module_dir' AND deleted=0";
                    $db = DBManagerFactory::getInstance();
                    $result = $db->query($query);
                    $row = $db->fetchByAssoc($result);
                    if (empty($row))
                    {
                        SecurityGroup::addGroupToRecord($sugarbean->module_dir, $id, $groupFocus->id);
                    }
    

    Hope this helps!

This case is public. Please leave out any sensitive information such as URLs, passwords, etc.
Saving Comment Saving Comment...
Rating
Rating
  • "This impressive add on is easy to use, extremely flexible, and huge time saver. This add on exceeded our expectations and is worth every penny!"

    Read More Reviews