Closed DieKatze closed 8 years ago
Hi @jensens,
this has also be reviewed internally by different developers (@laulaz), I am +1 for merging ;-)
Gauthier
Looks good. Merged, thanks!
Why is a new event needed instead of notifying PrincipalDeleted
also when a group is removed? Groups and users are both principals.
Hi @davisagli
we indeed wanted to use this event for user and group deletion but looking at packages using this event, we found plone.app.contentrules use it for the "User removed" rule... And maybe other packages in the collective or so are using the PrincipalDeleted event only for detecting user deletion... That is why we decided to add another event even though PrincipalDeleted should be used in both cases, or should be renamed to UserDeleted for sanity...
Gauthier
I would also add that even functions docstrings are all referring specifically to User
deletion (instead of Principal
).
That's a good point from a backwards-compatibility perspective; I agree with your approach. I do think it would be nice to deprecate the PrincipalDeleted name and change it to UserDeleted, to avoid confusion.
The idea of the abstract Principal as a base class for User and Group is ok. I would keep the PrincipalDeleted as is, but derive UserDeleted and GroupDeleted from it. This may need changes in Plone core to reflect it, but imo its worth the effort in order to have a clear naming.
Hi @jensens @davisagli
OK, we will work on this next week, and update this PR, do we try to keep backward compatibility or not? Indeed notifying GroupDeleted event will be catched by subscribers using IPrincipalDeletedEvent... Or do we raise/log if Principal event is used to warn user?
Don't update this pull request: it has already been merged. Create a new one.
@mauritsvanrees right ;-) but what about the backward compat part? The problem resides that notifying GroupDeleted event will also be catched by subscribers using IPrincipalDeletedEvent... Or am I wrong?
I think it is best if GroupDeleted and UserDeleted inherit from PrincipalDeleted. Same for their interfaces. Code that currently listens for IPrincipalDeleted events, will then get both events. It's a bit hard to predict if that will cause problems in some packages, but it seems the most logical approach to me.
@mauritsvanrees ok thank you, we will go for that.
Looks fine to me and the feature is very useful. Any objections against a merge?