Skip to content

Delegated field passed improperly to Prisma #2095

@platon-ivanov

Description

@platon-ivanov

Description and expected behavior
Hello!

When making an access policy like this:

    @@allow('update,read', this.locations?[countryCode in auth().authDirs.articleCountryCodes])

where locations is part of the base delegate model, it adds an unnecessary rule at the end without delegate_aux_entity:

id: true,
 contents: {
    where: {
      AND: [
        {
          lng: "en"
        },
        {
          OR: [
            {
              AND: [
                {
                  OR: [
                    {
                      article: {
                        AND: [
                          {
                            NOT: {
                              delegate_aux_entity: {
...
                              }
                            }
                          },
                          {
                            OR: [
                              {
....
                              },
                              {
                                delegate_aux_entity: {
                                  org: {
                                    members: {
                                      some: {
                                        userId: {
                                          equals: "TFbhuKSoCajZTh1ELdpPF71YJX8nYgf4"
                                        }
                                      }
                                    }
                                  }
                                }
                              },
                         {
                                locations: {
                                  some: {
                                    countryCode: {
                                      in: [
                                        "vn"
                                      ]
                                    }
                                  }
                                }

Environment

  • ZenStack version: 2.13.3
  • Prisma version: 6.4.1
  • Database type: Postgresql

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions