diff --git a/modules/ServerAPI/src/server/python/createLiveDesignLiveReportForACAS/create_lr_for_acas.py b/modules/ServerAPI/src/server/python/createLiveDesignLiveReportForACAS/create_lr_for_acas.py index 9336a0375..69dd06d3e 100755 --- a/modules/ServerAPI/src/server/python/createLiveDesignLiveReportForACAS/create_lr_for_acas.py +++ b/modules/ServerAPI/src/server/python/createLiveDesignLiveReportForACAS/create_lr_for_acas.py @@ -250,16 +250,25 @@ def make_acas_live_report(api, compound_ids, assays_to_add, experiment_code, log lr = LiveReport(experiment_code, "Contains the data just loaded", project_id=project_id) lr = api.create_live_report(lr) - #change LR owner to logged in user - lr.owner = logged_in_user + #put the LR in the Autogenerated ACAS Reports folder lr.tags = [folder_id] #Make the LR read-only if readonly: lr.update_policy = LiveReport.NEVER #Update LR - api.update_live_report(lr.id, lr) - + lr = api.update_live_report(lr.id, lr) + + # Attempt to set the owner to the logged in user but fall back if there is a permissions error (user may not have LD or project access in LD) + original_owner = lr.owner + try: + lr.owner = logged_in_user + lr = api.update_live_report(lr.id, lr) + except Exception as e: + eprint("Unable to set owner to " + logged_in_user + " due to error: " + str(e)) + # Set the original owner back so that we can continue with the LR updates + lr.owner = original_owner + eprint("Live Report owner will be:" + str(lr.owner)) lr_id = int(lr.id) eprint("Live Report ID is:" + str(lr_id))