collective / collective/pas.plugins.sqlalchemy

Deleting users/groups orphans Principal

Open
#15 4 comments 0 reactions 1 assignee Claimed by @malthe View on GitHub
Dominant language
Python
Stars
7
Forks
7
PR merge metrics
No merged PRs in 30d

Description

When a User (or presumably Group, but I didn't test that yet) is deleted, we're using:

```
def doDeleteUser(self, login):
session = Session()
user = session.query(self.user_class).filter_by(login=login).first()
if user is None:
return False
session.delete(user)
notify(PrincipalDeleted(user))
return True
```

Unfortunately this leaves the user on the Principal table, and it's no longer possible to re-add the user. Surely when deleting either groups or users, we should be deleting the principal object (and I don't understand the SQLAlchemy ORM well enough yet to know whether we should do that directly or via a backref).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.