3 # searches and displays any local orphan account (not attached to a site)
4 # remote accounts with identical emails are displayed as well
9 return [p for p in GetPersons({'peer_id':None,'-SORT':'email'}) if not p['site_ids'] ]
11 def list_person (margin,p):
12 print margin,'%6d'%p['person_id'], time.asctime(time.gmtime(p['date_created'])),
13 if not p['peer_id']: print 'LOCAL',
14 else: print 'pr=',p['peer_id'],
15 if p['enabled']: print 'ENB',
19 def get_related(email):
20 return GetPersons ({'email':email,'~peer_id':None})
23 print '--------------------'
25 print time.asctime(time.gmtime())
26 print 'Listing orphan accounts and any similar remote'
27 print '--------------------'
30 orphans = get_orphans()
31 header ('Listing %d local accounts with no site - and similar remote accounts'%len(orphans))
34 list_person ("%3d"%index,p)
35 for related in get_related(p['email']):
36 list_person("dup",related)
39 def main_duplicates():
41 header ('Listing all duplicate accounts')
42 for local in GetPersons({'peer_id':None,'-SORT':'email'}):
43 remotes=GetPersons({'email':local['email'],'~peer_id':None})
45 list_person('---',local)
46 for remote in remotes:
47 list_person('dup',remote)
53 if __name__ == '__main__':