#Client-side: Get user collection/global permissions

7 messages · Page 1 of 1 (latest)

paper raven
#

Hello!

I don't think I found this anywhere, or maybe I'm blind. I need to retrieve the user's access permissions. For example, I wanna know if a user has "create" access on a particular collection.

I browsed the payload repo but I only found server-side utility functions heavily embedded into the working architecture of payload, and none that allows retrieving collection permissions client-side.

My usecase is rather simple: I have the payload SUPER admin UI, and the user dashboard. I want to keep the payload dashboard to administrators only, but the user dashboard is a custom-made UI which has dashboards and many more things, as well as some listviews and editviews for a subset of payload collections (I call "exposed" collections). Since this is a custom UI, it falls outside of the payload context. The problem I am facing is that I cannot know which collection a user has access, or whether they have read, create, update, or delete permissions.

Is there a way to retrieve such access information client-side outside of payload context? Thank you very much 🙏 I have an ikling that I could use the permissions returned by payload.auth? Am I on the right track?

stuck flume
#

Hi, try api/access.

paper raven
#

Ooooooh! I missed this! Thank you 🙏

stuck flume
#

You welcome)

lavish mistBOT
#

You do not have permission to mark this thread as solved. Only thread creators, contributors and payload team members can mark a thread as solved.

paper raven
#

Ah! 😂 Sorry sorry 🙏 My bad