Pyramid-style SQLAlchemy / SQL help for filtering the rights of hierarchical ACLs

I am working on a repo for crawling in SQL. I hope the document, the training style, is the best way to do this. And hopefully provide an additional Pyramid library to give people a starting point. hence https://github.com/pauleveritt/pyramid_sqltraversal - it has 6 Sphinx-docs sections.

But I will get some tough, weird SQLAlchemy questions. I am currently working on filtering permissions in standard SQLAlchemy queries. I made a commitment that this is only for PostgreSQL 9.4+, so I will use JSONB to store the ACL. I do not want every row ACL to be evaluated in Python, as this could mean tens of thousands of requests in a request. So I need some SQL to allocate the ACE in the ACL.

Here is my strategy entry: https://github.com/pauleveritt/pyramid_sqltraversal/blob/master/docs/filtered_queries/index.rst

Here is my placeholder code for the expression in the hybrid method:

https://github.com/pauleveritt/pyramid_sqltraversal/blob/master/docs/filtered_queries/mysite/models/node.py#L115

The following is an example of its use. My first questions are:

  • Is a hybrid method an expression of a suitable approach?

  • Are there any constructs for sqlalchemy.sql to highlight the sequence, and if so, what will it look like?

I need to map the ACE in the ACL if any element in the handlers is passed to the ACL directors, and if the allowed permission matches the ACL permission. Bonus for immediate recovery upon first approval by ACE.

Later I will ask questions about combining this with a recursive CTE for hierarchies, passing the ACL of the class / class to the generated SQL, etc.

+5
source share

Source: https://habr.com/ru/post/1234204/


All Articles