Example #1
0
 def setPropertiesForUser(self, user, propertysheet):
     """
     Retrieve all of the IMembraneUserProperties property providers
     and delegate to them.
     """
     prop_providers = self._getPropertyProviders(user)
     for pp in prop_providers:
         mem_props = IMembraneUserProperties(pp)
         mem_props.setPropertiesForUser(user, propertysheet)
Example #2
0
    def getPropertiesForUser(self, user, request=None):
        """
        Retrieve all the IMembraneUserProperties property providers
        and delegate to them.
        """
        properties = {}
        mbtool = getToolByName(self, TOOLNAME)
        # first get the auth provider to get the uid property
        member = mbtool.getUserAuthProvider(user.getUserName())
        if member is not None:
            # XXX do we want a 'uid' property for groups?
            properties['uid'] = IReferenceable(member).UID()

        prop_providers = self._getPropertyProviders(user)
        for pp in prop_providers:
            mem_props = IMembraneUserProperties(pp)
            psheet = mem_props.getPropertiesForUser(user, request)
            for prop, value in psheet.propertyItems():
                properties[prop] = value
        if properties.has_key('id'):
            # When instantiating sheet(id, **props) is used - two ids is bad
            del properties['id']
        return MutablePropertySheet(self.id,
                                    **properties)
    def testGetPropertiesForUserOnUser(self):
        mem_props = IMembraneUserProperties(self.member)
        properties = mem_props.getPropertiesForUser(None)

        self.failUnless(properties.hasProperty('fullname'))