Guest User

Untitled

a guest
Feb 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. def ldap_modify(user_list, attribute, new_value):
  2. ldif = [(ldap.MOD_REPLACE, attribute, new_value)]
  3. for user in user_list:
  4. dn="cn={}, ou=users, DC=example, DC=co, DC=uk".format(user)
  5. l.modify_s(dn, ldif)
  6.  
  7. user_list = ['Test User', 'Test User2', ...] # i.e. list of users full names
  8. attribute = 'description'
  9. new_value = 'test'
  10.  
  11. ldap.NO_SUCH_OBJECT: {'info': '00002030: No such Base DN: sAMAccountName=testuser1, ou=users, DC=example, DC=co, DC=uk', 'desc': 'No such object'}
Add Comment
Please, Sign In to add comment