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

Admin UI not fully respecting settings and system roles #2188

Open
tlodge opened this issue May 21, 2023 · 5 comments
Open

Admin UI not fully respecting settings and system roles #2188

tlodge opened this issue May 21, 2023 · 5 comments
Assignees
Labels
status: blocked 🚧 Resolution is blocked by some other issue or external factor type: bug 🐛 Something isn't working

Comments

@tlodge
Copy link

tlodge commented May 21, 2023

Describe the bug
When I set a role for my seller to ensure that they cannot see the settings or system functionality, the settings and system functionality menus are still displayed at the bottom of the admin ui interface. If a user clicks on these entries they are automatically logged out, and if they don't know any better, subsequent attempts to login will fail as the system will attempt to go to the last url, which was the one that logged them out:

Role settings for bob's parts channel:

rolespage

Admin dashboard when logged in to bob's parts:

dashboardpage

To Reproduce
Login as a seller, by default they should not have permssions to view the system and settings menu, but they will be there.

Expected behavior
I would expect that the system and settings menus would not be there at all.

Environment (please complete the following information):

  • @vendure/core version: v2 beta
  • Nodejs version 19.2.0
  • Database (mysql/postgres etc): postgres

Additional context
Add any other context about the problem here.

@tlodge tlodge added the type: bug 🐛 Something isn't working label May 21, 2023
@mpacary
Copy link
Contributor

mpacary commented Jun 12, 2023

I got a very similar behavior with tax rates access:

  • As a superadmin, create a seller account and assign him a role having no access to tax rates but an access to other settings (e.g. ReadTaxCategory enabled)
  • Log in as the seller
  • Go to Settings
  • The "tax rates" section appears (expected: should not). Clicking on it triggers an error "You are not currently authorized to access "taxRates > items > 0 > customerGroup". Either you lack permissions, or your session has expired" & redirects to login page
  • Subsequent login attempts as the same seller fail.

As this seems closely related to the original issue, I only leave a comment instead of opening another one

@zehawki
Copy link

zehawki commented Aug 1, 2023

Along similar lines:

  1. Ive setup a channel admin with only 2 permissions under Channel - Read and Update.

image

  1. Assigned the role:

image

  1. Upon login, I see a blank screen, so thats totally puzzling:

image

  1. Clicking on Settings > Channels shows me all channels, with tokens!! Which is quite wrong.

image

  1. And then it logs out with an error message: You are not currently authorized to access "pendingSearchIndexUpdates". Either you lack permissions, or your session has expired.

@michaelbromley
Copy link
Member

I think one issue that's going on here is that the permissions to read an entity are the same as those used to decide which UI menu items to display. However, sometimes we want to have them different.

@mpacary regarding your specific issue:

The "tax rates" section appears (expected: should not).

I just tried this on the latest master - I added the "ReadTaxCategory" permission to the built-in "Inventory Manager" role (which has CRUD on Catalog), and logging in as an admin with that role only shows the tax category menu item as expected:

image

I'm not sure whether this was something that was fixed in a newer version, but if you are able to reproduce the error from a clean install please detail the exact steps.

@yazfield
Copy link
Contributor

yazfield commented Jun 3, 2024

Had a similar issue with facets, seller can create facets even though the seller role has only "readFacets" permission. I was able to create the facets using a seller account with no errors.

oliverstreissi added a commit to oliverstreissi/vendure that referenced this issue Sep 19, 2024
michaelbromley pushed a commit that referenced this issue Sep 24, 2024
@dlhck dlhck added the status: blocked 🚧 Resolution is blocked by some other issue or external factor label Sep 27, 2024
@dlhck
Copy link
Collaborator

dlhck commented Sep 27, 2024

Done together with #2903

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: blocked 🚧 Resolution is blocked by some other issue or external factor type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants