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

Improve error message for users with insufficient rights #13369

Open
nkylstad opened this issue Aug 15, 2024 · 1 comment · May be fixed by #14389 or #14395
Open

Improve error message for users with insufficient rights #13369

nkylstad opened this issue Aug 15, 2024 · 1 comment · May be fixed by #14389 or #14395
Labels
backend frontend kind/chore status/ready-for-dev Status: Used for issues that are ready for development. Has been through grooming. team/studio-core

Comments

@nkylstad
Copy link
Member

nkylstad commented Aug 15, 2024

Description of the bug

On the "create app" page, we only check if the user is a member of a team in the organization. However, a user could be a member of a team for an organization, but still not have the necessary rights to create a new app. This action requires the rights to create a new repo for the organization.

When this happens, the user is allowed to select the organization from the list, type inn the new app name, and click "create". The request returns an error, because the user is unauthorized. The error states:
"An error has occured. If the problem persists, contact us".

This is very inaccurate. A technical error has occured, in that the user does not have access to perform the action in Gitea. But this is a very clear case, we should catch that it happens and display a specific error message explaining what the problem is.
Skjermbilde 2024-08-15 kl  08 51 59

Steps To Reproduce

  1. Log in as a user that is an owner of an organization (or admin)
  2. Create a test team for the organization that grants write access to only a specific repo.
  3. Add a test user to that team - ensure that the test user is not part of any other teams for the organisation. If you create a new user to test this, ensure that you remove that user after completing testing.
  4. Log out, and log in with the test user
  5. Navigate to dashboard, and observe that you can select the org in the dashboard context.
  6. Try to create a new app, and observe that there are no warnings or error messages
  7. Ensure that the org is selected as the owner for the new app
  8. Click "create app"
  9. Observe that you get a generic error message

Additional Information

I do suspect that we might have to do some error handling backend to fix this - we need to check which response we get from the backend endpoint.

Although fixing the error message is a good first step, we should probably take this further.

The user should not be allowed to actually submit the form to create the service if the org is selected and they have insufficient rights to create an app.
They should be shown a warning/error message instead, and the submit button should be disabled. This would avoid confusion, and reduce questions from our users.
We need to check if we can easily verify the rights of the user for the owner that they have specified. To do this we may need to make some changes to the form as well.

@nkylstad nkylstad added kind/bug Used when there is a defect / something is not working as it should. status/triage labels Aug 15, 2024
@nkylstad nkylstad added the status/ready-for-specification Status: Used for issues that are ready for functional decription og detailed design. label Aug 15, 2024
@framitdavid
Copy link
Collaborator

framitdavid commented Aug 21, 2024

Suggestion: implement a validation to verify that the user has access to create repos for org. Inform the user if they do not have the required permissions.

@nkylstad nkylstad added status/ready-for-dev Status: Used for issues that are ready for development. Has been through grooming. and removed status/ready-for-specification Status: Used for issues that are ready for functional decription og detailed design. labels Aug 21, 2024
@nkylstad nkylstad added kind/chore and removed kind/bug Used when there is a defect / something is not working as it should. labels Sep 23, 2024
@framitdavid framitdavid self-assigned this Jan 8, 2025
@framitdavid framitdavid moved this from 📈 Todo to 👷 In Progress in Team Studio Jan 8, 2025
@framitdavid framitdavid linked a pull request Jan 9, 2025 that will close this issue
3 tasks
@framitdavid framitdavid moved this from 👷 In Progress to 🔎 Review in Team Studio Jan 9, 2025
@framitdavid framitdavid linked a pull request Jan 9, 2025 that will close this issue
3 tasks
@framitdavid framitdavid removed their assignment Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend frontend kind/chore status/ready-for-dev Status: Used for issues that are ready for development. Has been through grooming. team/studio-core
Projects
Status: 🔎 Review
2 participants