Skip to content

How to get entire user object? #420

Answered by DanRibbens
jmrkll asked this question in Q&A
Discussion options

You must be logged in to vote

Interesting, you shouldn't have to do anything extra to pass the full user object in an access function. I would try:

  1. Check your database user document to make sure the role is persisted on the user
  2. Logout and log back in
  3. Can you share your access function here? maybe we've overlooking something in how the access function is being called.

If you want to share a repo with me I'll try it out too.

You probably saw in the demo where we have our access function example. https://github.com/payloadcms/payload/blob/master/demo/collections/Admin.ts#L5

const access = ({ req: { user } }) => {
  return checkRole(['admin'], user);
};

With that we call checkRole: https://github.com/payloadcms/payload…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jmrkll
Comment options

Answer selected by denolfe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants