Search code examples
restgerrit

How can I get the gerrit projects which access have the specific group by gerrit rest api?


How can I get the gerrit projects which have the specific group by gerrit rest api? I need get all the projects,that these projects access have the specific group? For example, project A has a read access in reference refs/*, and admin has grant group named xxx read access,then project A has group xxx. My problem is how can I get project A by giving group xxx as parameter through gerrit rest api?


Solution

  • The following command will list all projects on which access rights for xxxxx group are directly assigned. Projects which only inherit access rights for this group are not listed.

    curl --user USER:PASS --request GET https://GERRIT-SERVER/a/projects/?has-acl-for=xxxxx | sed 1d | jq --raw-output '.[].id'
    

    More info in the Gerrit documentation here.