Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

ausent id on selecting a particular user via admin

default discord avatar
.hawk_e2 years ago
1

Hey



I configured a policy to allow users to select their own User object based on 'id', but when I try to access it via admin the request arrives without the

id

property...



admin/collections/users/:id -> fails, id is undefined


api/users/:id -> works fine



the guard:


// src/collections/User.ts
const User = {
// ...
  access: {
    read: ({ req, id }) => req.user?.id === id
  }
}


I fixed it returning a query constraint filtering the current user when user is not admin.

    Star on GitHub

    Star

    Chat on Discord

    Discord

    online

    Can't find what you're looking for?

    Get dedicated engineering support directly from the Payload team.