Beispiel #1
0
    def replace_relation(self, parent, child, field):
        dn = field.get_dn(parent, child)
        values = self.prepare_related_values(parent, child, field)

        mlist = [(ldap.MOD_REPLACE, field.ldap_field, values)]
        log.debug("LDAP.replace_relation %s :: %s" % (dn, ldap_log(mlist)))
        self.op_modify_ext(dn, mlist)
    def replace_relation(self, parent, child, field):
        dn = field.get_dn(parent, child)
        values = self.prepare_related_values(parent, child, field)

        mlist = [(ldap.MOD_REPLACE, field.ldap_field, values)]
        log.debug("LDAP.replace_relation %s :: %s" % (dn, ldap_log(mlist)))
        self.op_modify_ext(dn, mlist)
Beispiel #3
0
    def save_relation(self, parent, child, field):
        """ a relation, represented as DN, exists or it does not, it is not modified in-place """
        dn = field.get_dn(parent, child)
        values = self.prepare_related_values(parent, child, field)

        mlist = [(ldap.MOD_ADD, field.ldap_field, values)]
        log.debug("LDAP.save_relation %s :: %s" % (dn, ldap_log(mlist)))
        self.op_modify_ext(dn, mlist)
    def save_relation(self, parent, child, field):
        """ a relation, represented as DN, exists or it does not, it is not modified in-place """
        dn = field.get_dn(parent, child)
        values = self.prepare_related_values(parent, child, field)

        mlist = [(ldap.MOD_ADD, field.ldap_field, values)]
        log.debug("LDAP.save_relation %s :: %s" % (dn, ldap_log(mlist)))
        self.op_modify_ext(dn, mlist)
 def save(self, values={}, extra={}, **kwargs):
     modified_values = self.model_fields_to_ldap_fields(values, extra, mode="save")
     self.kwargs = kwargs
     force_update = kwargs.get("force_update", False)
     mlist = self.get_modify_modlist(modified_values, force_update=force_update)
     if not self.needs_saving(modified_values):
         log.debug("LDAP: No save required: %s" % self.dn)
         return
     if mlist:
         log.debug("LDAP.save %s :: %s" % (self.dn, ldap_log(mlist)))
         self.op_modify(self.dn, mlist)
Beispiel #6
0
 def save(self, values={}, extra={}, **kwargs):
     modified_values = self.model_fields_to_ldap_fields(values,
                                                        extra,
                                                        mode='save')
     self.kwargs = kwargs
     force_update = kwargs.get('force_update', False)
     mlist = self.get_modify_modlist(modified_values,
                                     force_update=force_update)
     if not self.needs_saving(modified_values):
         log.debug("LDAP: No save required: %s" % self.dn)
         return
     if mlist:
         log.debug("LDAP.save %s :: %s" % (self.dn, ldap_log(mlist)))
         self.op_modify(self.dn, mlist)
 def create(self, dn=None, values={}, extra={}):
     modified_values = self.model_fields_to_ldap_fields(values, extra, mode="create")
     mlist = self.get_add_modlist(modified_values)
     if not self.needs_saving(modified_values):
         log.debug("LDAP: No create required: %s" % self.dn)
         return
     log.debug("LDAP.create %s :: %s" % (self.dn, ldap_log(mlist)))
     # TODO: check for duplicates in objectClass
     if dn:
         create_dn = dn
     elif self.dn:
         create_dn = dn
     else:
         raise Exception("No DN specified, unable to save to LDAP.")
     self.op_add(create_dn, mlist)
Beispiel #8
0
 def create(self, dn=None, values={}, extra={}):
     modified_values = self.model_fields_to_ldap_fields(values,
                                                        extra,
                                                        mode='create')
     mlist = self.get_add_modlist(modified_values)
     if not self.needs_saving(modified_values):
         log.debug("LDAP: No create required: %s" % self.dn)
         return
     log.debug("LDAP.create %s :: %s" % (self.dn, ldap_log(mlist)))
     # TODO: check for duplicates in objectClass
     if dn:
         create_dn = dn
     elif self.dn:
         create_dn = dn
     else:
         raise Exception("No DN specified, unable to save to LDAP.")
     self.op_add(create_dn, mlist)