예제 #1
0
 def save(self, widget, data):
     settings = self.model.root['settings']
     attrmap = settings.attrs.users_form_attrmap
     user = AttributedNode()
     for key, val in attrmap.items():
         val = data.fetch('userform.%s' % key).extracted
         if not val:
             continue
         user.attrs[key] = val
     users = self.model.__parent__.ldap_users
     id = user.attrs['id']
     self.next_resource = id
     users[id] = user
     users.context()
     password = data.fetch('userform.userPassword').extracted
     if password is not UNSET:
         users.passwd(id, None, password)
예제 #2
0
    def __setitem__(self, name, vessel):
        try:
            attrs = vessel.nodespaces["__attrs__"]
        except KeyError:
            raise ValueError(u"Attributes need to be set.")

        nextvessel = AttributedNode()
        nextvessel.__name__ = name
        nextvessel.attribute_access_for_attrs = False
        principal = self.principal_factory(nextvessel, attraliaser=self.principal_attraliaser)
        principal.__name__ = name
        principal.__parent__ = self
        # XXX: we could cache here, given that we are based on a LazyNode or
        # similar
        for key, val in attrs.iteritems():
            principal.attrs[key] = val
        self.context[name] = nextvessel