summaryrefslogtreecommitdiff
path: root/qpid/java/broker-plugins/management-http/src/main
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2013-04-19 16:16:20 +0000
committerAlex Rudyy <orudyy@apache.org>2013-04-19 16:16:20 +0000
commit8735514651a4873dc0b9b0ea4cf0fc58267e6fb3 (patch)
treeb6375211efcd355c8a00690c56f2ffab40aa3c17 /qpid/java/broker-plugins/management-http/src/main
parent8daa35c9f6fc4f4e8f18e7fa5dafb2cd0a6c3460 (diff)
downloadqpid-python-8735514651a4873dc0b9b0ea4cf0fc58267e6fb3.tar.gz
QPID-4753: move ACL config from broker attribute to a top level entity
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1469937 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/management-http/src/main')
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java2
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java3
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAccessControlProviderAttributes.java76
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/showAclFile.html24
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AccessControlProvider.js131
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js47
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/AclFile.js95
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js177
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js6
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js2
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/showAccessControlProvider.html31
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html14
12 files changed, 587 insertions, 21 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
index b87b1c76f0..2fc54482a4 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java
@@ -47,6 +47,7 @@ import org.apache.qpid.server.management.plugin.servlet.rest.MessageServlet;
import org.apache.qpid.server.management.plugin.servlet.rest.RestServlet;
import org.apache.qpid.server.management.plugin.servlet.rest.SaslServlet;
import org.apache.qpid.server.management.plugin.servlet.rest.StructureServlet;
+import org.apache.qpid.server.model.AccessControlProvider;
import org.apache.qpid.server.model.AuthenticationProvider;
import org.apache.qpid.server.model.Binding;
import org.apache.qpid.server.model.Broker;
@@ -283,6 +284,7 @@ public class HttpManagement extends AbstractPluginAdapter implements HttpManagem
addRestServlet(root, "broker");
addRestServlet(root, "virtualhost", VirtualHost.class);
addRestServlet(root, "authenticationprovider", AuthenticationProvider.class);
+ addRestServlet(root, "accesscontrolprovider", AccessControlProvider.class);
addRestServlet(root, "user", AuthenticationProvider.class, User.class);
addRestServlet(root, "groupprovider", GroupProvider.class);
addRestServlet(root, "group", GroupProvider.class, Group.class);
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java
index 626dfa1d6c..a7066c73d8 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java
@@ -31,6 +31,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.qpid.server.management.plugin.servlet.rest.action.ListAccessControlProviderAttributes;
import org.apache.qpid.server.management.plugin.servlet.rest.action.ListAuthenticationProviderAttributes;
import org.apache.qpid.server.management.plugin.servlet.rest.action.ListGroupProviderAttributes;
import org.apache.qpid.server.management.plugin.servlet.rest.action.ListMessageStoreTypes;
@@ -55,6 +56,8 @@ public class HelperServlet extends AbstractServlet
_actions.put(listMessageStoreTypes.getName(), listMessageStoreTypes);
Action groupProviderAttributes = new ListGroupProviderAttributes();
_actions.put(groupProviderAttributes.getName(), groupProviderAttributes);
+ Action aclProviderAttributes = new ListAccessControlProviderAttributes();
+ _actions.put(aclProviderAttributes.getName(), aclProviderAttributes);
}
@Override
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAccessControlProviderAttributes.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAccessControlProviderAttributes.java
new file mode 100644
index 0000000000..6887217016
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAccessControlProviderAttributes.java
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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.server.management.plugin.servlet.rest.action;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.qpid.server.management.plugin.servlet.rest.Action;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.plugin.AccessControlFactory;
+import org.apache.qpid.server.plugin.QpidServiceLoader;
+
+public class ListAccessControlProviderAttributes implements Action
+{
+ private static final String ATTRIBUTES = "attributes";
+ private static final String DESCRIPTIONS = "descriptions";
+ private Map<String, AccessControlFactory> _factories;
+
+ public ListAccessControlProviderAttributes()
+ {
+ _factories = new TreeMap<String, AccessControlFactory>();
+ Iterable<AccessControlFactory> factories = new QpidServiceLoader<AccessControlFactory>()
+ .instancesOf(AccessControlFactory.class);
+ for (AccessControlFactory factory : factories)
+ {
+ _factories.put(factory.getType(), factory);
+ }
+ }
+
+ @Override
+ public String getName()
+ {
+ return ListAccessControlProviderAttributes.class.getSimpleName();
+ }
+
+ @Override
+ public Object perform(Map<String, Object> request, Broker broker)
+ {
+ Map<String, Object> attributes = new TreeMap<String, Object>();
+ for (String providerType : _factories.keySet())
+ {
+ AccessControlFactory factory = _factories.get(providerType);
+
+ Map<String, Object> data = new HashMap<String, Object>();
+ data.put(ATTRIBUTES, factory.getAttributeNames());
+ Map<String, String> resources = factory.getAttributeDescriptions();
+ if (resources != null)
+ {
+ data.put(DESCRIPTIONS, resources);
+ }
+
+ attributes.put(factory.getType(), data);
+ }
+ return attributes;
+ }
+
+}
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/showAclFile.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/showAclFile.html
new file mode 100644
index 0000000000..182e651a51
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/showAclFile.html
@@ -0,0 +1,24 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<div class="AclFileProvider">
+ <span style="">Path:</span><span class="path" style="position:absolute; left:6em"></span>
+ <br/>
+</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AccessControlProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AccessControlProvider.js
new file mode 100644
index 0000000000..fd8a3ecb0e
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AccessControlProvider.js
@@ -0,0 +1,131 @@
+/*
+ *
+ * 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.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/parser",
+ "dojo/query",
+ "dojo/_base/connect",
+ "qpid/common/properties",
+ "qpid/common/updater",
+ "qpid/common/util",
+ "qpid/common/UpdatableStore",
+ "dojox/grid/EnhancedGrid",
+ "dijit/registry",
+ "dojo/_base/event",
+ "dojox/grid/enhanced/plugins/Pagination",
+ "dojox/grid/enhanced/plugins/IndirectSelection",
+ "dojo/domReady!"],
+ function (xhr, parser, query, connect, properties, updater, util, UpdatableStore, EnhancedGrid, registry, event) {
+
+ function AccessControlProvider(name, parent, controller) {
+ this.name = name;
+ this.controller = controller;
+ this.modelObj = { type: "accesscontrolprovider", name: name };
+ if(parent) {
+ this.modelObj.parent = {};
+ this.modelObj.parent[ parent.type] = parent;
+ }
+ }
+
+ AccessControlProvider.prototype.getTitle = function() {
+ return "AccessControlProvider: " + this.name ;
+ };
+
+ AccessControlProvider.prototype.open = function(contentPane) {
+ var that = this;
+ this.contentPane = contentPane;
+ xhr.get({url: "showAccessControlProvider.html",
+ sync: true,
+ load: function(data) {
+ contentPane.containerNode.innerHTML = data;
+ parser.parse(contentPane.containerNode);
+
+ that.accessControlProviderUpdater = new AccessControlProviderUpdater(contentPane.containerNode, that.modelObj, that.controller);
+
+ var deleteButton = query(".deleteAccessControlProviderButton", contentPane.containerNode)[0];
+ var deleteWidget = registry.byNode(deleteButton);
+ connect.connect(deleteWidget, "onClick",
+ function(evt){
+ event.stop(evt);
+ that.deleteAccessControlProvider();
+ });
+ }});
+ };
+
+ AccessControlProvider.prototype.close = function() {
+ if (this.accessControlProviderUpdater.details)
+ {
+ this.accessControlProviderUpdater.details.close();
+ }
+ };
+
+ AccessControlProvider.prototype.deleteAccessControlProvider = function() {
+ if(confirm("Are you sure you want to delete access control provider '" + this.name + "'?")) {
+ var query = "rest/accesscontrolprovider/" +encodeURIComponent(this.name);
+ this.success = true
+ var that = this;
+ xhr.del({url: query, sync: true, handleAs: "json"}).then(
+ function(data) {
+ that.close();
+ that.contentPane.onClose()
+ that.controller.tabContainer.removeChild(that.contentPane);
+ that.contentPane.destroyRecursive();
+ },
+ function(error) {that.success = false; that.failureReason = error;});
+ if(!this.success ) {
+ alert("Error:" + this.failureReason);
+ }
+ }
+ };
+
+ function AccessControlProviderUpdater(node, groupProviderObj, controller)
+ {
+ this.controller = controller;
+ this.name = query(".name", node)[0];
+ this.type = query(".type", node)[0];
+ this.query = "rest/accesscontrolprovider/"+encodeURIComponent(groupProviderObj.name);
+
+ var that = this;
+
+ xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"})
+ .then(function(data)
+ {
+ that.accessControlProviderData = data[0];
+
+ util.flattenStatistics( that.accessControlProviderData );
+
+ that.updateHeader();
+
+ var ui = that.accessControlProviderData.type;
+ require(["qpid/management/accesscontrolprovider/"+ ui],
+ function(SpecificProvider) {
+ that.details = new SpecificProvider(query(".providerDetails", node)[0], groupProviderObj, controller);
+ });
+ });
+ }
+
+ AccessControlProviderUpdater.prototype.updateHeader = function()
+ {
+ this.name.innerHTML = this.accessControlProviderData[ "name" ];
+ this.type.innerHTML = this.accessControlProviderData[ "type" ];
+ };
+
+ return AccessControlProvider;
+ });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js
index e5631745a8..7ce2e1c0c1 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js
@@ -33,6 +33,7 @@ define(["dojo/_base/xhr",
"qpid/management/addPort",
"qpid/management/addKeystore",
"qpid/management/addGroupProvider",
+ "qpid/management/addAccessControlProvider",
"dojox/grid/enhanced/plugins/Pagination",
"dojox/grid/enhanced/plugins/IndirectSelection",
"dijit/layout/AccordionContainer",
@@ -43,7 +44,7 @@ define(["dojo/_base/xhr",
"dijit/form/CheckBox",
"dojo/store/Memory",
"dojo/domReady!"],
- function (xhr, parser, query, connect, properties, updater, util, UpdatableStore, EnhancedGrid, registry, addAuthenticationProvider, addVirtualHost, addPort, addKeystore, addGroupProvider) {
+ function (xhr, parser, query, connect, properties, updater, util, UpdatableStore, EnhancedGrid, registry, addAuthenticationProvider, addVirtualHost, addPort, addKeystore, addGroupProvider, addAccessControlProvider) {
function Broker(name, parent, controller) {
this.name = name;
@@ -80,15 +81,6 @@ define(["dojo/_base/xhr",
name: "defaultVirtualHost"})
}
}, {
- name: "aclFile",
- createWidget: function(brokerData) {
- return new dijit.form.ValidationTextBox({
- required: false,
- value: brokerData.aclFile,
- label: "ACL file location:",
- name: "aclFile"})
- }
- }, {
name: "statisticsReportingPeriod",
createWidget: function(brokerData) {
return new dijit.form.ValidationTextBox({
@@ -473,6 +465,21 @@ define(["dojo/_base/xhr",
warning + "Are you sure you want to delete group provider");
}
);
+
+ var addAccessControlButton = query(".addAccessControlProvider", contentPane.containerNode)[0];
+ connect.connect(registry.byNode(addAccessControlButton), "onClick",
+ function(evt){addAccessControlProvider.show();});
+
+ var deleteAccessControlProviderButton = query(".deleteAccessControlProvider", contentPane.containerNode)[0];
+ connect.connect(registry.byNode(deleteAccessControlProviderButton), "onClick",
+ function(evt){
+ util.deleteGridSelections(
+ that.brokerUpdater,
+ that.brokerUpdater.accessControlProvidersGrid.grid,
+ "rest/accesscontrolprovider",
+ "Are you sure you want to delete access control provider");
+ }
+ );
}});
};
@@ -626,7 +633,20 @@ define(["dojo/_base/xhr",
that.controller.show("groupprovider", name, brokerObj);
});
}, gridProperties, EnhancedGrid);
-
+ var aclData = that.brokerData.accesscontrolproviders ? that.brokerData.accesscontrolproviders :[];
+ that.accessControlProvidersGrid =
+ new UpdatableStore(aclData, query(".broker-access-control-providers")[0],
+ [ { name: "Name", field: "name", width: "60%"},
+ { name: "Type", field: "type", width: "40%"}
+ ], function(obj) {
+ connect.connect(obj.grid, "onRowDblClick", obj.grid,
+ function(evt){
+ var idx = evt.rowIndex,
+ theItem = this.getItem(idx);
+ var name = obj.dataStore.getValue(theItem,"name");
+ that.controller.show("accesscontrolprovider", name, brokerObj);
+ });
+ }, gridProperties, EnhancedGrid);
});
xhr.get({url: "rest/logrecords", sync: properties.useSyncGet, handleAs: "json"})
@@ -725,6 +745,11 @@ define(["dojo/_base/xhr",
{
that.groupProvidersGrid.update(that.brokerData.groupproviders);
}
+ if (that.accessControlProvidersGrid)
+ {
+ var data = that.brokerData.accesscontrolproviders ? that.brokerData.accesscontrolproviders :[];
+ that.accessControlProvidersGrid.update(data);
+ }
});
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/AclFile.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/AclFile.js
new file mode 100644
index 0000000000..56f92c2025
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/AclFile.js
@@ -0,0 +1,95 @@
+/*
+ *
+ * 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.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/dom",
+ "dojo/parser",
+ "dojo/query",
+ "dojo/dom-construct",
+ "dojo/_base/connect",
+ "dojo/_base/window",
+ "dojo/_base/event",
+ "dojo/_base/json",
+ "dijit/registry",
+ "qpid/common/util",
+ "qpid/common/properties",
+ "qpid/common/updater",
+ "qpid/common/UpdatableStore",
+ "dojox/grid/EnhancedGrid",
+ "dojox/grid/enhanced/plugins/Pagination",
+ "dojox/grid/enhanced/plugins/IndirectSelection",
+ "dojox/validate/us", "dojox/validate/web",
+ "dijit/Dialog",
+ "dijit/form/TextBox",
+ "dijit/form/ValidationTextBox",
+ "dijit/form/TimeTextBox", "dijit/form/Button",
+ "dijit/form/Form",
+ "dijit/form/DateTextBox",
+ "dojo/domReady!"],
+ function (xhr, dom, parser, query, construct, connect, win, event, json, registry, util, properties, updater, UpdatableStore, EnhancedGrid) {
+ function AclFile(containerNode, aclProviderObj, controller) {
+ var node = construct.create("div", null, containerNode, "last");
+ var that = this;
+ this.name = aclProviderObj.name;
+ xhr.get({url: "accesscontrolprovider/showAclFile.html",
+ sync: true,
+ load: function(data) {
+ node.innerHTML = data;
+ parser.parse(node);
+
+ that.groupDatabaseUpdater= new AclFileUpdater(node, aclProviderObj, controller);
+
+ updater.add( that.groupDatabaseUpdater);
+
+ that.groupDatabaseUpdater.update();
+
+
+ }});
+ }
+
+ AclFile.prototype.close = function() {
+ updater.remove( this.groupDatabaseUpdater );
+ };
+
+ function AclFileUpdater(node, aclProviderObj, controller)
+ {
+ this.controller = controller;
+ this.query = "rest/accesscontrolprovider/"+encodeURIComponent(aclProviderObj.name);
+ this.name = aclProviderObj.name;
+ this.path = query(".path", node)[0];
+ }
+
+ AclFileUpdater.prototype.update = function()
+ {
+ var that = this;
+
+ xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"})
+ .then(function(data) {
+ if (data[0])
+ {
+ that.aclProviderData = data[0];
+ that.path.innerHTML = that.aclProviderData.path;
+ }
+ });
+
+ };
+
+ return AclFile;
+ });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js
new file mode 100644
index 0000000000..d20897c1d8
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js
@@ -0,0 +1,177 @@
+/*
+ *
+ * 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.
+ *
+ */
+define(["dojo/_base/lang",
+ "dojo/_base/xhr",
+ "dojo/dom",
+ "dojo/dom-construct",
+ "dijit/registry",
+ "dojo/parser",
+ "dojo/_base/array",
+ "dojo/_base/event",
+ 'dojo/_base/json',
+ "qpid/common/util",
+ "dojo/store/Memory",
+ "dojox/validate/us",
+ "dojox/validate/web",
+ "dijit/Dialog",
+ "dijit/form/CheckBox",
+ "dijit/form/Textarea",
+ "dijit/form/ComboBox",
+ "dijit/form/TextBox",
+ "dijit/form/ValidationTextBox",
+ "dijit/form/Button",
+ "dijit/form/Form",
+ "dijit/layout/ContentPane",
+ "dojox/layout/TableContainer",
+ "dojo/domReady!"],
+ function (lang, xhr, dom, construct, registry, parser, array, event, json, util) {
+
+ var addAccessControlProvider = {};
+
+ addAccessControlProvider.show = function(accessControlProvider) {
+ var fields = [{
+ name: "name",
+ createWidget: function(accessControlProvider) {
+ return new dijit.form.ValidationTextBox({
+ required: true,
+ value: accessControlProvider.name,
+ disabled: accessControlProvider.name ? true : false,
+ label: "Name*:",
+ regexp: "^[\x20-\x2e\x30-\x7F]{1,255}$",
+ name: "name"});
+ }
+ }, {
+ name: "type",
+ createWidget: function(accessControlProvider) {
+
+ var typeContainer = construct.create("div");
+
+ var typeListContainer = new dojox.layout.TableContainer({
+ cols: 1,
+ "labelWidth": "300",
+ customClass: "formLabel",
+ showLabels: true,
+ orientation: "horiz"
+ });
+
+ typeContainer.appendChild(typeListContainer.domNode);
+
+ var providers = [];
+ var fieldSetContainers = {};
+ xhr.get({
+ url: "rest/helper?action=ListAccessControlProviderAttributes",
+ handleAs: "json",
+ sync: true
+ }).then(
+ function(data) {
+ var providerIndex = 0;
+
+ for (var providerType in data) {
+ if (data.hasOwnProperty(providerType)) {
+ providers[providerIndex++] = {id: providerType, name: providerType};
+
+ var attributes = data[providerType].attributes;
+ var descriptions = data[providerType].descriptions;
+
+ var layout = new dojox.layout.TableContainer( {
+ cols: 1,
+ "labelWidth": "300",
+ customClass: "formLabel",
+ showLabels: true,
+ orientation: "horiz"
+ });
+
+ for(var i=0; i < attributes.length; i++) {
+ if ("type" == attributes[i])
+ {
+ continue;
+ }
+ var labelValue = attributes[i];
+ if (descriptions && descriptions[attributes[i]])
+ {
+ labelValue = descriptions[attributes[i]];
+ }
+ var text = new dijit.form.TextBox({
+ label: labelValue + ":",
+ name: attributes[i]
+ });
+ layout.addChild(text);
+ }
+
+ typeContainer.appendChild(layout.domNode);
+ fieldSetContainers[providerType] = layout;
+ }
+ }
+ });
+
+ var providersStore = new dojo.store.Memory({ data: providers });
+
+ var typeList = new dijit.form.FilteringSelect({
+ required: true,
+ value: accessControlProvider.type,
+ store: providersStore,
+ label: "Type*:",
+ name: "type"});
+
+ typeListContainer.addChild(typeList);
+
+ var onChangeHandler = function onChangeHandler(newValue){
+ for (var i in fieldSetContainers) {
+ var container = fieldSetContainers[i];
+ var descendants = container.getChildren();
+ for(var i in descendants){
+ var descendant = descendants[i];
+ var propName = descendant.name;
+ if (propName) {
+ descendant.set("disabled", true);
+ }
+ }
+ container.domNode.style.display = "none";
+ }
+ var container = fieldSetContainers[newValue];
+ if (container)
+ {
+ container.domNode.style.display = "block";
+ var descendants = container.getChildren();
+ for(var i in descendants){
+ var descendant = descendants[i];
+ var propName = descendant.name;
+ if (propName) {
+ descendant.set("disabled", false);
+ }
+ }
+ }
+ };
+ typeList.on("change", onChangeHandler);
+ onChangeHandler(typeList.value);
+ return new dijit.layout.ContentPane({content: typeContainer, style:{padding: 0}});
+ }
+ }];
+
+ util.showSetAttributesDialog(
+ fields,
+ accessControlProvider ? accessControlProvider : {},
+ "rest/accesscontrolprovider" + (name ? "/" + encodeURIComponent(name.name) : ""),
+ accessControlProvider ? "Edit access control provider - " + accessControlProvider.name : "Add access control provider",
+ accessControlProvider ? false : true);
+ };
+ return addAccessControlProvider;
+ }); \ No newline at end of file
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
index c4114739c0..e8a381777f 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
@@ -31,15 +31,17 @@ define(["dojo/dom",
"qpid/management/group/Group",
"qpid/management/KeyStore",
"qpid/management/TrustStore",
+ "qpid/management/AccessControlProvider",
"dojo/ready",
"dojo/domReady!"],
- function (dom, registry, ContentPane, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider, GroupProvider, Group, KeyStore, TrustStore, ready) {
+ function (dom, registry, ContentPane, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider, GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, ready) {
var controller = {};
var constructors = { broker: Broker, virtualhost: VirtualHost, exchange: Exchange,
queue: Queue, connection: Connection,
authenticationprovider: AuthProvider, groupprovider: GroupProvider,
- group: Group, keystore: KeyStore, truststore: TrustStore };
+ group: Group, keystore: KeyStore, truststore: TrustStore,
+ accesscontrolprovider: AccessControlProvider};
var tabDiv = dom.byId("managedViews");
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js
index f96fc13a03..7bb52b938f 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js
@@ -281,6 +281,8 @@ define(["dojo/_base/xhr",
controller.show("keystore", details.keystore, {broker: {type:"broker", name:""}});
} else if (details.type == 'truststore') {
controller.show("truststore", details.truststore, {broker: {type:"broker", name:""}});
+ } else if (details.type == 'accesscontrolprovider') {
+ controller.show("accesscontrolprovider", details.accesscontrolprovider, {broker: {type:"broker", name:""}});
}
};
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showAccessControlProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showAccessControlProvider.html
new file mode 100644
index 0000000000..399425a7de
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showAccessControlProvider.html
@@ -0,0 +1,31 @@
+<!--
+ -
+ - 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.
+ -
+ -->
+<div class="accessControlProvider">
+ <span style="">Name:</span><span class="name" style="position:absolute; left:6em"></span>
+ <br/>
+ <span style="">Type:</span><span class="type" style="position:absolute; left:6em"></span>
+ <br/>
+ <div class="providerDetails"></div>
+ <div class="dijitDialogPaneActionBar">
+ <input class="deleteAccessControlProviderButton" type="button" value="Delete Access Control provider" label="Delete Access Control Provider" dojoType="dijit.form.Button" />
+ </div>
+</div>
+<br/> \ No newline at end of file
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html
index 4acf42da46..15f7faf318 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html
@@ -53,18 +53,10 @@
<div class="formLabel-labelCell" style="float:left; width: 250px;">Broker store location:</div>
<div id="brokerAttribute.storePath" style="float:left;"></div>
</div>
- <div id="brokerAttribute.defaultAuthenticationProvider.container" style="display: none; clear:both">
- <div class="formLabel-labelCell" style="float:left; width: 250px;">Default authentication provider:</div>
- <div id="brokerAttribute.defaultAuthenticationProvider" style="float:left;"></div>
- </div>
<div id="brokerAttribute.defaultVirtualHost.container" style="display: none; clear:both; clear:both;">
<div class="formLabel-labelCell" style="float:left; width: 250px;">Default virtual host:</div>
<div id="brokerAttribute.defaultVirtualHost" style="float:left;"></div>
</div>
- <div id="brokerAttribute.aclFile.container" style="display: none; clear:both">
- <div class="formLabel-labelCell" style="float:left; width: 250px;">ACL file location:</div>
- <div id="brokerAttribute.aclFile" style="float:left;"></div>
- </div>
<div id="brokerAttribute.statisticsReportingPeriod.container" style="display: none; clear:both">
<div class="formLabel-labelCell" style="float:left; width: 250px;">Statistics reporting period:</div>
<div id="brokerAttribute.statisticsReportingPeriod" style="float:left;"></div>
@@ -191,6 +183,12 @@
<button data-dojo-type="dijit.form.Button" class="deleteGroupProvider">Delete Group Provider</button>
</div>
<br/>
+ <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Access Control Providers'">
+ <div class="broker-access-control-providers"></div>
+ <button data-dojo-type="dijit.form.Button" class="addAccessControlProvider">Add Access Control Provider</button>
+ <button data-dojo-type="dijit.form.Button" class="deleteAccessControlProvider">Delete Access Control Provider</button>
+ </div>
+ <br/>
<div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Log File', open: false">
<div class="broker-logfile"></div>
</div>