Closed benventive closed 1 year ago
Hi @benventive. Thanks so much for taking the time to dig through the code and report this bug.
I'll take some time on the weekend to spin up exact versions of what you're running and look into it. There is a lot of change in alpha10, and it looks like I missed something so I'll check it.
It doesn't look like there is any code that will have fixed this in rc1, so I'll check it there too. I keep forgetting to test this stuff as a non-admin. Sorry!
One other thing that might be interesting, is whether the same issue happens if the REST API is installed, and one edits the webhook from the Build Config page. In that instance the REST API is used, and it uses a different validator (I think)
Thanks @benventive I was able to reproduce this on the main edit page, but the issue does not appear on the REST API. I am testing on tcWebHooks 1.2.0-rc1 and TeamCity 2022.10.1
Bugfix released @benventive
https://github.com/tcplugins/tcWebHooks/releases/tag/v1.2.0-rc2
Now both the REST API and the UI use the same logic for checking the permissions. Unfortunately not the same code, but at the logic is now consistent.
Expected Behavior
When editing a webhook configuration with the rights to edit a project, we should be able to save it properly.
Current Behavior
When editing a webhook configuration with a user that is not a System Administrator, an error shows up indicating that the user has no write permission on the project. When doing this as a System Administrator, this works perfectly.
Steps to Reproduce (for bugs)
Using a user with the "Edit Project" permission but who is not part of the System Administrators
Notice the following message appearing:
I went digging through the code and it seems to be coming from the recently added validator.
I tried commenting out the check for the permission on the project and it works as expected. I'm not familiar with debugging plugins so I couldn't go further than that. Hope this helps!
Thanks for the great work
Your Environment
Example Configuration (xml)