-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check that repositories can only be migrated to own user or organizations #4366
Changes from 1 commit
61e56dd
e0ffe0b
0cf6c33
d9db242
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -306,6 +306,11 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) { | |
return | ||
} | ||
|
||
if !ctxUser.IsOrganization() && ctx.User.ID != ctxUser.ID { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will disallow an administrator to migrate all users from site A to site B 😐 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would wrap this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bkcsoft done |
||
ctx.Error(403, "", "Given user is not an organization.") | ||
return | ||
} | ||
|
||
if ctxUser.IsOrganization() && !ctx.User.IsAdmin { | ||
// Check ownership of organization. | ||
isOwner, err := ctxUser.IsOwnedBy(ctx.User.ID) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add case when user tries to migrate to org that isn't one that user belongs to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@flufmonster done