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

[ENG-5430] GV get_addon feature flipping #211

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

Johnetordoff
Copy link
Owner

@Johnetordoff Johnetordoff commented Apr 29, 2024

Purpose

Allows OSF legacy features to sync with GV addon system.

Changes

  • adds request to GV to sync OSF addons

QA Notes

Please make verification statements inspired by your code and what your code touches.

  • Verify
  • Verify

What are the areas of risk?

Any concerns/considerations/questions that development raised?

Documentation

Side Effects

Ticket

https://openscience.atlassian.net/browse/ENG-5430

@Johnetordoff Johnetordoff changed the title Gv files api endpoint [ENG-5430] GV get_addon feature flipping Apr 30, 2024
…penScience/osf.io into gv-files-api-endpoint

* 'gv-files-api-endpoint' of https://github.com/CenterForOpenScience/osf.io:
  WIP format kwargs

# Conflicts:
#	addons/box/models.py
#	osf/models/mixins.py
for key, value in data_from_gv['user_settings'].items():
setattr(settings_obj, key, value)

settings_obj.save()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to save, but do call full_clean to ensure everything is valid


if waffle.flag_is_active(request, features.ENABLE_GV):
resp = requests.get(
f'{settings.DOMAIN}v1/resource-references/{self.uri}/authorized_storage_accounts/'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get all configured storage addons for a node (two calls):
v1/resource_references/?filter[resource_uri]={self.uri}
->data[0][relationships][configured_storage_addons][links][self]

To get details on a specific configured addon (name == id)
v1/configured-storage-addons/{name}/

settings_obj = UserSettings.objects.get(owner=owner)
except ObjectDoesNotExist:
return None # or handle the case where the settings object does not exist
settings_obj = UserSettings.objects.get_or_create(owner=owner)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drive by: this belongs in NodeSettings, the UserSettings rarely contain anything consequential for us (pretty much just a super janky dict mapping nodes to external accounts that we've replaced with actual database relationships on the gv side)

@Johnetordoff Johnetordoff force-pushed the gv-files-api-endpoint branch 2 times, most recently from b552211 to 401d8c9 Compare May 1, 2024 12:53
@Johnetordoff Johnetordoff force-pushed the gv-files-api-endpoint branch 10 times, most recently from 38dfed4 to 5fdb5b7 Compare May 3, 2024 17:13
@Johnetordoff Johnetordoff force-pushed the gv-files-api-endpoint branch 2 times, most recently from 541a161 to ba28a9e Compare May 6, 2024 17:00
@Johnetordoff Johnetordoff force-pushed the gv-files-api-endpoint branch 4 times, most recently from 606604c to 37b3d86 Compare May 7, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants