Russell Hires wrote at 2003-4-3 23:22 -0500:
... I'm playing with plone, but this is really a zope question. At the moment, I want to give my users the ability to choose whether or not they receive an email when a certain object type is published. The way I'm looking at doing this is to allow the user to choose whether they have a certain role or not.
That's quite an indirect approach. Roles have not been designed for this use case. In my view, it would be more natural to have a user attribute or a relation "subscribed", holding subscription information for all users and email services.
Naturally, these would be custom roles, but I want the user to decide (without my intervention) on if that person wants to have that role.
It is difficult: The "AccessControl.User.BasicUser" API does not provide for a method to modify roles alone, only a method to change the user definition as a whole, including password. You can implement it (in an External Method) for non-encrypted passwords or for a given UserFolder (by using internal implementation specific knowledge). Go a different way... Dieter