from ms_active_directory import ADDomain
domain = ADDomain('example.com')
session = domain.create_session_as_user('username@example.com', 'password')
user_name = 'arjun'
new_uid_number = 1093
success = session.overwrite_attribute_for_user(user_name, 'uidNumber',
new_uid_number)
# just like appending, we can do multiple attributes at once atomically
user_name = 'nikita'
new_employee_type = 'Director'
new_gid = 0
new_addresses = [
'123 mulberry lane',
'456 vacation home drive'
]
new_value_map = {
'employeeType': new_employee_type,
'gidNumber': new_gid,
'postalAddress': new_addresses
}
success = session.overwrite_attributes_for_user(user_name, new_value_map)