from asura.model.user import AdminUser
f = open('result.csv', 'w')
last_id = '54732c57d6e4a91fb166b3f5'
aus = AdminUser.objects(id__gte=last_id)
while aus:
for u in aus:
last_id = str(u.id)
s = u.real_name + ',' + u.department + ',' + u.email + ','
r = u.roles
if 'op_junior' in r:
s += '1'
else:
s += '0'
s += ','
if 'op_editor' in r:
s += '1'
else:
s += '0'
s += ','
if 'op_review' in r:
s += '1'
else:
s += '0'
s += ','
if 'op_review_sensitive' in r:
s += '1'
else:
s += '0'
s += ','
if 'op_category' in r:
s += '1'
else:
s += '0'
s += ','
if 'op_note_reviewer' in r:
s += '1'
else:
s += '0'
s += ',' + str(u.user.id) + ','
if u.passwdhash:
s += w.passwdhash
s += '\n'
f.write(s.encode('utf-8'))
aus = AdminUser.objects(id__gt=last_id)
网友评论