[Zope-Checkins] CVS: Zope/lib/python/OFS - ObjectManager.py:1.163.12.4

Zachery Bir zbir at urbanape.com
Wed Mar 17 07:51:33 EST 2004


On Mar 17, 2004, at 7:46 AM, Zachery Bir wrote:

> On Mar 17, 2004, at 5:32 AM, Stefan H. Holek wrote:
>
>> Zachery,
>>
>> Just at first glance, once you use getId() you can no longer compare 
>> to the string 'Anonymous User' because this is, well, the user's 
>> *name*. The anon user has an Id of 'None', IIRC.
>
> Yes, and in the process of fixing my faux pas, I've got the code 
> modified to this:
>
>             if hasattr(object, '__ac_local_roles__'):
>                 if object.__ac_local_roles__ is None:
>                     user=getSecurityManager().getUser()
>                     if user is not None:
>                         id=user.getId()
>                         name=user.getUserName()
>                         if name != 'Anonymous User':
>                             object.manage_setLocalRoles(id, ['Owner'])
>
> Which should still provide for excepting the Anonymous User, but 
> keying the ownership to the Id.

But which won't necessarily work for the Emergency User. Alright, I'll 
back out the changes and work on some tests first.

Zac




More information about the Zope-Checkins mailing list