6 from sfa.storage.model import *
7 from sfa.storage.alchemy import *
8 from sfa.trust.gid import create_uuid
9 from sfa.trust.hierarchy import Hierarchy
10 from sfa.util.xrn import Xrn
11 from sfa.trust.certificate import Certificate, Keypair, convert_public_key
15 hierarchy = Hierarchy()
16 users = s.query(RegRecord).filter_by(type="user")
21 pkey = Keypair(create=True)
22 pub_key=getattr(record,'reg_keys',None)
24 # use only first key in record
25 if pub_key and isinstance(pub_key, types.ListType): pub_key = pub_key[0]
27 pkey = convert_public_key(pub_key)
28 urn = Xrn (xrn=record.hrn, type='user').get_urn()
29 email=getattr(record,'email',None)
30 gid_object = hierarchy.create_gid(urn, uuid, pkey, email = email)
31 gid = gid_object.save_to_string(save_parents=True)
35 if __name__ == '__main__':