Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix owners cannot create organization repos bug #20841

Merged
merged 5 commits into from
Aug 18, 2022

Conversation

lunny
Copy link
Member

@lunny lunny commented Aug 18, 2022

Fix #20643, owners always can create repositories whatever given value.

If you encountered this problem, please upgrade Gitea and update the owner team and then owner team's permission will come back.

@lunny lunny added type/bug skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. backport/v1.17 labels Aug 18, 2022
@lunny lunny added this to the 1.18.0 milestone Aug 18, 2022
@lunny lunny marked this pull request as ready for review August 18, 2022 02:03
Copy link
Contributor

@Gusted Gusted left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit otherwise L gtm

routers/api/v1/org/team.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 18, 2022
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 18, 2022
@lunny lunny requested a review from silverwind August 18, 2022 07:11
Comment on lines +419 to +421
t.CanCreateOrgRepo = form.CanCreateOrgRepo
} else {
t.CanCreateOrgRepo = true
Copy link
Member

@delvh delvh Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, to save a line, you can do

t.CanCreateOrgRepo = t.IsOwnerTeam()
if !t.CanCreateOrgRepo {
...
t.CanCreateOrgRepo = form.CanCreateOrgRepo

above

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Aug 18, 2022
@lafriks lafriks merged commit 999392f into go-gitea:main Aug 18, 2022
@zeripath
Copy link
Contributor

Please send backport

zeripath pushed a commit to zeripath/gitea that referenced this pull request Aug 18, 2022
Backport go-gitea#20841

* Fix owners cannot create organization repos bug

* Fix api

* Update routers/api/v1/org/team.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>
techknowlogick pushed a commit that referenced this pull request Aug 18, 2022
Backport #20841

* Fix owners cannot create organization repos bug

* Fix api

* Update routers/api/v1/org/team.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Aug 19, 2022
* giteaofficial/main:
  Fix create repository page's help text (go-gitea#20810)
  In PushMirrorsIterate and MirrorsIterate if limit is negative do not set it (go-gitea#20837)
  Disable doctor logging on panic (go-gitea#20847)
  Remove calls to load Mirrors in user.Dashboard (go-gitea#20855)
  switch to node18 for snapcraft
  Prevent 500 is head repo does not have PullRequest unit in IsUserAllowedToUpdate (go-gitea#20839)
  Fix owners cannot create organization repos bug (go-gitea#20841)
@lunny lunny deleted the lunny/fix_owners_create_bug branch August 19, 2022 03:54
@zeripath zeripath added the backport/done All backports for this PR have been created label Aug 21, 2022
vsysoev pushed a commit to IntegraSDL/gitea that referenced this pull request Aug 28, 2022
* Fix owners cannot create organization repos bug

* Fix api

* Update routers/api/v1/org/team.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>

Co-authored-by: Gusted <williamzijl7@hotmail.com>
@melroy89
Copy link
Contributor

melroy89 commented Feb 2, 2023

I would expect this is now fixed in the latest rootless Docker image of Gitea?

gitea/gitea:latest-rootless (with Digest: sha256:580316b839ebe1c6f85b881fc1ea34ad44ae608adbc9f636f21abc0e3d65db3b).

As org owner still get 403 Forbidden error when pressing the "New Repository" button on Org level. The request is a GET call on: /repo/create?org=<org_id>.

@lunny
Copy link
Member Author

lunny commented Feb 3, 2023

If you encountered this problem, please upgrade Gitea and update the owner team and then owner team's permission will come back.

@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to create repository as owner for a specific organisation
7 participants