def test_modify_with_relax(self): ld = LDAP(self.env['uri_389']) ld.bind(self.env['root_dn'], self.env['root_pw']) c = LDAPControl() c.add_control(LDAP_CONTROL_RELAX) dtime = datetime.utcnow().strftime('%Y%m%d%H%M%S.%fZ') changes = [('pwdAccountLockedTime', [dtime], LDAP_MOD_REPLACE)] ld.modify(self.env['target_user'], changes, controls=c)
def test_add_with_relax(self): (dn, attributes) = create_user_entry(relax=True) self.new_user_dn = dn self.new_user_attributes = attributes ld = LDAP(self.env['uri_389']) ld.bind(self.env['root_dn'], self.env['root_pw']) c = LDAPControl() c.add_control(LDAP_CONTROL_RELAX) ld.add(self.new_user_dn, self.new_user_attributes, controls=c)
def test_bind_controls(self): ld = LDAP(self.env['uri_389']) c = LDAPControl() c.add_control(LDAP_CONTROL_PASSWORDPOLICYREQUEST) msgid = ld.bind(self.env['auth_user'], self.env['auth_pw'], controls=c, async=True) result = ld.result(msgid, controls=c) self.assertIn('ppolicy_msg', result)
def test_modify_with_relax(self): ld = LDAP(self.env['uri_389']) ld.bind(self.env['root_dn'], self.env['root_pw']) c = LDAPControl() c.add_control(LDAP_CONTROL_RELAX) dtime = datetime.utcnow().strftime('%Y%m%d%H%M%S.%fZ') changes = [ ('pwdAccountLockedTime', [dtime], LDAP_MOD_REPLACE) ] ld.modify(self.env['modify_user'], changes, controls=c)