diff options
author | Unknwon <u@gogs.io> | 2015-11-25 00:55:37 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-11-25 00:55:37 -0500 |
commit | 144663a3cfcdebf16755e4d65e1e50ac91593eca (patch) | |
tree | 0f77ec18aa7300ae1ce8785f846867918f292b78 /routers | |
parent | ba92f4687eae4a1f37a272c09e5aac919b069485 (diff) | |
download | gitea-144663a3cfcdebf16755e4d65e1e50ac91593eca.tar.gz gitea-144663a3cfcdebf16755e4d65e1e50ac91593eca.zip |
allow admin to migrate for any user/org
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/routers/api/v1/repo.go b/routers/api/v1/repo.go index b4da4c6ff4..234673a996 100644 --- a/routers/api/v1/repo.go +++ b/routers/api/v1/repo.go @@ -189,7 +189,8 @@ func CreateOrgRepo(ctx *middleware.Context, opt api.CreateRepoOption) { func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) { ctxUser := ctx.User - // Not equal means current user is an organization. + // Not equal means context user is an organization, + // or is another user/organization if current user is admin. if form.Uid != ctxUser.Id { org, err := models.GetUserByID(form.Uid) if err != nil { @@ -208,7 +209,7 @@ func MigrateRepo(ctx *middleware.Context, form auth.MigrateRepoForm) { return } - if ctxUser.IsOrganization() { + if ctxUser.IsOrganization() && !ctx.User.IsAdmin { // Check ownership of organization. if !ctxUser.IsOwnedBy(ctx.User.Id) { ctx.APIError(403, "", "Given user is not owner of organization.") |