Skip to content

feat: progress on the sample todo app#2

Merged
ymc9 merged 1 commit into
devfrom
feat/sample-todo-wip
Sep 26, 2022
Merged

feat: progress on the sample todo app#2
ymc9 merged 1 commit into
devfrom
feat/sample-todo-wip

Conversation

@ymc9

@ymc9 ymc9 commented Sep 26, 2022

Copy link
Copy Markdown
Member

No description provided.

@ymc9 ymc9 merged commit 70f518f into dev Sep 26, 2022
@ymc9 ymc9 deleted the feat/sample-todo-wip branch October 25, 2022 13:48
@ymc9 ymc9 mentioned this pull request Feb 3, 2024
ymc9 added a commit that referenced this pull request Feb 10, 2026
ymc9 added a commit that referenced this pull request Feb 10, 2026
* feat: audit policy collection aliases

provides a means to alias collections in @@Allow collections by extending the ast
this allows for utilizing collections inside of @@Allow like:

```
memberships?[m,
    auth().memberships?[
        tenantId == m.tenantId ...
    ]
  ]
```

* fix: code review comments + syntax fixes

* refactor: extract collection predicate binding to its own language construct (#2)

- adjusted language processing chain accordingly
- fixed several issues in policy transformer/evaluator
- more test cases

* addressing PR comments

---------

Co-authored-by: Yiming Cao <yiming@whimslab.io>
Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com>
hechang27-sprt added a commit to hechang27-sprt/zenstack that referenced this pull request Jun 26, 2026
…t array columns in subqueries

Fix zenstackhq#1: In _member() isThis branch, pass modelOrType: context.thisType
to transformRelationAccess() so that this.relation.field correctly
resolves relation fields against the @@Allow model (thisType) rather
than the collection predicate's model (modelOrType).

Fix zenstackhq#2: In _member() when the innermost field of a subquery selection
is an array type AND the provider is PostgreSQL, wrap the column with
unnest() so that ANY(subquery) receives scalar rows instead of array
rows. Other providers (SQLite, MySQL) leave the column as-is since
they store arrays differently (JSON) and would need different handling.
hechang27-sprt added a commit to hechang27-sprt/zenstack that referenced this pull request Jun 26, 2026
…field in operator

Two PG-specific tests covering the fixes:
- Fix zenstackhq#1: this.relation.field resolves against @@Allow model in
  collection predicates (e.g. auth().permissions?[p, p.clearance >=
  this.author.level])
- Fix zenstackhq#2: this.scalarField in this.relation.arrayField generates
  unnest() for PG subqueries (e.g. this.id in this.group.visibleDocIds)
hechang27-sprt added a commit to hechang27-sprt/zenstack that referenced this pull request Jun 26, 2026
…field in operator

Two PG-specific tests covering the fixes:
- Fix zenstackhq#1: this.relation.field resolves against @@Allow model in
  collection predicates (e.g. auth().permissions?[p, p.clearance >=
  this.author.level])
- Fix zenstackhq#2: this.scalarField in this.relation.arrayField generates
  unnest() for PG subqueries (e.g. this.id in this.group.visibleDocIds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant