Skip to content

Commit 99bbd99

Browse files
committed
Enforce that only admins can copy a repo to another user
1 parent c5f8c7d commit 99bbd99

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

routers/api/v1/repo/repo.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,11 @@ func Generate(ctx *context.APIContext) {
387387
return
388388
}
389389

390+
if !ctx.User.IsAdmin && !ctxUser.IsOrganization() {
391+
ctx.Error(http.StatusForbidden, "", "Only admin can generate repository for other user.")
392+
return
393+
}
394+
390395
if !ctx.User.IsAdmin {
391396
canCreate, err := ctxUser.CanCreateOrgRepo(ctx.User.ID)
392397
if err != nil {

0 commit comments

Comments
 (0)