Also check if user can upload in order to restore

The thought behind this is that a restoration is an upload, and
the workaround for not restoring would be to make a fresh upload
(which we don't want).

The main use case is the scenario in which a branch has been
closed to further improvements and changes shouldn't be restored.

Rather than introduce a new permission for this, keep the abandon
conditions so someone can undo an accidental abandon.

Change-Id: I31fa95c1325ac932f1fc2c90abf3a5a42c1b24db
This commit is contained in:
Chad Horohoe
2012-06-27 19:20:34 -04:00
parent a00d091f39
commit 35ced0a374
2 changed files with 5 additions and 1 deletions

View File

@@ -452,6 +452,9 @@ This category controls whether users are allowed to abandon changes
to projects in Gerrit. It can give permission to abandon a specific
change to a given ref.
This also grants the permission to restore a change if the change
can be uploaded.
[[category_create]]
Create reference
~~~~~~~~~~~~~~~~

View File

@@ -211,7 +211,8 @@ public class ChangeControl {
/** Can this user restore this change? */
public boolean canRestore() {
return canAbandon(); // Anyone who can abandon the change can restore it back
return canAbandon() // Anyone who can abandon the change can restore it back
&& getRefControl().canUpload(); // as long as you can upload too
}
/** All value ranges of any allowed label permission. */