[Zope] Is there a way to have users add themselves to a role?

StefanH.Holek StefanH.Holek
Sat, 5 Apr 2003 12:29:52 +0200


You would have to do that from unrestricted Python, that is an 
ExternalMethod or Python product code. Something like:

def addRoleToUser(self, username, newrole):
   uf = self.folder.acl_users
   roles = uf.getUser(username).getRoles() + (newrole,)
   uf._changeUser(username, 'password', 'pconfirm', roles, ())

Passing the strings 'password' and 'pconfirm' for password and 
confirmation respectively, is the user folder protocol for saying: 
"Leave the password unchanged."

HTH,
Stefan


On Freitag, Apr 4, 2003, at 06:22 Europe/Vienna, Russell Hires wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello...
>
> 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.
> 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.
>
> Anyone have any ideas on doing this?
>
> Thanks!
>
> Russell
> - --
> Linux -- the OS for the Renaissance Man
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
>
> iD8DBQE+jQigAqKGrvVshJQRAhhcAKDVZ0ZN06HnaFwOeiszfyegFF9ZPACfWVFz
> oNRxHhR3o7hnscraFKL0V1Q=
> =UORc
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )