1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

better fork permission check

This commit is contained in:
Unknwon
2015-08-08 17:24:10 +08:00
parent 9db4acc62e
commit e3bdfd51ff
3 changed files with 15 additions and 0 deletions

View File

@@ -78,6 +78,12 @@ func ForkPost(ctx *middleware.Context, form auth.CreateRepoForm) {
return
}
repo, has := models.HasForkedRepo(ctxUser.Id, forkRepo.Id)
if has {
ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + repo.Name)
return
}
// Check ownership of organization.
if ctxUser.IsOrganization() {
if !ctxUser.IsOwnedBy(ctx.User.Id) {