amplify-category-api icon indicating copy to clipboard operation
amplify-category-api copied to clipboard

Dynamic group authorization with prefix option for multi tenant support

Open biller-aivy opened this issue 1 year ago • 4 comments

Is this feature request related to a new or existing Amplify category?

api

Is this related to another service?

AppSync

Describe the feature you'd like to request

https://docs.amplify.aws/javascript/tools/cli-legacy/auth-directive/#dynamic-group-authorization

It would be nice if we could add a prefix per @auth rule.

type Post @model @auth(rules: [{ allow: groups, groupsField: "groups", prefixForGroupsFieldStrings: "reader__", operations: [...] }, { allow: groups, groupsField: "groups", prefixForGroupsFieldStrings: "updater__", operations: [...]}]) {
  id: ID!
  title: String
  groups: [String]
}

So at this point I could add the tenantID to groups and the reader__ und updater__ has different operations but with only one group array entry.

Describe the solution you'd like

add prefixForGroupsFieldStrings to @auth option.

Describe alternatives you've considered


Additional context

No response

Is this something that you'd be interested in working on?

  • [X] 👋 I may be able to implement this feature request

Would this feature include a breaking change?

  • [X] ⚠️ This feature might incur a breaking change

biller-aivy avatar Feb 29 '24 00:02 biller-aivy