def itemusers(item_id, req, retries=1): client = mongoconnection(config.notification.hostname, config.notification.port) collection = client['pacifica_db']['jmds_collection'] code = 404 item_id = int(item_id) f = collection.find({"_id":item_id}) for doc in f: list = {} if 'agd' not in doc or doc['agd'] == False: if 'submitter' in doc: list[doc['submitter']] = 1 if 'trusted' in doc: trusted = doc['trusted'] if 'gov_pnnl_emsl_my/dms/datapackage' in trusted or 'gov_pnnl_emsl_my/dms/dataset' in trusted: for i in dms_users_plug.get(): list[i] = 1 extended_metadata = doc.get('extended_metadata') if extended_metadata: #FIXME Plugin related stuff... for x in ['gov_pnnl_emsl_dms_pi', 'gov_pnnl_emsl_dms_technical_lead', 'gov_pnnl_emsl_dms_proj_mgr', 'gov_pnnl_emsl_dms_researcher', 'gov_pnnl_emsl_dms_dataset_operator']: l = extended_metadata.get(x) if l: for i in l: if i != None and 'id' in i: list[i['id']] = 1 list = list.keys() list.sort() req.write(json.dumps(list)) req.write("\n") code = 200 break return code
def main(): #FIXME Special for metadata? config = getconfig_notification('fmds') client = mongoconnection(config.notification.hostname, config.notification.port) collection = client['pacifica_db']['fmds_collection'] id = int(sys.argv[1]) def cb(doc): print json.dumps(doc, indent=4) process_item(id, collection, cb)
def main(): #FIXME client = mongoconnection('m11.emsl.pnl.gov', 27017) collection = client['pacifica_db']['tmds_collection'] instanceuuid = 'instanceuuid' id = int(sys.argv[1]) def cb(doc): print json.dumps(doc, indent=4) process_item(instanceuuid, id, collection, cb)
def main(): #FIXME Special for metadata? config = getconfig_notification('rmds') client = mongoconnection(config.notification.hostname, config.notification.port) collection = client['pacifica_db']['rmds_collection'] perms = json.load(open('/var/lib/myemsl/myemsl.dumppg.json')) #FIXME Get from fs instanceuuid = 'instanceuuid' id = int(sys.argv[1]) def cb(doc): print json.dumps(doc, indent=4) process_item(instanceuuid, perms, id, collection, cb)