Skip to content

Commit

Permalink
add security property to WNM for access controlled data (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Aug 20, 2024
1 parent 0134f96 commit 1feeba6
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions wis2box-management/wis2box/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,15 @@ def add_token(ctx, metadata_id, path, yes, token):
if create_token(path, token):
click.echo('Token successfully created')

click.echo('Adding access control object to discovery metadata')

oar = Records(DOCKER_API_URL)
if metadata_id is not None:
click.echo('Adding access control object to discovery metadata')

record = oar.collection_item('discovery-metadata', metadata_id)
oar = Records(DOCKER_API_URL)

record['wis2box']['has_auth'] = True
record = oar.collection_item('discovery-metadata', metadata_id)
record['wis2box']['has_auth'] = True

upsert_collection_item('discovery-metadata', record)
upsert_collection_item('discovery-metadata', record)


@click.command()
Expand All @@ -205,15 +205,15 @@ def remove_token(ctx, metadata_id, path, token):
if delete_token(path, token):
click.echo('Token successfully deleted')

click.echo('Removing access control object to discovery metadata')

oar = Records(DOCKER_API_URL)
if metadata_id is not None:
click.echo('Removing access control object to discovery metadata')

record = oar.collection_item('discovery-metadata', metadata_id)
oar = Records(DOCKER_API_URL)

record['wis2box'].pop('has_auth', None)
record = oar.collection_item('discovery-metadata', metadata_id)
record['wis2box'].pop('has_auth', None)

upsert_collection_item('discovery-metadata', record)
upsert_collection_item('discovery-metadata', record)


auth.add_command(add_token)
Expand Down

0 comments on commit 1feeba6

Please sign in to comment.