summaryrefslogtreecommitdiff
path: root/java/management
diff options
context:
space:
mode:
authorRobert Gemmell <robbie@apache.org>2011-07-21 10:57:07 +0000
committerRobert Gemmell <robbie@apache.org>2011-07-21 10:57:07 +0000
commit628d6f54ef8d413915f02e324ea9e7c691b9e388 (patch)
treee669be47a33d23534be32bf5fec54534e95b0e25 /java/management
parent831edb0cb38965f03507ccb89bf0b2d098382446 (diff)
downloadqpid-python-628d6f54ef8d413915f02e324ea9e7c691b9e388.tar.gz
QPID-3255: update management console to remove redundant user management functionality, move legacy methods from UserManagement to an extension interface
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1149109 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/management')
-rw-r--r--java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java103
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/LegacySupportingUserManagement.java132
-rw-r--r--java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java199
3 files changed, 283 insertions, 151 deletions
diff --git a/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java b/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java
index 194bd83752..1a82c58ee9 100644
--- a/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java
+++ b/java/management/common/src/main/java/org/apache/qpid/management/common/mbeans/UserManagement.java
@@ -53,25 +53,6 @@ public interface UserManagement
//********** Operations *****************//
/**
- * set password for user.
- *
- * Since Qpid JMX API 1.2 this operation expects plain text passwords to be provided. Prior to this, MD5 hashed passwords were supplied.
- *
- * @deprecated since Qpid JMX API 1.7
- *
- * @param username The username for which the password is to be set
- * @param password The password for the user
- *
- * @return The result of the operation
- */
- @Deprecated
- @MBeanOperation(name = "setPassword", description = "Set password for user.",
- impact = MBeanOperationInfo.ACTION)
- boolean setPassword(@MBeanOperationParameter(name = "username", description = "Username")String username,
- //NOTE: parameter name was changed to 'passwd' in Qpid JMX API 1.7 to protect against older, incompatible management clients
- @MBeanOperationParameter(name = "passwd", description = "Password")char[] password);
-
- /**
* Set password for a given user.
*
* @since Qpid JMX API 1.7
@@ -85,85 +66,11 @@ public interface UserManagement
impact = MBeanOperationInfo.ACTION)
boolean setPassword(@MBeanOperationParameter(name = "username", description = "Username")String username,
@MBeanOperationParameter(name = "password", description = "Password")String password);
-
- /**
- * Set rights for users with given details.
- * Since Qpid JMX API 2.3 all invocations will cause an exception to be thrown
- * as access rights can no longer be maintain via this interface.
- *
- * @deprecated since Qpid JMX API 2.3
- *
- * @param username The username to create
- * @param read The set of permission to give the new user
- * @param write The set of permission to give the new user
- * @param admin The set of permission to give the new user
- *
- * @return The result of the operation
- */
- @Deprecated
- @MBeanOperation(name = "setRights", description = "Set access rights for user.",
- impact = MBeanOperationInfo.ACTION)
- boolean setRights(@MBeanOperationParameter(name = "username", description = "Username")String username,
- @MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
- @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
- @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
-
- /**
- * Create users with given details.
- * Since Qpid JMX API 2.3 if the user passes true for parameters read, write, or admin, a
- * exception will be thrown as access rights can no longer be maintain via this interface.
- *
- * Since Qpid JMX API 1.2 this operation expects plain text passwords to be provided. Prior to this, MD5 hashed passwords were supplied.
- *
- * @deprecated since Qpid JMX API 1.7
- *
- * @param username The username to create
- * @param password The password for the user
- * @param read The set of permission to give the new user
- * @param write The set of permission to give the new user
- * @param admin The set of permission to give the new user
- *
- * @return true if the user was created successfully, or false otherwise
- */
- @Deprecated
- @MBeanOperation(name = "createUser", description = "Create new user from system.",
- impact = MBeanOperationInfo.ACTION)
- boolean createUser(@MBeanOperationParameter(name = "username", description = "Username")String username,
- //NOTE: parameter name was changed to 'passwd' in Qpid JMX API 1.7 to protect against older, incompatible management clients
- @MBeanOperationParameter(name = "passwd", description = "Password")char[] password,
- @MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
- @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
- @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
-
- /**
- * Create users with given details.
- * Since Qpid JMX API 2.3 if the user passes true for parameters read, write, or admin, a
- * exception will be thrown as access rights can no longer be maintain via this interface.
- *
- * @deprecated since Qpid JMX API 2.3
- * @since Qpid JMX API 1.7
- *
- * @param username The username to create
- * @param password The password for the user
- * @param read The set of permission to give the new user
- * @param write The set of permission to give the new user
- * @param admin The set of permission to give the new user
- *
- * @return true if the user was created successfully, or false otherwise
- */
- @Deprecated
- @MBeanOperation(name = "createUser", description = "Create a new user.",
- impact = MBeanOperationInfo.ACTION)
- boolean createUser(@MBeanOperationParameter(name = "username", description = "Username")String username,
- @MBeanOperationParameter(name = "password", description = "Password")String password,
- @MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
- @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
- @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
/**
* Create users with given details.
*
- * @since Qpid JMX API 2.3
+ * @since Qpid JMX API 2.3 / 1.12
*
* @param username The username to create
* @param password The password for the user
@@ -188,9 +95,11 @@ public interface UserManagement
/**
- * Reload the date from disk
+ * Reload the user data
*
- * Since Qpid JMX API 1.2 this operation reloads the password and authorisation files. Prior to this, only the authorisation file was reloaded.
+ * Since Qpid JMX API 2.3 / 1.12 this operation reloads only the password data.
+ * Since Qpid JMX API 1.2 but prior to 2.3 / 1.12 this operation reloads the password and authorisation files.
+ * Prior to 1.2, only the authorisation file was reloaded.
*
* @return The result of the operation
*/
@@ -201,7 +110,7 @@ public interface UserManagement
/**
* View users returns all the users that are currently available to the system.
*
- * Since Qpid JMX API 2.3 the items that corresponded to read, write and admin flags
+ * Since Qpid JMX API 2.3 / 1.12 the items that corresponded to read, write and admin flags
* are deprecated and always return false.
*
* @return a table of users data (Username, read, write, admin)
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/LegacySupportingUserManagement.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/LegacySupportingUserManagement.java
new file mode 100644
index 0000000000..0fc94a5972
--- /dev/null
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/LegacySupportingUserManagement.java
@@ -0,0 +1,132 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.management.ui.views.users;
+
+import javax.management.MBeanOperationInfo;
+
+import org.apache.qpid.management.common.mbeans.UserManagement;
+import org.apache.qpid.management.common.mbeans.annotations.MBeanOperation;
+import org.apache.qpid.management.common.mbeans.annotations.MBeanOperationParameter;
+
+/**
+ * UserManagement interface extension to provide the method signatures
+ * for old UserManagement methods no longer supported by the broker.
+ *
+ * This interface is used only for the creation of MBean proxy objects
+ * within the management console, for backwards compatibility with
+ * functionality in older broker versions.
+ */
+public interface LegacySupportingUserManagement extends UserManagement
+{
+ /**
+ * set password for user.
+ *
+ * Since Qpid JMX API 1.2 this operation expects plain text passwords to be provided. Prior to this, MD5 hashed passwords were supplied.
+ *
+ * @deprecated since Qpid JMX API 1.7
+ *
+ * @param username The username for which the password is to be set
+ * @param password The password for the user
+ *
+ * @return The result of the operation
+ */
+ @Deprecated
+ @MBeanOperation(name = "setPassword", description = "Set password for user.",
+ impact = MBeanOperationInfo.ACTION)
+ boolean setPassword(@MBeanOperationParameter(name = "username", description = "Username")String username,
+ //NOTE: parameter name was changed to 'passwd' in Qpid JMX API 1.7 to protect against older, incompatible management clients
+ @MBeanOperationParameter(name = "passwd", description = "Password")char[] password);
+
+ /**
+ * Set rights for users with given details.
+ * Since Qpid JMX API 2.3 all invocations will cause an exception to be thrown
+ * as access rights can no longer be maintain via this interface.
+ *
+ * @deprecated since Qpid JMX API 2.3 / 1.12
+ *
+ * @param username The username to create
+ * @param read The set of permission to give the new user
+ * @param write The set of permission to give the new user
+ * @param admin The set of permission to give the new user
+ *
+ * @return The result of the operation
+ */
+ @Deprecated
+ @MBeanOperation(name = "setRights", description = "Set access rights for user.",
+ impact = MBeanOperationInfo.ACTION)
+ boolean setRights(@MBeanOperationParameter(name = "username", description = "Username")String username,
+ @MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
+ @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
+ @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
+
+ /**
+ * Create users with given details.
+ * Since Qpid JMX API 2.3 if the user passes true for parameters read, write, or admin, a
+ * exception will be thrown as access rights can no longer be maintain via this interface.
+ *
+ * Since Qpid JMX API 1.2 this operation expects plain text passwords to be provided. Prior to this, MD5 hashed passwords were supplied.
+ *
+ * @deprecated since Qpid JMX API 1.7
+ *
+ * @param username The username to create
+ * @param password The password for the user
+ * @param read The set of permission to give the new user
+ * @param write The set of permission to give the new user
+ * @param admin The set of permission to give the new user
+ *
+ * @return true if the user was created successfully, or false otherwise
+ */
+ @Deprecated
+ @MBeanOperation(name = "createUser", description = "Create new user from system.",
+ impact = MBeanOperationInfo.ACTION)
+ boolean createUser(@MBeanOperationParameter(name = "username", description = "Username")String username,
+ //NOTE: parameter name was changed to 'passwd' in Qpid JMX API 1.7 to protect against older, incompatible management clients
+ @MBeanOperationParameter(name = "passwd", description = "Password")char[] password,
+ @MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
+ @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
+ @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
+
+ /**
+ * Create users with given details.
+ * Since Qpid JMX API 2.3 if the user passes true for parameters read, write, or admin, a
+ * exception will be thrown as access rights can no longer be maintain via this interface.
+ *
+ * @deprecated since Qpid JMX API 2.3 / 1.12
+ * @since Qpid JMX API 1.7
+ *
+ * @param username The username to create
+ * @param password The password for the user
+ * @param read The set of permission to give the new user
+ * @param write The set of permission to give the new user
+ * @param admin The set of permission to give the new user
+ *
+ * @return true if the user was created successfully, or false otherwise
+ */
+ @Deprecated
+ @MBeanOperation(name = "createUser", description = "Create a new user.",
+ impact = MBeanOperationInfo.ACTION)
+ boolean createUser(@MBeanOperationParameter(name = "username", description = "Username")String username,
+ @MBeanOperationParameter(name = "password", description = "Password")String password,
+ @MBeanOperationParameter(name = "read", description = "Administration read")boolean read,
+ @MBeanOperationParameter(name = "readAndWrite", description = "Administration write")boolean write,
+ @MBeanOperationParameter(name = "admin", description = "Administration rights")boolean admin);
+
+}
diff --git a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java
index fdcc25d337..2c540bf982 100644
--- a/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java
+++ b/java/management/eclipse-plugin/src/main/java/org/apache/qpid/management/ui/views/users/UserManagementTabControl.java
@@ -37,7 +37,6 @@ import javax.management.openmbean.TabularDataSupport;
import org.apache.qpid.management.ui.ApiVersion;
import org.apache.qpid.management.ui.ApplicationRegistry;
import org.apache.qpid.management.ui.ManagedBean;
-import org.apache.qpid.management.common.mbeans.UserManagement;
import org.apache.qpid.management.ui.jmx.JMXManagedObject;
import org.apache.qpid.management.ui.jmx.MBeanUtility;
import org.apache.qpid.management.ui.views.TabControl;
@@ -83,7 +82,7 @@ public class UserManagementTabControl extends TabControl
private TableViewer _tableViewer = null;
private TabularDataSupport _userDetails = null;
- private UserManagement _ummb;
+ private LegacySupportingUserManagement _ummb;
private ApiVersion _ApiVersion;
public UserManagementTabControl(TabFolder tabFolder, JMXManagedObject mbean, MBeanServerConnection mbsc)
@@ -91,9 +90,9 @@ public class UserManagementTabControl extends TabControl
super(tabFolder);
_mbean = mbean;
_ApiVersion = ApplicationRegistry.getServerRegistry(mbean).getManagementApiVersion();
- _ummb = (UserManagement)
+ _ummb = (LegacySupportingUserManagement)
MBeanServerInvocationHandler.newProxyInstance(mbsc, mbean.getObjectName(),
- UserManagement.class, false);
+ LegacySupportingUserManagement.class, false);
_toolkit = new FormToolkit(_tabFolder.getDisplay());
_form = _toolkit.createScrolledForm(_tabFolder);
_form.getBody().setLayout(new GridLayout());
@@ -171,6 +170,13 @@ public class UserManagementTabControl extends TabControl
String[] titles = { "Username", "JMX Management Rights" };
int[] bounds = { 310, 200 };
+ if(!settingManagementRightsSupported())
+ {
+ //Since Qpid JMX API 2.3 / 1.12 only Username is used
+ titles = new String[]{ "Username"};
+ bounds = new int[]{ 310 };
+ }
+
for (int i = 0; i < titles.length; i++)
{
final int index = i;
@@ -214,7 +220,16 @@ public class UserManagementTabControl extends TabControl
Composite buttonsComposite = _toolkit.createComposite(tableComposite);
gridData = new GridData(SWT.FILL, SWT.TOP, false, false);
- gridData.heightHint = 165;
+ if(!settingManagementRightsSupported())
+ {
+ //The 'Set Rights' button is not shown from Qpid JMX API 2.3 / 1.12
+ //onward, provide less space
+ gridData.heightHint = 135;
+ }
+ else
+ {
+ gridData.heightHint = 165;
+ }
buttonsComposite.setLayoutData(gridData);
buttonsComposite.setLayout(new GridLayout());
@@ -292,14 +307,14 @@ public class UserManagementTabControl extends TabControl
if (returnValue == InputDialog.OK)
{
- char[] password = id.getValue().toCharArray();
+ char[] passwordArray = id.getValue().toCharArray();
// Qpid JMX API 1.1 and below expects the password to be sent as a hashed value.
if (_ApiVersion.lessThanOrEqualTo(1,1))
{
try
{
- password = ViewUtility.getHash(id.getValue());
+ passwordArray = ViewUtility.getHash(id.getValue());
}
catch (Exception hashException)
{
@@ -312,7 +327,18 @@ public class UserManagementTabControl extends TabControl
try
{
- boolean result = _ummb.setPassword(user, password);
+ boolean result;
+
+ //For Qpid JMX API >=1.7 use String based method instead of older char[] based method.
+ if(_ApiVersion.greaterThanOrEqualTo(1, 7))
+ {
+ result = _ummb.setPassword(user, id.getValue());
+ }
+ else
+ {
+ result = _ummb.setPassword(user, passwordArray);
+ }
+
ViewUtility.operationResultFeedback(result, "Updated user password", "Failed to update user password");
}
catch(Exception e2)
@@ -324,25 +350,34 @@ public class UserManagementTabControl extends TabControl
}
}
});
-
- final Button setRightsButton = _toolkit.createButton(buttonsComposite, "Set Rights ...", SWT.PUSH);
- gridData = new GridData(SWT.CENTER, SWT.BOTTOM, false, false);
- gridData.widthHint = 125;
- setRightsButton.setLayoutData(gridData);
- setRightsButton.setEnabled(false);
- setRightsButton.addSelectionListener(new SelectionAdapter()
+
+ final Button setRightsButton;
+ if(!settingManagementRightsSupported())
{
- public void widgetSelected(SelectionEvent e)
+ //The 'Set Rights' button is not used from Qpid JMX API 2.3 / 1.12 onward
+ setRightsButton = null;
+ }
+ else
+ {
+ setRightsButton = _toolkit.createButton(buttonsComposite, "Set Rights ...", SWT.PUSH);
+ gridData = new GridData(SWT.CENTER, SWT.BOTTOM, false, false);
+ gridData.widthHint = 125;
+ setRightsButton.setLayoutData(gridData);
+ setRightsButton.setEnabled(false);
+ setRightsButton.addSelectionListener(new SelectionAdapter()
{
- int selectionIndex = _table.getSelectionIndex();
-
- if (selectionIndex != -1)
+ public void widgetSelected(SelectionEvent e)
{
- setRights(setRightsButton.getShell());
+ int selectionIndex = _table.getSelectionIndex();
+
+ if (selectionIndex != -1)
+ {
+ setRights(setRightsButton.getShell());
+ }
}
- }
- });
-
+ });
+ }
+
_tableViewer.addSelectionChangedListener(new ISelectionChangedListener(){
public void selectionChanged(SelectionChangedEvent evt)
{
@@ -351,14 +386,20 @@ public class UserManagementTabControl extends TabControl
if (selectionIndex == -1)
{
deleteUsersButton.setEnabled(false);
- setRightsButton.setEnabled(false);
setPasswordButton.setEnabled(false);
+ if(setRightsButton != null)
+ {
+ setRightsButton.setEnabled(false);
+ }
return;
}
else
{
deleteUsersButton.setEnabled(true);
- setRightsButton.setEnabled(true);
+ if(setRightsButton != null)
+ {
+ setRightsButton.setEnabled(true);
+ }
}
if (_table.getSelectionCount() > 1)
@@ -386,11 +427,17 @@ public class UserManagementTabControl extends TabControl
//this only reloaded the JMX rights file before Qpid JMX API 1.2
_toolkit.createLabel(miscGroup, " Loads the current management rights file from disk");
}
- else
+ else if(settingManagementRightsSupported())
{
- //since Qpid JMX API 1.2 it also reloads the password file
+ //from Qpid JMX API 1.2 to 2.3 / 1.12 it also reloads the password file
_toolkit.createLabel(miscGroup, " Loads the current password and management rights files from disk");
}
+ else
+ {
+ //since Qpid JMX API 2.3 / 1.12 it only reloads the password file
+ _toolkit.createLabel(miscGroup, " Loads the current password data");
+ }
+
reloadUserDetails.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
@@ -453,7 +500,7 @@ public class UserManagementTabControl extends TabControl
{
case 0 : // username column
return (String) ((CompositeData) element).get(USERNAME);
- case 1 : // rights column
+ case 1 : // rights column (used for API < 2.3 / 1.12)
return classifyUserRights((CompositeData) element);
default :
return "-";
@@ -510,11 +557,11 @@ public class UserManagementTabControl extends TabControl
int comparison = 0;
switch(column)
{
- case 0:
+ case 0: //username column
comparison = String.valueOf(user1.get(USERNAME)).compareTo(
String.valueOf(user2.get(USERNAME)));
break;
- case 1:
+ case 1: // rights column (used for API < 2.3 / 1.12)
comparison = classifyUserRights(user1).compareTo(classifyUserRights(user2));
break;
default:
@@ -555,7 +602,12 @@ public class UserManagementTabControl extends TabControl
private void setRights(final Shell parent)
{
-
+ if(!settingManagementRightsSupported())
+ {
+ throw new UnsupportedOperationException("Setting management rights" +
+ " is not supported using this version of the broker management API: " + (_ApiVersion));
+ }
+
int selectionIndex = _table.getSelectionIndex();
if (selectionIndex == -1)
@@ -699,6 +751,13 @@ public class UserManagementTabControl extends TabControl
shell.open();
}
+
+ protected boolean settingManagementRightsSupported()
+ {
+ //setting management access rights was supported until Qpid JMX API 1.12 / 2.3
+ return _ApiVersion.lessThan(1,12) ||
+ (_ApiVersion.greaterThanOrEqualTo(2, 0) && _ApiVersion.lessThan(2,3));
+ }
private void addUser(final Shell parent)
{
@@ -706,7 +765,8 @@ public class UserManagementTabControl extends TabControl
Composite usernameComposite = _toolkit.createComposite(shell, SWT.NONE);
usernameComposite.setBackground(shell.getBackground());
- usernameComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ GridData usernameCompGridData = new GridData(SWT.FILL, SWT.TOP, true, false);
+ usernameComposite.setLayoutData(usernameCompGridData);
usernameComposite.setLayout(new GridLayout(2,false));
_toolkit.createLabel(usernameComposite,"Username:").setBackground(shell.getBackground());
@@ -715,28 +775,45 @@ public class UserManagementTabControl extends TabControl
Composite passwordComposite = _toolkit.createComposite(shell, SWT.NONE);
passwordComposite.setBackground(shell.getBackground());
- passwordComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ GridData passwordCompGridData = new GridData(SWT.FILL, SWT.TOP, true, false);
+ passwordComposite.setLayoutData(passwordCompGridData);
passwordComposite.setLayout(new GridLayout(2,false));
_toolkit.createLabel(passwordComposite,"Password:").setBackground(shell.getBackground());
final Text passwordText = new Text(passwordComposite, SWT.BORDER | SWT.PASSWORD);
passwordText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
-
- Group buttonGroup = new Group(shell, SWT.NONE);
- buttonGroup.setText("JMX Management Rights");
- buttonGroup.setBackground(shell.getBackground());
- buttonGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
- buttonGroup.setLayout(new GridLayout(4,false));
- final Button noneButton = new Button(buttonGroup, SWT.RADIO);
- noneButton.setText("No Access");
- noneButton.setSelection(true);
- final Button readButton = new Button(buttonGroup, SWT.RADIO);
- readButton.setText("Read Only");
- final Button writeButton = new Button(buttonGroup, SWT.RADIO);
- writeButton.setText("Read + Write");
- final Button adminButton = new Button(buttonGroup, SWT.RADIO);
- adminButton.setText("Admin");
+ final Button readButton;
+ final Button writeButton;
+ final Button adminButton;
+ if(settingManagementRightsSupported())
+ {
+ Group buttonGroup = new Group(shell, SWT.NONE);
+ buttonGroup.setText("JMX Management Rights");
+ buttonGroup.setBackground(shell.getBackground());
+ buttonGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+ buttonGroup.setLayout(new GridLayout(4,false));
+
+ final Button noneButton = new Button(buttonGroup, SWT.RADIO);
+ noneButton.setText("No Access");
+ noneButton.setSelection(true);
+ readButton = new Button(buttonGroup, SWT.RADIO);
+ readButton.setText("Read Only");
+ writeButton = new Button(buttonGroup, SWT.RADIO);
+ writeButton.setText("Read + Write");
+ adminButton = new Button(buttonGroup, SWT.RADIO);
+ adminButton.setText("Admin");
+ }
+ else
+ {
+ readButton = null;
+ writeButton = null;
+ adminButton = null;
+ //The lack of rights settings will cause the dialog to,
+ //shrink so add width hints to the other components
+ passwordCompGridData.widthHint = 350;
+ usernameCompGridData.widthHint = 350;
+ }
Composite okCancelButtonsComp = _toolkit.createComposite(shell);
okCancelButtonsComp.setBackground(shell.getBackground());
@@ -784,22 +861,36 @@ public class UserManagementTabControl extends TabControl
return;
}
}
-
- boolean read = readButton.getSelection();
- boolean write = writeButton.getSelection();
- boolean admin = adminButton.getSelection();
+
+ //read the access rights selections if required
+ boolean read = false;
+ boolean write = false;
+ boolean admin = false;
+ if(settingManagementRightsSupported())
+ {
+ read = readButton.getSelection();
+ write = writeButton.getSelection();
+ admin = adminButton.getSelection();
+ }
shell.dispose();
try
{
boolean result = false;
- // If we have Qpid JMX API 1.7 or above, use newer createUser method with String based password.
- if (_ApiVersion.greaterThanOrEqualTo(1,7))
+
+ if (!settingManagementRightsSupported())
+ {
+ // If we have Qpid JMX API 2.3 / 1.12 or above, use newer createUser method without rights parameters.
+ result = _ummb.createUser(username, password);
+ }
+ else if (_ApiVersion.greaterThanOrEqualTo(1,7))
{
+ // If we have Qpid JMX API 1.7 or above, use newer createUser method with String based password.
result = _ummb.createUser(username, password, read, write, admin);
}
else
{
+ // Else we have Qpid JMX API 1.6 or below, use older createUser method with char[] based password.
result = _ummb.createUser(username, passwordChars, read, write, admin);
}