mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-12 02:24:21 -05:00
Teams shown as "Undefined" after added by API, can'be used as branch protection rule #14630
Closed
opened 2025-11-02 11:18:17 -06:00 by GiteaMirror
·
16 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
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1.3.3
v1.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#14630
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @smoslinux on GitHub (Jun 20, 2025).
Description
After upgrading to 1.24.0, I encountered the following issue:
Creating teams via API:
teamXXX
Undefined
teamXXX-leads
Undefined
These teams are appearing with "Undefined" options under their names. Even though they are added to the project later, I can't select them for any branch rules.
Gitea Version
1.24.0
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
{"id":1252,"name":"xxx-leads","description":"xxx-leads","organization":{"id":6,"name":"projects","full_name":" Projects","email":"","avatar_url":"https://git.xxx.com/avatars/5b873fd5cf586727f01c4e36774f0a99","description":"All xxx development projects","website":"","location":"","visibility":"limited","repo_admin_change_team_access":true,"username":"projects"},"includes_all_repositories":false,"permission":"none","units":["repo.code","repo.issues","repo.ext_issues","repo.wiki","repo.pulls","repo.releases","repo.projects","repo.ext_wiki"],"units_map":{"repo.code":"write","repo.ext_issues":"write","repo.ext_wiki":"write","repo.issues":"write","repo.projects":"write","repo.pulls":"write","repo.releases":"write","repo.wiki":"write"},"can_create_org_repo":false} % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed {"id":1253,"name":"xxx","description":"xxx","organization":{"id":6,"name":"projects","full_name":" Projects","email":"","avatar_url":"https://git.xxx.com/avatars/5b873fd5cf586727f01c4e36774f0a99","description":"All xxx development projects","website":"","location":"","visibility":"limited","repo_admin_change_team_access":true,"username":"projects"},"includes_all_repositories":false,"permission":"none","units":["repo.code","repo.issues","repo.ext_issues","repo.wiki","repo.pulls","repo.releases","repo.projects","repo.ext_wiki"],"units_map":{"repo.code":"write","repo.ext_issues":"write","repo.ext_wiki":"write","repo.issues":"write","repo.projects":"write","repo.pulls":"write","repo.releases":"write","repo.wiki":"write"},"can_create_org_repo":false}
Screenshots
Git Version
2.25.1
Operating System
Ubuntu 24
How are you running Gitea?
Docker container
Database
PostgreSQL
@wxiaoguang commented on GitHub (Jun 23, 2025):
What's the old version?
What's the API call, especially the payload?
On which page? Especially for the screenshot.
The JSON doesn't seem to be "log". API request or API response? Which API?
@ara-arowana commented on GitHub (Jun 23, 2025):
I am encountering the same problem, but not using the API but the Web UI. I can only add a team to a branch protection rule, if I gave it "Administrator Access". Granting "General Access" and ticking "write" for every row in the permission table is not enough.
I guess, either "Code" or "Projects" write access should be enough to add a team to a branch protection rule.
The issue seems to be, that the branch protection looks for the "authorize" field in the team database table. Changing the permission table does not mutate that field, only granting the team Administrator access sets the value to 4.
One can "upgrade" a team by executing
update team set authorize=2 where id=<id>;(2 is sufficient, 3 or 4 work as well).This seems undocumented or buggy to me, but should be an easy fix.
@smoslinux commented on GitHub (Jun 23, 2025):
@wxiaoguang commented on GitHub (Jun 23, 2025):
Which page is it from?
@wxiaoguang commented on GitHub (Jun 23, 2025):
I think I know the problem now, will take a look.
Curious: according to my test, setting it to
1(read) works. But I think it shouldn't be 3 (admin) or 4 (owner)@wxiaoguang commented on GitHub (Jun 23, 2025):
I think this fix will make the result right: Fix querying teams by permission #34827
(A temp workaround can be update the "team.authorize=1" in database .....)
@smoslinux commented on GitHub (Jun 23, 2025):
It was version 1.23.X, not the latest. After I upgraded to the latest version quickly, I had a similar issue like this one haha.
@wxiaoguang commented on GitHub (Jun 23, 2025):
Sorry for the regression ... the "team permission" system has some legacy problems.
By the way, do you know which page is it ? https://github.com/go-gitea/gitea/issues/34793#issuecomment-2997013682 I can't remember or find it ..... I'd like to double-check it to see whether #34827 fixes the "Undefined" problem.
@lunny commented on GitHub (Jun 23, 2025):
I can reproduce it.
@wxiaoguang commented on GitHub (Jun 24, 2025):
@lunny I don't understand how could it be related. I am asking about the UI, the "Undefined" teams list UI https://github.com/go-gitea/gitea/issues/34793#issuecomment-2997013682 . Your comment is just a backend URL which returns JSON response.
@wxiaoguang commented on GitHub (Jun 24, 2025):
OK, I found it, this page. The translation is not right here.
The problem is that in old days, there was only "team permission".
But later, Gitea started to use "team unit permission" and deprecated the "team permission".
Then "team permission" isn't able to be correctly display at some places, will try to fix.
Update: also fixed now:
@smoslinux commented on GitHub (Jun 24, 2025):
Yup. Thanks!
@KarenArzumanyan commented on GitHub (Jun 24, 2025):
"team.authorize=1" - for read acess
"team.authorize=2" - for write acess
Now i fix in Database and wait new version Gieta.
Thanks.
@wxiaoguang commented on GitHub (Jun 24, 2025):
The 1.24 nightly build is ready (it is a stable release and will be 1.24.3. soon), it contains the backport:Fix team permissions (#34827) #34836Update: Oops, not ready yet ... there are other pending PRs ......
To track the nightly build, follow the 1.24 branch: https://github.com/go-gitea/gitea/commits/release/v1.24 , when new commit gets 3/3 success status, then they are ready .....
(sorry for bothering)
@wxiaoguang commented on GitHub (Jun 24, 2025):
Now the new 1.24 containing the fix is completely ready. 🙏
@smoslinux commented on GitHub (Jun 25, 2025):
Upgraded to -nightly and its working. Thanks!