New issue
Advanced search Search tips

Issue 10106 link

Starred by 1 user

Issue metadata

Status: Released
Owner: ----
Closed: Dec 4

Sign in to add a comment

Can't update project rights with REST ACCESS API

Reported by, Nov 28

Issue description

Affected Version: 2.15.2

What steps will reproduce the problem?
1. With a Gerrit Administrator account and his HTTP password
2. With a test project 'test-project' with some group permissions 
2. Get permissions on this project:
   $ curl -v --user 'XXXX:YYYY' 'https://gerrit/a/projects/test-project/access'
3. Create a file test.json to remove an existing permission (see attached file)
4. Change permissions:
   $ curl -v --user 'YYYY:XXXX' --header "Content-Type: application/json" -d @test.json 'https://gerrit/a/projects/test-project/access' 

What is the expected output?
HTTP 200 with updated permissions.

What do you see instead?
HTTP 400 Invalid application/json in request

Please provide any additional information below.
- And empty JSON file ({}), or JSON file with verb only but no permissions change, return existing permission (expected behavior)
- This test is close to example in documentation:
- This test use 'remove', but 'add' fail too when I test it.
- Attached file 'test.json' contains action sent to REST API.
- Attached file 'result-GET.txt' contains result of GET request.
- Attached file 'result-POST.txt' contains result of POST request.

2.3 KB View Download
923 bytes View Download
Expected test.json (not empty one ...)
193 bytes View Download
I am not aware of PolyGerrit use of the REST API.

With this information, I run on PolyGerrit page "https://gerrit/admin/projects/internship-projects,access" and found a "This is currently in read only mode. To modify content, go to the Old UI".

Trying with current 2.16, this page is available.

So this REST API is documented on 2.15, but not used by PollyGerrit. So, should we close this report with a workaroung "Update to 2.16" ?

Doing some more tests, new json file 'test-2.16-ok.json' is working on 2.16. This test was built by comparing documentation example with real calls made by PollyGerrit.

JSON format must be without list (remove [] after action), look like an outdated example in documentation ?

About 2.15.2, this test fail again but with another error after JSON data mapping:
ERROR : Error in POST /a/projects/internship-projects/access
java.lang.NullPointerException: action

For us, moving to 2.16 and fix documentation is a good option.
159 bytes View Download
Components: -PolyGerrit
Status: ChangeUnderReview (was: New)
Oh, that's annoying.  Thanks for tracking this down and fixing the documentation.

Labels: FixedIn-2.15.8
Status: Submitted (was: ChangeUnderReview)
Project Member

Comment 7 by, Dec 21

Labels: FixedIn-2.16.2
Status: Released (was: Submitted)
Labels: FixedIn-2.16.3

Sign in to add a comment