[Zope-CMF] Object ownership

Florent Guillaume fg@nuxeo.com
Tue, 21 May 2002 09:31:16 +0000 (UTC)


John Morton  <jwm@plain.co.nz> wrote:
> But no methods for answering the question, "Which users have the local role 
> 'Owner' for this object?".  

get_local_roles will return a sequence of pairs (user, roles) where
roles is a sequence of roles. You can just look for Owner there.

If speed is an issue you might also use:

    def get_users_with_local_role(self, role):
        users = []
        dict = self.__ac_local_roles__ or {}
        for user, roles in dict.items():
            if role in roles:
                users.append(user)
        return users

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com