Ticket #375 (new defect)
Don't delete policy records still in use
| Reported by: | rjl | Owned by: | rjl |
|---|---|---|---|
| Priority: | low | Milestone: | |
| Component: | PHP scripts | Version: | 1.0.1 |
| Severity: | minor | Keywords: | delete policy |
| Cc: |
Description
When a new Maia account is created, an address record is created in the users table, and a corresponding record in the policy table is linked to it. Conversely, when we delete an email address, we also delete the matching policy record. This is fine when the users:policy relationship is 1:1, but in some cases we want users to share a policy record (e.g. the high/medium/low levels). If we later try to delete one of those addresses, we'll end up deleting the policy record it references, even though other addresses still reference it. We basically need to test for any outstanding references to a policy record before deleting it, and leave it alone if there's still at least one record in the users table that points to it.

