modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java | 2 - modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java | 17 ++++++++-- modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Delete_16_Disabled.png |binary modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Deploy_16_Disabled.png |binary modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Revert_16_Disabled.png |binary 5 files changed, 15 insertions(+), 4 deletions(-)
New commits: commit 515cd7359131215bee54396c2043766cdf9e6ff7 Author: John Mazzitelli mazz@redhat.com Date: Thu Dec 16 23:18:13 2010 -0500
disable buttons when a user doesn't have perms
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java index c8f9261..fd0bbe7 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/BundleTopView.java @@ -120,7 +120,7 @@ public class BundleTopView extends LocatableHLayout implements BookmarkableView } else { if (!viewPath.getNext().equals(currentNextPath)) { currentNextPath = viewPath.getNext(); - bundleView = new BundleView(extendLocatorId("Bundle")); + bundleView = new BundleView(extendLocatorId("Bundle"), permissions); setContent(bundleView); bundleView.renderView(viewPath.next()); } else { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java index 1d64b7a..a94b133 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/list/BundleView.java @@ -19,6 +19,7 @@ package org.rhq.enterprise.gui.coregui.client.bundle.list;
import java.util.HashSet; +import java.util.Set;
import com.google.gwt.user.client.History; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -36,6 +37,7 @@ import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.tab.Tab; import com.smartgwt.client.widgets.tab.TabSet;
+import org.rhq.core.domain.authz.Permission; import org.rhq.core.domain.bundle.Bundle; import org.rhq.core.domain.criteria.BundleCriteria; import org.rhq.core.domain.tagging.Tag; @@ -79,8 +81,11 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
private Bundle bundle;
- public BundleView(String locatorId) { + private final boolean canManageBundles; + + public BundleView(String locatorId, Set<Permission> perms) { super(locatorId); + this.canManageBundles = (perms != null) ? perms.contains(Permission.MANAGE_BUNDLE) : false; setWidth100(); setHeight100(); setPadding(10); @@ -176,7 +181,9 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
private CanvasItem getTagItem() {
- TagEditorView tagEditor = new TagEditorView(form.extendLocatorId("TagEditor"), bundle.getTags(), false, + boolean readOnly = !this.canManageBundles; + + TagEditorView tagEditor = new TagEditorView(form.extendLocatorId("TagEditor"), bundle.getTags(), readOnly, new TagsChangedCallback() { public void tagsChanged(HashSet<Tag> tags) { GWTServiceLookup.getTagService().updateBundleTags(bundleBeingViewed, tags, @@ -259,6 +266,11 @@ public class BundleView extends LocatableVLayout implements BookmarkableView { } });
+ if (!canManageBundles) { + deleteButton.setDisabled(true); + deployButton.setDisabled(true); + } + layout.addMember(deleteButton); layout.addMember(deployButton);
@@ -271,7 +283,6 @@ public class BundleView extends LocatableVLayout implements BookmarkableView {
public void renderView(final ViewPath viewPath) { int bundleId = Integer.parseInt(viewPath.getCurrent().getPath()); - final ViewId viewId = viewPath.getCurrent();
viewPath.next(); if (viewPath.isEnd() || viewPath.isNextEnd()) { diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Delete_16_Disabled.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Delete_16_Disabled.png new file mode 100644 index 0000000..b8b8468 Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Delete_16_Disabled.png differ diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Deploy_16_Disabled.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Deploy_16_Disabled.png new file mode 100644 index 0000000..fcbd9c4 Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Deploy_16_Disabled.png differ diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Revert_16_Disabled.png b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Revert_16_Disabled.png new file mode 100644 index 0000000..b851d16 Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/subsystems/bundle/BundleAction_Revert_16_Disabled.png differ