Allow administrator to create repository for any organization (#4368)

This commit is contained in:
Lauris BH authored and Jonas Franz committed 2018-07-05 01:51:02 +02:00
1 parent 4eae810d63
commit 69e2ab1611
2 files changed
+32 -7

No files matched your search

+9 -7
View File
@@ -257,13 +257,15 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
return
}
isOwner, err := org.IsOwnedBy(ctx.User.ID)
if err != nil {
ctx.ServerError("IsOwnedBy", err)
return
} else if !isOwner {
ctx.Error(403, "", "Given user is not owner of organization.")
return
if !ctx.User.IsAdmin {
isOwner, err := org.IsOwnedBy(ctx.User.ID)
if err != nil {
ctx.ServerError("IsOwnedBy", err)
return
} else if !isOwner {
ctx.Error(403, "", "Given user is not owner of organization.")
return
}
}
CreateUserRepo(ctx, org, opt)
}