Skip to content

[typeorm] Add support for CTEs in authorizers #418

@dberardo-com

Description

@dberardo-com

great library. however i have some complex authorization logic that require deep tables lookups to figure out what to authorize and what not.

specifically the ID of the object to be autorized should fall in a list of IDs which contains potentially thousands of records, which is not possible to return as a Filter in a custom autorize method.

Currently i am using CTEs in typeorm to create a sort of subregion from which the actual query is executed and this works fine.

To implement something like this with this library i can either:

  • add a virtual attribute to all my tables ("authorized") and then add a filter like { authroized: { eq: true} }
  • OR use CTEs based on the userContext attributes

i believe the second is the most elegant solution but how to deal with this ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions