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

Authenticate user upon the move command for an embargoed Dandiset #1478

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 5 additions & 4 deletions dandi/move.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,10 @@ def move(
if dandiset is None:
dandiset = Path()
with ExitStack() as stack:
client = DandiAPIClient.for_dandi_instance(dandi_instance)
client.dandi_authenticate()
stack.enter_context(client)

mover: Mover
client: DandiAPIClient | None = None
if work_on is MoveWorkOn.AUTO:
Expand All @@ -811,8 +815,6 @@ def move(
if isinstance(dandiset, str):
raise TypeError("`dandiset` must be a Path when work_on='both'")
local_ds, subpath = find_dandiset_and_subpath(dandiset)
client = DandiAPIClient.for_dandi_instance(dandi_instance)
stack.enter_context(client)
remote_ds = client.get_dandiset(
local_ds.identifier, version_id="draft", lazy=False
)
Expand All @@ -833,15 +835,14 @@ def move(
if not isinstance(url, DandisetURL):
raise ValueError("URL does not point to a Dandiset")
client = url.get_client()
client.dandi_authenticate()
stack.enter_context(client)
rds = url.get_dandiset(client, lazy=False)
assert rds is not None
remote_ds = rds
subpath = Path()
else:
local_ds, subpath = find_dandiset_and_subpath(dandiset)
client = DandiAPIClient.for_dandi_instance(dandi_instance)
stack.enter_context(client)
remote_ds = client.get_dandiset(
local_ds.identifier, version_id="draft", lazy=False
)
Expand Down
Loading