bug: Non-admins can not create repos for organizations #7637

Closed
opened 2025-11-02 07:32:02 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @MGChecker on GitHub (Jul 29, 2021).

If a non-admin tries to create a repository inside an organization they own, they get an error their repository limit would be reached. In my configuration the default repository limit for users is 0.

Specifically, the following error is shown:
form.reach_limit_of_creation%!(EXTRA int=0)

Since organizations are similar to users, that probably means that they have an internal repository limit as well which is incorrectly applied.

  • Gitea version (or commit ref): 1.14.5
  • Operating system: Debian Buster
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Log gist:
Originally created by @MGChecker on GitHub (Jul 29, 2021). If a non-admin tries to create a repository inside an organization they own, they get an error their repository limit would be reached. In my configuration the default repository limit for users is 0. Specifically, the following error is shown: form.reach_limit_of_creation%!(EXTRA int=0) Since organizations are similar to users, that probably means that they have an internal repository limit as well which is incorrectly applied. - Gitea version (or commit ref): 1.14.5 - Operating system: Debian Buster - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - Log gist:
GiteaMirror added the type/proposalissue/not-a-bug labels 2025-11-02 07:32:03 -06:00
Author
Owner

@noerw commented on GitHub (Aug 23, 2021):

A discussion about this was started here https://github.com/go-gitea/gitea/pull/15924#issuecomment-846193189, but we had no concluding decision.

It's unclear what the best behaviour for this is, but I agree that it can be confusing.
Changing this is a major breaking change, unless we can come up with a mechanism that easily transitions instances that depend on this behaviour as it currently is.


A quick proposal: introduce a new instance-wide or per-user setting MAX_CREATION_LIMIT_ORGS, that

  • defaults to true, thus keeping current behaviour when unset
  • when false, ignores repo counter for creation of repos in orgs, and relies on the repo limit of the organization instead.

Gitea has enough config options already, so there should be enough people wanting this feature to justify adding this complexity..

@noerw commented on GitHub (Aug 23, 2021): A discussion about this was started here https://github.com/go-gitea/gitea/pull/15924#issuecomment-846193189, but we had no concluding decision. It's unclear what the best behaviour for this is, but I agree that it can be confusing. Changing this is a major breaking change, unless we can come up with a mechanism that easily transitions instances that depend on this behaviour as it currently is. --- A quick proposal: introduce a new instance-wide or per-user setting `MAX_CREATION_LIMIT_ORGS`, that - defaults to `true`, thus keeping current behaviour when unset - when `false`, ignores repo counter for creation of repos in orgs, and relies on the repo limit of the organization instead. Gitea has enough config options already, so there should be enough people wanting this feature to justify adding this complexity..
Author
Owner

@MGChecker commented on GitHub (Aug 23, 2021):

I think this is unnecessarily complicated.

In contrast, I would propose not using the limit of the organization to check whether a repository may be created, but the limit of the user creating the repository at this moment. This is basically possible already by creating the repo in your own user namespace and then transfering it to the organization.

@MGChecker commented on GitHub (Aug 23, 2021): I think this is unnecessarily complicated. In contrast, I would propose not using the limit of the organization to check whether a repository may be created, but the limit of the user creating the repository at this moment. This is basically possible already by creating the repo in your own user namespace and then transfering it to the organization.
Author
Owner

@noerw commented on GitHub (Aug 23, 2021):

I would propose not using the limit of the organization to check whether a repository may be created, but the limit of the user creating the repository at this moment.

@MGChecker this is how it works currently. One of us is misunderstanding something here, not sure who 😅

@noerw commented on GitHub (Aug 23, 2021): > I would propose not using the limit of the organization to check whether a repository may be created, but the limit of the user creating the repository at this moment. @MGChecker this is how it works currently. One of us is misunderstanding something here, not sure who :sweat_smile:
Author
Owner

@MGChecker commented on GitHub (Aug 23, 2021):

I agree that this is how it should work, but it does not in my setup.

Even though the user repository limit is larger than 0, they may still not create a repository inside the organization. The form is shown, but on submit the error message mentioned above is shown.

@MGChecker commented on GitHub (Aug 23, 2021): I agree that this is how it should work, but it does not in my setup. Even though the user repository limit is larger than 0, they may still not create a repository inside the organization. The form is shown, but on submit the error message mentioned above is shown.
Author
Owner

@MGChecker commented on GitHub (Aug 28, 2021):

I think this is a misunderstanding and this is actually a bug.

@MGChecker commented on GitHub (Aug 28, 2021): I think this is a misunderstanding and this is actually a bug.
Author
Owner

@brianrobt commented on GitHub (Feb 20, 2025):

Even though the user repository limit is larger than 0, they may still not create a repository inside the organization. The form is shown, but on submit the error message mentioned above is shown.

@MGChecker, maybe I am misunderstanding, but in your original post, isn't the default user repo limit in your setup 0?

I just tried to replicate this in the latest version (v1.23.4) and couldn't replicate the issue:

  • User repo limit set to 0
  • Organization repo limit set to -1

Result was that the user (organization owner) was not allowed to create an organization repo, which I would expect.

I could possibly see a use case where you'd want a user to be able to create repos in an organization but not in any other public space on the server, but I'm not sure if that's the issue being pointed out here.

This issue is 4 years old, though. Maybe I'm completely off base.

@brianrobt commented on GitHub (Feb 20, 2025): > Even though the user repository limit is larger than 0, they may still not create a repository inside the organization. The form is shown, but on submit the error message mentioned above is shown. @MGChecker, maybe I am misunderstanding, but in your original post, isn't the default user repo limit in your setup 0? I just tried to replicate this in the latest version (v1.23.4) and couldn't replicate the issue: - User repo limit set to 0 - Organization repo limit set to -1 Result was that the user (organization owner) was not allowed to create an organization repo, which I would expect. I could possibly see a use case where you'd want a user to be able to create repos in an organization but not in any other public space on the server, but I'm not sure if that's the issue being pointed out here. This issue is 4 years old, though. Maybe I'm completely off base.
Author
Owner

@wxiaoguang commented on GitHub (Apr 8, 2025):

It should have been fixed in 1.23.7

@wxiaoguang commented on GitHub (Apr 8, 2025): It should have been fixed in 1.23.7
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7637