Skip to content

Instantly share code, notes, and snippets.

@raprasad
Last active April 18, 2017 15:04
Show Gist options
  • Select an option

  • Save raprasad/210ed1dc852181db5033aa41c9e24b93 to your computer and use it in GitHub Desktop.

Select an option

Save raprasad/210ed1dc852181db5033aa41c9e24b93 to your computer and use it in GitHub Desktop.
delete layers for restricted files

Use case:

  • A Dataverse user takes an action on a file, such as restricting it, that requires the deletion of any existing WorldMap layers for that file
  • Delete path: Dataverse -> Geoconnect via API -> WorldMap via API -> layer deleted
  • This differs from other cases in that the Geoconnect UI is not used

Geoconnect connection to the Worldmap API

  • Geoconnect holds WorldMap credentials which allow it access to the WorldMap API

To decide: Dataverse connection to Geoconnect API

  • Currently Dataverses installations have access to the Geoconnect API by being listed as "Registered Dataverses" on Geoconnect

  • Dataverse's initial connection to Geoconnect involves passing two items:

    • (1) A Dataverse-created token linked to a specific Datafile id
      • The token has a 30 minute expiration window
    • (2) Callback url to Dataverse that allows retrieval of the file metadata or the file itself.
  • For this delete functionality, the following workflow is one possiblity:

    • (1) Dataverse connects to the Geoconnect "delete" API sending a (A) token and (B) callback url
      • New Geoconnect API endpoint--or existing endpoint with "delete" action
    • (2) Geoconnect uses the token and a callback url to retrieve the Datafile id and Dataverse installation info from Dataverse
      • Update existing Dataverse API endpoint. (add "datafile_is_restricted" attribute)
        • DV retrieves datafile information related to token, makes sure it's restricted, and returns 'ok' with datafile id back to Geoconnect
    • (3) Once Geoconnect receives the datafile id, Geoconnectwill attempt to delete the file form WorldMap
      • Geoconnect attempts deletion with existing WorldMap endpoint
    • (4) The results of the delete attempt will be sent back to to Dataverse using the token
      • Existing Dataverse endpont: Attempt to delete the map layer metadata associated with the datafile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment