Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

or not working properly in some access callbacks #8224

Closed
mattiaz9 opened this issue Sep 15, 2024 · 2 comments
Closed

or not working properly in some access callbacks #8224

mattiaz9 opened this issue Sep 15, 2024 · 2 comments
Assignees

Comments

@mattiaz9
Copy link

Link to reproduction

No response

Environment Info

Binaries:
  Node: 20.12.2
  npm: 10.5.0
  Yarn: N/A
  pnpm: 9.10.0
Relevant Packages:
  payload: 3.0.0-beta.104
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:04 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 12

Describe the Bug

Returning an or statement from the access callback is always true when used for the update, create and delete accesses.
The exact same callback used for the read access seems to work fine.

Reproduction Steps

Example access that should always be false:

export const falseAccess: Access = (args) => {
  return {
    or: [
      {
        id: {
          equals: -1,
        },
      },
      {
        id: {
          equals: -2,
        },
      },
    ],
  }
}

Example collections:

export const Posts: CollectionConfig = {
  slug: "posts",
  access: {
    create: falseAccess, // ❌ ACCESS IS GRANTED
    delete: falseAccess, // ❌ ACCESS IS GRANTED
    read: falseAccess, //  ✅ ACCESS NOT GRANTED
    update: falseAccess, // ❌ ACCESS IS GRANTED
  },
  ...
}

Adapters and Plugins

No response

@mattiaz9 mattiaz9 added status: needs-triage Possible bug which hasn't been reproduced yet v3 labels Sep 15, 2024
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Oct 16, 2024
JarrodMFlesch added a commit that referenced this issue Oct 16, 2024
Fixes #8224

Fixes an issue with PG `where` filters not being respected when
generating doc policies/permissions by utilizing the combineQueries
function in getEntityPolicies function.
Copy link
Contributor

🚀 This is included in version v3.0.0-beta.116

@denolfe denolfe closed this as completed Oct 24, 2024
Copy link
Contributor

This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants