zenstack icon indicating copy to clipboard operation
zenstack copied to clipboard

Delegated field passed improperly to Prisma

Open platon-ivanov opened this issue 8 months ago • 0 comments

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

platon-ivanov avatar Apr 18 '25 09:04 platon-ivanov