Closed Loosie94 closed 9 months ago
There's no logic built into the frontend for checking based on roles.
What data users who are logged into the portal have access to is controlled by the permissions within the Directus instance.
Which fields get fetched for the user is controlled in the nuxt.config.ts
file.
The user value gets set here in the useDirectusAuth.ts composable.
But if I login to the demo site - I can see the role value for the user in the Nuxt payload.
So it could be potentially be a permissions issue within your Directus instance that's not returning the role for that users within that particular role.
Hi @bryantgillespie , It seems it was a permission issue after all. Been doing a lot of WordPress projects before doing more Directus, so I think I still have to get used to this haha. Thanks again! 👍
Glad to hear it was a fairly easy fix 👍
Hi guys,
I am working on the AgencyOS portal area. Now I and what to add some logic to some modals and pages, based on the logged-in user (role). I know I can get the logged-in user with the function:
const { user } = useDirectusAuth();
. but I am running into a few problems with this.No "role" key and value in response This makes is hard to see if the user is a admin or a client for example.
Permissions cannot be checked without a role? Because no role is set in the user object, it makes it hard check for the correct permissions. I know middleware uses this check page permissions, but is not working for modals/slide-outs right?
Or should I use another way to check this? Thanks in advance!
René