gitea icon indicating copy to clipboard operation
gitea copied to clipboard

Can't update team includes_all_repositories setting via API

Open sanderdescamps opened this issue 3 years ago • 2 comments

Gitea Version

1.15.3

Git Version

No response

Operating System

No response

How are you running Gitea?

K8s via Helm

Database

PostgreSQL

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Description

I'm writing a script that automagically configures a new Gitea instance based on a config file. I want to update the includes_all_repositories property on a team object but it doesn't seem to work.

When I run

curl -X 'GET' \
  'https://gitea.example.com/api/v1/teams/20?access_token=e569***2' \
  -H 'accept: application/json'

I get

{
  "id": 20,
  "name": "devops_users",
  "description": "test users",
  "organization": null,
  "includes_all_repositories": true,
  "permission": "write",
  "units": null,
  "can_create_org_repo": true
}

When I change includes_all_repositories via the api

curl -X 'PATCH' \
  'https://gitea.example.com/api/v1/teams/20?access_token=e569***2' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "includes_all_repositories": false,
"name": "devops_users"
}'

I get

{
  "id": 20,
  "name": "devops_users",
  "description": "test users",
  "organization": null,
  "includes_all_repositories": true,
  "permission": "write",
  "units": [
    "repo.code",
    "repo.issues",
    "repo.ext_issues",
    "repo.wiki",
    "repo.pulls",
    "repo.releases",
    "repo.projects",
    "repo.ext_wiki"
  ],
  "can_create_org_repo": true
}

I'm not able to change the includes_all_repositories property via the API. It does work when I do the change manually. but not via the API. Or is there a special procedure for updating the includes_all_repositories setting?

Screenshots

No response

sanderdescamps avatar Dec 09 '21 15:12 sanderdescamps

About Gitea version, did you mean 1.14.1?

lunny avatar Dec 10 '21 02:12 lunny

I'm sorry 4.1.1 is the version of the Helm chart. The Gitea version is 1.15.3

sanderdescamps avatar Dec 10 '21 07:12 sanderdescamps

You must send the permission alongside includes_all_repositories and make sure you are not editing the owners team.

Example:

{
  "includes_all_repositories": true,
  "permission": "read"
}

Or

{
  "includes_all_repositories": true,
  "permission": "admin"
}

yardenshoham avatar May 13 '23 09:05 yardenshoham

We close issues that need feedback from the author if there were no new comments for a month. :tea:

GiteaBot avatar Sep 08 '23 13:09 GiteaBot