better fork permission check

This commit is contained in:
Unknwon committed 2015-08-08 17:24:10 +08:00
1 parent 9db4acc62e
commit e3bdfd51ff
3 files changed
+15

No files matched your search

+6
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) {