Guest User

Untitled

a guest
Mar 7th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. # import class and constants
  2. from ldap3 import Server, Connection, ALL, MODIFY_REPLACE
  3.  
  4. # define the server
  5. s = Server('servername', get_info=ALL) # define an unsecure LDAP server, requesting info on DSE and schema
  6.  
  7. # define the connection
  8. c = Connection(s, user='user_dn', password='user_password')
  9. c.bind()
  10.  
  11. # perform the Modify operation
  12. c.modify('cn=user1,ou=users,o=company',
  13. {'givenName': [(MODIFY_REPLACE, ['givenname-1-replaced'])],
  14. 'sn': [(MODIFY_REPLACE, ['sn-replaced'])]})
  15. print(c.result)
  16.  
  17. # close the connection
  18. c.unbind()
Add Comment
Please, Sign In to add comment