Make PublishAction require ownership & visiblity

Previously, PublishAction allowed reviewers of the draft change to
publish.  Correct functionality should only allow the change owner
to publish.  In addition the change visibility has to be checked,
because a change is not visible to the change owner if the project
state is HIDDEN.

In addition, the behaviour in PublishAction was inconsistent with
the behaviour in ReviewCommand.  This change makes both perform the
same check before publishing.

Change-Id: Ic306ab6a0dd49f23073f198c9dc8e9eaa90ecccc
This commit is contained in:
Conley Owens
2012-02-02 10:44:25 -08:00
parent 1dd862521f
commit bb8f3b66a2
6 changed files with 19 additions and 5 deletions

View File

@@ -28,6 +28,7 @@ public class ChangeDetail {
protected AccountInfoCache accounts;
protected boolean allowsAnonymous;
protected boolean canAbandon;
protected boolean canPublish;
protected boolean canRestore;
protected boolean canRevert;
protected boolean canDeleteDraft;
@@ -71,6 +72,14 @@ public class ChangeDetail {
canAbandon = a;
}
public boolean canPublish() {
return canPublish;
}
public void setCanPublish(final boolean a) {
canPublish = a;
}
public boolean canRestore() {
return canRestore;
}