Giter Club home page Giter Club logo

Comments (4)

benbart avatar benbart commented on August 27, 2024

a use case:
Say a user has directories in their bucket based on date:

  • bucketname/202001
  • bucketname/202002
  • bucketname/202003
  • bucketname/...
  • bucketname/202008
    and they want the latest month to be private, but previous data be public, the bucketmap could be granular enough to have bucketname/202008 as a private bucket.

This of course would require updating the bucketmap periodically, so perhaps there is a better solution

from thin-egress-app.

bbuechler avatar bbuechler commented on August 27, 2024

IDEA:

Allow bucket & Prefix in PUBLIC and PRIVATE bucket blocks:

MAP:
   general-browse: browse-bucket
   productX: productX
   
PUBLIC_BUCKETS: 
   general-browse: "General browse Imagery"
   productX/browse:  "ProductX Browse Imagery"

PRIVATE_BUCKETS: 
   productX/2020/12: 
    - science_team

Where:

  • request to https://<TEA>/productX/<object> require basic auth
  • request to https://<TEA>/productX/browse/<object> are public
  • request to https://<TEA>/productX/2020/12/<object> require membership in science_team

pub_bucket = check_public_bucket(bucket, b_map)

That can be achieved by updating check_public_bucket() and check_private_bucket() to accept an optional object_uri, and updating this basic bucket check to be a little more sophisticated:

Below is a few examples/sanity check of how this would work in code:

def bucket_prefix_match(bucket_check, bucket_map, object=""):
   if bucket_check == bucket_map.split('/')[0] and object.startswith("/".join(bucket_map.split('/')[1:])):
      print("Matched")
   else:
      print("Not Matched")

# No Object Specified Bucket Match
bucket_prefix_match(bucket_check='bucket1', \
                    bucket_map='bucket1')

# Deep match      https://<TEA>/bucket1/prefix1/prefix2/path/object
bucket_prefix_match(bucket_check='bucket1', \
                    bucket_map='bucket1/prefix1/prefix2', \
                    object='prefix1/prefix2/path/object')

# Shallow Match https://<TEA>/bucket1/prefix1/path/object
bucket_prefix_match(bucket_check='bucket1', \
                    bucket_map='bucket1/prefix1', \
                    object='prefix1/path/object')

# Shallow Match, unnecessary trailing slash    https://<TEA>/bucket1/prefix1/path/object
bucket_prefix_match(bucket_check='bucket1', \
                    bucket_map='bucket1/prefix1/', \
                    object='prefix1/path/object')

# Simple match  https://<TEA>/bucket1/object
bucket_prefix_match(bucket_check='bucket1', \
                    bucket_map='bucket1', \
                    object='object')

# Bucket Mismatch https://<TEA>/bucket2/prefix1/path/object
bucket_prefix_match(bucket_check='bucket2', \
                    bucket_map='bucket1/prefix1', \
                    object='prefix1/path/object')

# Bucket Match, Prefix Mismatch    https://<TEA>/bucket1/prefix2/path/object
bucket_prefix_match(bucket_check='bucket1', \
                    bucket_map='bucket1/prefix1', \
                    object='prefix2/path/object')

# No Object Specified Bucket Mis-Match
bucket_prefix_match(bucket_check='bucket1', \
                    bucket_map='bucket2/prefix1/prefix2')

# No Object Specified Prefix mis-Match
bucket_prefix_match(bucket_check='bucket1', \
                    bucket_map='bucket1/prefix1/prefix2')

from thin-egress-app.

bbuechler avatar bbuechler commented on August 27, 2024

Added to rain-api-code w/ asfadmin/rain-api-core#100

from thin-egress-app.

bbuechler avatar bbuechler commented on August 27, 2024

Released in https://github.com/asfadmin/thin-egress-app/releases/tag/tea-build.102

from thin-egress-app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.