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 30 day trial
Try it Now

#1720 - after_relationship_delete event between user and security group is not working

Closed Bug? created by ramakantgangwar 3 years ago

Hi,

I am facing problem using after_relationship_delete event between user and security group.

When I unlink secuity group from user from user management
I see this unlinking is linked to this file : "include/generic/DeleteRelationship.php" line number "89"
But after that after_relationship_delete event is not running

But when I try to unlink from user bean

$rel_name = 'SecurityGroups';
$user = new User ();
$user->retrieve ( $userId );
$user->load_relationship ( $rel_name );
$user->$rel_name->delete ( $user->id,$securityGroupId);

Please help

  1. eggsurplus member avatar

    eggsurplus Provider Affiliate

    3 years ago

    Hi there,

    I'm not sure how to help here. It sounds like there may be a bug in Sugar that you are running into if the hook isn't firing. One thing to check to be safe is to try doing an after_relationship_delete on a different module and see if that test works. On the SecurityGroups module, try defining the hook on the other module.

    • ramakantgangwar member avatar

      ramakantgangwar

      3 years ago

      it works for all modules when I try to unlink from user bean

      $rel_name = 'SecurityGroups';
      $user = new User ();
      $user->retrieve ( $userId );
      $user->load_relationship ( $rel_name );
      $user->$rel_name->delete ( $user->id,$securityGroupId);

      Its just not working when calling from "include/generic/DeleteRelationship.php" line number "89"

      Thanks anyway

    • eggsurplus member avatar

      eggsurplus Provider Affiliate

      3 years ago

      Have you tried remove() instead? It will trigger data/Relationships/M2MRelationship.php->remove() which calls the before/after relationship delete hooks.

  2. eggsurplus member avatar

    eggsurplus Provider Affiliate

    3 years ago

    Closing this out, but feel free to follow up if you have any more questions.

This case is public. Please leave out any sensitive information such as URLs, passwords, etc.
Saving Comment Saving Comment...
Rating
Rating
  • "No brainer. I have purchased it for two production installations and not regretted it."

    Read More Reviews

Keep up to date on the latest additions

We'll send you an email every month with handpicked add-ons, reviews, tricks and tips. Don't worry, we hate spam as much as you do.