netlify/git-gateway

Feature request: Ability to pass allowed routes for monorepository sites

phil-lgr opened this issue · 1 comments

- Do you want to request a feature or report a bug?

Feature

- What is the current behavior?

Netlify CMS allow us to pass the following options to git-gateway:

backend:
  name: git-gateway
  accept_roles: #optional - accepts all users if left out
    - admin
    - editor

now from netlify's identity settings the repository is set up:

image

So that means that users from that site have access to the following scopes:

 /repos/:owner/:name/git/
 /repos/:owner/:name/contents/
 /repos/:owner/:name/pulls/
 /repos/:owner/:name/branches/

- What is the expected behavior?

Mono-repository are increasingly popular and people want to have multiple sites under one git repository.

for example, it's very common to have multiple site under packages

packages/
 - site1
 - site2

I would like to be able to pass specific paths to git-gateway in order to restrict a user from site1 to only content of site1, something like:

 /repos/:owner/:name/git/
 /repos/:owner/:name/contents/packages/site1 # restrict to site1 dir only
 /repos/:owner/:name/pulls/
 /repos/:owner/:name/branches/

Maybe something like:

# config.yml for site 1
backend:
  name: git-gateway
  accept_roles: 
    - admin
    - editor
  accept_content_routes: # <------ restrict content access to those paths only
    - packages/site1

# config.yml for site 2
backend:
  name: git-gateway
  accept_roles: 
    - admin
    - editor
  accept_content_routes: # <------ restrict content access to those paths only
    - packages/site2

and I just want to say that git-gateway is absolutely fantastic with Netlify CMS, I'm a happy Netlify customer because of that! 👍 I'm opening this to see if it's something doable