Add "Show Inherited Rights" checkbox to Project Access Screen
The new "Show Inherited Rights" checkbox on the Project Access Screen makes it possible to hide any inherited access rights and only display access rights specific to the current project. Change-Id: Id93254d7f139f7ce53fc92c535a05ba60f72284e
This commit is contained in:
@@ -48,6 +48,7 @@ public interface AdminConstants extends Constants {
|
|||||||
String headingCreateGroup();
|
String headingCreateGroup();
|
||||||
String headingAccessRights();
|
String headingAccessRights();
|
||||||
String headingAgreements();
|
String headingAgreements();
|
||||||
|
String headingShowInherited();
|
||||||
|
|
||||||
String projectSubmitType_FAST_FORWARD_ONLY();
|
String projectSubmitType_FAST_FORWARD_ONLY();
|
||||||
String projectSubmitType_MERGE_ALWAYS();
|
String projectSubmitType_MERGE_ALWAYS();
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ headingExternalGroup = Selected External Group
|
|||||||
headingCreateGroup = Create New Group
|
headingCreateGroup = Create New Group
|
||||||
headingAccessRights = Access Rights
|
headingAccessRights = Access Rights
|
||||||
headingAgreements = Contributor Agreements
|
headingAgreements = Contributor Agreements
|
||||||
|
headingShowInherited = Show Inherited Rights
|
||||||
|
|
||||||
projectSubmitType_FAST_FORWARD_ONLY = Fast Forward Only
|
projectSubmitType_FAST_FORWARD_ONLY = Fast Forward Only
|
||||||
projectSubmitType_MERGE_IF_NECESSARY = Merge If Necessary
|
projectSubmitType_MERGE_IF_NECESSARY = Merge If Necessary
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
|||||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
import com.google.gwt.user.client.ui.Button;
|
import com.google.gwt.user.client.ui.Button;
|
||||||
import com.google.gwt.user.client.ui.CheckBox;
|
import com.google.gwt.user.client.ui.CheckBox;
|
||||||
|
import com.google.gwt.user.client.ui.Grid;
|
||||||
import com.google.gwt.user.client.ui.Panel;
|
import com.google.gwt.user.client.ui.Panel;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
|
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
|
||||||
@@ -82,11 +83,24 @@ public class ProjectAccessScreen extends ProjectScreen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initParent() {
|
private void initParent() {
|
||||||
parentPanel = new VerticalPanel();
|
|
||||||
parentPanel.add(new SmallHeading(Util.C.headingParentProjectName()));
|
|
||||||
|
|
||||||
parentName = new Hyperlink("", "");
|
parentName = new Hyperlink("", "");
|
||||||
parentPanel.add(parentName);
|
|
||||||
|
final CheckBox show = new CheckBox();
|
||||||
|
show.setChecked(true);
|
||||||
|
show.addClickHandler(new ClickHandler() {
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
rights.showInherited(show.isChecked());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Grid g = new Grid(2, 3);
|
||||||
|
g.setWidget(0, 0, new SmallHeading(Util.C.headingParentProjectName()));
|
||||||
|
g.setWidget(1, 0, parentName);
|
||||||
|
g.setWidget(1, 1, show);
|
||||||
|
g.setText(1, 2, Util.C.headingShowInherited());
|
||||||
|
|
||||||
|
parentPanel = new VerticalPanel();
|
||||||
|
parentPanel.add(g);
|
||||||
add(parentPanel);
|
add(parentPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +163,7 @@ public class ProjectAccessScreen extends ProjectScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RightsTable extends FancyFlexTable<RefRight> {
|
private class RightsTable extends FancyFlexTable<InheritedRefRight> {
|
||||||
boolean canDelete;
|
boolean canDelete;
|
||||||
Map<AccountGroup.Id, AccountGroup> groups;
|
Map<AccountGroup.Id, AccountGroup> groups;
|
||||||
|
|
||||||
@@ -180,7 +194,7 @@ public class ProjectAccessScreen extends ProjectScreen {
|
|||||||
HashSet<RefRight.Key> getRefRightIdsChecked() {
|
HashSet<RefRight.Key> getRefRightIdsChecked() {
|
||||||
final HashSet<RefRight.Key> refRightIds = new HashSet<RefRight.Key>();
|
final HashSet<RefRight.Key> refRightIds = new HashSet<RefRight.Key>();
|
||||||
for (int row = 1; row < table.getRowCount(); row++) {
|
for (int row = 1; row < table.getRowCount(); row++) {
|
||||||
RefRight r = getRowItem(row);
|
RefRight r = getRowItem(row).getRight();
|
||||||
if (r != null && table.getWidget(row, 1) instanceof CheckBox
|
if (r != null && table.getWidget(row, 1) instanceof CheckBox
|
||||||
&& ((CheckBox) table.getWidget(row, 1)).getValue()) {
|
&& ((CheckBox) table.getWidget(row, 1)).getValue()) {
|
||||||
refRightIds.add(r.getKey());
|
refRightIds.add(r.getKey());
|
||||||
@@ -204,9 +218,10 @@ public class ProjectAccessScreen extends ProjectScreen {
|
|||||||
populate(row, r);
|
populate(row, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onOpenRow(final int row) {
|
protected void onOpenRow(final int row) {
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
RefRight right = getRowItem(row);
|
RefRight right = getRowItem(row).getRight();
|
||||||
rightEditor.load(right, groups.get(right.getAccountGroupId()));
|
rightEditor.load(right, groups.get(right.getAccountGroupId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -271,7 +286,15 @@ public class ProjectAccessScreen extends ProjectScreen {
|
|||||||
fmt.addStyleName(row, 6, Gerrit.RESOURCES.css()
|
fmt.addStyleName(row, 6, Gerrit.RESOURCES.css()
|
||||||
.projectAdminApprovalCategoryRangeLine());
|
.projectAdminApprovalCategoryRangeLine());
|
||||||
|
|
||||||
setRowItem(row, right);
|
setRowItem(row, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showInherited(boolean visible) {
|
||||||
|
for (int r = 0; r < table.getRowCount(); r++) {
|
||||||
|
if (getRowItem(r) != null && getRowItem(r).isInherited()) {
|
||||||
|
table.getRowFormatter().setVisible(r, visible);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void formatValue(final SafeHtmlBuilder m, final short v,
|
private void formatValue(final SafeHtmlBuilder m, final short v,
|
||||||
|
|||||||
Reference in New Issue
Block a user