ProjectTagsScreen: Base visibility on the create refs/tags/* permission

Before this change, the Tags creation form fields were visible also if
either refs/* or refs/head/* was allowed for Create Reference. This fix
limits that visibility to a create refs/tags/* permission solely, as per
current documentation anyway. isOwnerAnyRef() still also makes the panel
visible, overriding potentially missing ref creation permissions.

Create Annotated Tag is still also required for the user to be able to
use the optional Annotation field. In this case, the created tag is no
longer lightweight but becomes annotated. Both kinds of tags are still
supported through such a single Tags creation panel or form, thus the
need to allow both permissions even if aiming for annotated tags only.
(Command line does not have that design limitation indeed.)

Bug: Issue 9689
Change-Id: I7e3d11a62ad1e49575e6ef743138158efa831e6a
This commit is contained in:
Marco Miller
2018-09-06 17:05:04 -04:00
parent 818264876a
commit 5e0ea9c89b
7 changed files with 58 additions and 14 deletions

View File

@@ -19,6 +19,8 @@ import com.google.gwt.core.client.JavaScriptObject;
public class ProjectAccessInfo extends JavaScriptObject {
public final native boolean canAddRefs() /*-{ return this.can_add ? true : false; }-*/;
public final native boolean canAddTagRefs() /*-{ return this.can_add_tags ? true : false; }-*/;
public final native boolean isOwner() /*-{ return this.is_owner ? true : false; }-*/;
public final native boolean configVisible() /*-{ return this.config_visible ? true : false; }-*/;

View File

@@ -94,7 +94,7 @@ public class ProjectTagsScreen extends PaginatedProjectScreen {
new GerritCallback<ProjectAccessInfo>() {
@Override
public void onSuccess(ProjectAccessInfo result) {
addPanel.setVisible(result.canAddRefs());
addPanel.setVisible(result.canAddTagRefs());
}
});
query = new Query(match).start(start).run();