summaryrefslogtreecommitdiffstats
path: root/routers/web/repo
diff options
context:
space:
mode:
authorqwerty287 <80460567+qwerty287@users.noreply.github.com>2021-11-25 06:03:03 +0100
committerGitHub <noreply@github.com>2021-11-25 13:03:03 +0800
commite0f81b4ef445948d33abcd5c67b6d0786b07de68 (patch)
treed496e7eae50d45dd442bbc4d93b6d22a4fe23b30 /routers/web/repo
parent4b4997c73e63effef932d9647ad0eb204eb39973 (diff)
downloadgitea-e0f81b4ef445948d33abcd5c67b6d0786b07de68.tar.gz
gitea-e0f81b4ef445948d33abcd5c67b6d0786b07de68.zip
Allow forks to org if you can create repos (#17783)
Diffstat (limited to 'routers/web/repo')
-rw-r--r--routers/web/repo/pull.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go
index 06aa86206d..19e757dad8 100644
--- a/routers/web/repo/pull.go
+++ b/routers/web/repo/pull.go
@@ -113,9 +113,9 @@ func getForkRepository(ctx *context.Context) *models.Repository {
ctx.Data["ForkRepo"] = forkRepo
- ownedOrgs, err := models.GetOwnedOrgsByUserID(ctx.User.ID)
+ ownedOrgs, err := models.GetOrgsCanCreateRepoByUserID(ctx.User.ID)
if err != nil {
- ctx.ServerError("GetOwnedOrgsByUserID", err)
+ ctx.ServerError("GetOrgsCanCreateRepoByUserID", err)
return nil
}
var orgs []*models.Organization
@@ -216,13 +216,13 @@ func ForkPost(ctx *context.Context) {
}
}
- // Check ownership of organization.
+ // Check if user is allowed to create repo's on the organization.
if ctxUser.IsOrganization() {
- isOwner, err := models.OrgFromUser(ctxUser).IsOwnedBy(ctx.User.ID)
+ isAllowedToFork, err := models.OrgFromUser(ctxUser).CanCreateOrgRepo(ctx.User.ID)
if err != nil {
- ctx.ServerError("IsOwnedBy", err)
+ ctx.ServerError("CanCreateOrgRepo", err)
return
- } else if !isOwner {
+ } else if !isAllowedToFork {
ctx.Error(http.StatusForbidden)
return
}