def parse_domain_users(domain_users_file, domain_groups_file):
with open(domain_users_file) as f:<EOL><INDENT>users = json.loads(f.read())<EOL><DEDENT>domain_groups = {}<EOL>if domain_groups_file:<EOL><INDENT>with open(domain_groups_file) as f:<EOL><INDENT>groups = json.loads(f.read())<EOL>for group in groups:<EOL><INDENT>sid = get_field(group, '<STR_LIT>')<EOL>domain_groups[int(sid.split('<STR_LIT:->')[-<NUM_LIT:1>])] = get_field(group, '<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>user_search = UserSearch()<EOL>count = <NUM_LIT:0><EOL>total = len(users)<EOL>print_notification("<STR_LIT>".format(total))<EOL>for entry in users:<EOL><INDENT>result = parse_user(entry, domain_groups)<EOL>user = user_search.id_to_object(result['<STR_LIT:username>'])<EOL>user.name = result['<STR_LIT:name>']<EOL>user.domain.append(result['<STR_LIT>'])<EOL>user.description = result['<STR_LIT:description>']<EOL>user.groups.extend(result['<STR_LIT>'])<EOL>user.flags.extend(result['<STR_LIT>'])<EOL>user.sid = result['<STR_LIT>']<EOL>user.add_tag("<STR_LIT>")<EOL>user.save()<EOL>count += <NUM_LIT:1><EOL>sys.stdout.write('<STR_LIT:\r>')<EOL>sys.stdout.write("<STR_LIT>".format(count, total))<EOL>sys.stdout.flush()<EOL><DEDENT>sys.stdout.write('<STR_LIT:\r>')<EOL>return count<EOL>
Parses the domain users and groups files.