Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACAS-718: Fallback LR ownership update to service user #1127

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down