appsembler / course-access-groups

An Open edX plugin to customize courses access by grouping learners and assigning different permissions to groups.
https://course-access-groups.readthedocs.io/
MIT License
4 stars 3 forks source link

Fix False-Positive exception logs in Membership rules #120

Closed shadinaif closed 1 year ago

shadinaif commented 1 year ago

Description: Fix False-Positive exception logs in Membership rules

Both USER_ACCOUNT_ACTIVATED and REGISTER_USER signals call Membership.create_from_rules to create membership rules. The problem is that USER_ACCOUNT_ACTIVATED will always fail for newly registered users because the user is not linked to an organization yet, then REGISTER_USER will fix the membership issue.

This fix is to avoid logging exceptions for Organization.DoesNotExist anymore in on_learner_account_activated (which is triggered by USER_ACCOUNT_ACTIVATED)

_Why we're keeping the call? why not remove it and rely on on_learner_register?_ This is just for rare cases where the user is deactivated and then reactivated later by an admin

JIRA: https://appsembler.atlassian.net/browse/RED-3674

Dependencies: dependencies on other outstanding PRs, issues, etc.

Merge deadline: List merge deadline (if any)

Installation instructions: List any non-trivial installation instructions.

Testing instructions:

  1. Open page A
  2. Do thing B
  3. Expect C to happen
  4. If D happened instead - check failed.

Reviewers:

Merge checklist:

Post merge:

Author concerns: List any concerns about this PR - inelegant solutions, hacks, quick-and-dirty implementations, concerns about migrations, etc.