Prevent pushing of patch sets onto invisible patch sets

A previous bug would allow users to push a patch set onto a draft patch
set they cannot see. This commit fixes the bug and adds some tests.

Change-Id: I58a8353f67a47361f6dbd3bf776969130d90a529
This commit is contained in:
Patrick Hiesel
2016-06-15 19:19:32 +02:00
parent 91afae99b8
commit 69ca28943b
4 changed files with 125 additions and 36 deletions

View File

@@ -520,10 +520,16 @@ public abstract class AbstractDaemonTest {
protected PushOneCommit.Result amendChange(String changeId, String ref)
throws Exception {
return amendChange(changeId, ref, admin, testRepo);
}
protected PushOneCommit.Result amendChange(String changeId, String ref,
TestAccount testAccount, TestRepository<?> repo) throws Exception {
Collections.shuffle(RANDOM);
PushOneCommit push =
pushFactory.create(db, admin.getIdent(), testRepo, PushOneCommit.SUBJECT,
PushOneCommit.FILE_NAME, new String(Chars.toArray(RANDOM)), changeId);
pushFactory.create(db, testAccount.getIdent(), repo,
PushOneCommit.SUBJECT, PushOneCommit.FILE_NAME,
new String(Chars.toArray(RANDOM)), changeId);
return push.to(ref);
}