This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/master by this push:
new e585a18797 Unmaintained code removal - webconsole-plugins/useradmin
e585a18797 is described below
commit e585a1879765f5f9fae9bd75f8bc7d9ad0d4078e
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Tue Aug 22 17:55:19 2023 +0200
Unmaintained code removal - webconsole-plugins/useradmin
---
webconsole-plugins/useradmin/changelog.txt | 19 -
webconsole-plugins/useradmin/pom.xml | 132 -------
.../main/appended-resources/META-INF/DEPENDENCIES | 20 -
.../plugins/useradmin/internal/Activator.java | 101 -----
.../useradmin/internal/WebConsolePlugin.java | 344 -----------------
.../main/resources/OSGI-INF/l10n/bundle.properties | 51 ---
.../resources/OSGI-INF/l10n/bundle_bg.properties | 52 ---
.../resources/OSGI-INF/l10n/bundle_de.properties | 51 ---
.../useradmin/src/main/resources/res/book-2.png | Bin 1167 -> 0 bytes
.../useradmin/src/main/resources/res/group.png | Bin 1226 -> 0 bytes
.../main/resources/res/jstree-3.0.9/jstree.min.js | 5 -
.../res/jstree-3.0.9/themes/default/32px.png | Bin 3121 -> 0 bytes
.../res/jstree-3.0.9/themes/default/40px.png | Bin 1880 -> 0 bytes
.../res/jstree-3.0.9/themes/default/style.min.css | 1 -
.../res/jstree-3.0.9/themes/default/throbber.gif | Bin 1720 -> 0 bytes
.../useradmin/src/main/resources/res/plugin.css | 26 --
.../useradmin/src/main/resources/res/plugin.html | 125 ------
.../useradmin/src/main/resources/res/plugin.js | 428 ---------------------
.../useradmin/src/main/resources/res/role.png | Bin 1221 -> 0 bytes
.../useradmin/src/main/resources/res/user.png | Bin 1069 -> 0 bytes
20 files changed, 1355 deletions(-)
diff --git a/webconsole-plugins/useradmin/changelog.txt
b/webconsole-plugins/useradmin/changelog.txt
deleted file mode 100644
index b49e130524..0000000000
--- a/webconsole-plugins/useradmin/changelog.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-Changes from 1.0.2 to 1.0.4
----------------------------
-** Improvement
- * [FELIX-5510] - Remove usage of org.json form web console plugins
-
-
-Changes from 1.0.0 to 1.0.2
----------------------------
-** Bug
- * [FELIX-3633] - User Admin Plugin - no German translation
- * [FELIX-4763] - Reload button on user admin plugin doesn't work correctly.
-
-Initial Release 1.0.0
----------------------
-
-** Improvement
- * [FELIX-2254] - User Admin Plugin
- * [FELIX-3861] - Set felix.webconsole.category on Web Console plugins
- * [FELIX-4703] - User Admin plugin should use all available to the JVM
crypto algorithms
diff --git a/webconsole-plugins/useradmin/pom.xml
b/webconsole-plugins/useradmin/pom.xml
deleted file mode 100644
index 35bc2ec2fe..0000000000
--- a/webconsole-plugins/useradmin/pom.xml
+++ /dev/null
@@ -1,132 +0,0 @@
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.felix</groupId>
- <artifactId>felix-parent</artifactId>
- <version>7</version>
- <relativePath>../../../pom/pom.xml</relativePath>
- </parent>
-
- <artifactId>org.apache.felix.webconsole.plugins.useradmin</artifactId>
- <packaging>bundle</packaging>
- <version>1.0.3-SNAPSHOT</version>
-
- <name>Apache Felix Web Console User Admin Plugin</name>
- <description>
- This is a plugin for the Apache Felix OSGi web console for
displaying/managing OSGi Users and Groups.
- </description>
-
- <scm>
-
<connection>scm:git:https://github.com/apache/felix-dev.git</connection>
-
<developerConnection>scm:git:https://github.com/apache/felix-dev.git</developerConnection>
- <url>https://gitbox.apache.org/repos/asf?p=felix-dev.git</url>
- </scm>
-
- <build>
- <plugins>
- <!-- translate UTF-8 encoded properties files to
ISO-8859-1 -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
-
<artifactId>native2ascii-maven-plugin</artifactId>
- <version>1.0-beta-1</version>
- <executions>
- <execution>
- <goals>
-
<goal>native2ascii</goal>
- </goals>
- <configuration>
-
<encoding>UTF-8</encoding>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>3.2.0</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>
- ${project.artifactId}
- </Bundle-SymbolicName>
- <Bundle-Activator>
-
org.apache.felix.webconsole.plugins.useradmin.internal.Activator
- </Bundle-Activator>
- <Include-Resource>
-
{maven-resources},OSGI-INF=target/classes/OSGI-INF
- </Include-Resource>
- <Embed-Dependency>
-
org.apache.felix.utils;inline=org/apache/felix/utils/json/JSONWriter**,
-
org.apache.felix.utils;inline=org/apache/felix/utils/json/JSONParser**
- </Embed-Dependency>
- </instructions>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
-
<exclude>src/main/appended-resources/**</exclude>
-
<exclude>src/main/resources/res/**</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>4.0.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>4.1.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.webconsole</artifactId>
- <version>4.2.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.utils</artifactId>
- <version>1.9.0</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-</project>
diff --git
a/webconsole-plugins/useradmin/src/main/appended-resources/META-INF/DEPENDENCIES
b/webconsole-plugins/useradmin/src/main/appended-resources/META-INF/DEPENDENCIES
deleted file mode 100644
index ba9458267d..0000000000
---
a/webconsole-plugins/useradmin/src/main/appended-resources/META-INF/DEPENDENCIES
+++ /dev/null
@@ -1,20 +0,0 @@
-
-I. Included Software
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-Licensed under the Apache License 2.0.
-
-This product includes icons from the Batch icon set
-(http://adamwhitcroft.com/batch/license/)
-Distributed as Public Domain
-
-This product uses software developed at
-jsTree (http://jstree.com/).
-Copyright (c) 2014 Ivan Bozhanov
-Licensed under The MIT License
(http://www.opensource.org/licenses/mit-license.php)
-
-III. License Summary
-- Apache License 2.0
-- The MIT License
-- Public Domain
diff --git
a/webconsole-plugins/useradmin/src/main/java/org/apache/felix/webconsole/plugins/useradmin/internal/Activator.java
b/webconsole-plugins/useradmin/src/main/java/org/apache/felix/webconsole/plugins/useradmin/internal/Activator.java
deleted file mode 100644
index 48bddb046d..0000000000
---
a/webconsole-plugins/useradmin/src/main/java/org/apache/felix/webconsole/plugins/useradmin/internal/Activator.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.felix.webconsole.plugins.useradmin.internal;
-
-import org.apache.felix.webconsole.SimpleWebConsolePlugin;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.useradmin.UserAdmin;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-/**
- * Activator is the main starting class.
- */
-public class Activator implements BundleActivator, ServiceTrackerCustomizer
-{
-
- private ServiceTracker tracker;
- private BundleContext context;
-
- private SimpleWebConsolePlugin plugin;
-
- /**
- * @see
org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public final void start(BundleContext context) throws Exception
- {
- this.context = context;
- this.tracker = new ServiceTracker(context, UserAdmin.class.getName(),
this);
- this.tracker.open();
- }
-
- /**
- * @see
org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public final void stop(BundleContext context) throws Exception
- {
- if (tracker != null)
- {
- tracker.close();
- tracker = null;
- }
- }
-
- // - begin tracker
- /**
- * @see
org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference,
- * java.lang.Object)
- */
- public final void modifiedService(ServiceReference reference, Object
service)
- {/* unused */
- }
-
- /**
- * @see
org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference)
- */
- public final Object addingService(ServiceReference reference)
- {
- SimpleWebConsolePlugin plugin = this.plugin;
- if (plugin == null)
- {
- final UserAdmin service = (UserAdmin)
context.getService(reference);
- this.plugin = new WebConsolePlugin(service).register(context);
- // printerRegistration =
context.registerService(ConfigurationPrinter.SERVICE,
- // new ComponentConfigurationPrinter(service),
null);
- }
-
- return context.getService(reference);
- }
-
- /**
- * @see
org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference,
- * java.lang.Object)
- */
- public final void removedService(ServiceReference reference, Object
service)
- {
- SimpleWebConsolePlugin plugin = this.plugin;
- this.plugin = null;
-
- if (plugin != null)
- {
- // remove service
- plugin.unregister();
- }
- }
-}
diff --git
a/webconsole-plugins/useradmin/src/main/java/org/apache/felix/webconsole/plugins/useradmin/internal/WebConsolePlugin.java
b/webconsole-plugins/useradmin/src/main/java/org/apache/felix/webconsole/plugins/useradmin/internal/WebConsolePlugin.java
deleted file mode 100644
index c7cb99268c..0000000000
---
a/webconsole-plugins/useradmin/src/main/java/org/apache/felix/webconsole/plugins/useradmin/internal/WebConsolePlugin.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * 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.felix.webconsole.plugins.useradmin.internal;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.security.MessageDigest;
-import java.security.Provider;
-import java.security.Security;
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.felix.utils.json.JSONParser;
-import org.apache.felix.utils.json.JSONWriter;
-import org.apache.felix.webconsole.SimpleWebConsolePlugin;
-import org.osgi.service.useradmin.Group;
-import org.osgi.service.useradmin.Role;
-import org.osgi.service.useradmin.User;
-import org.osgi.service.useradmin.UserAdmin;
-
-class WebConsolePlugin extends SimpleWebConsolePlugin
-{
- private static final long serialVersionUID = -3551087958597824593L;
-
- private static final String LABEL = "users"; //$NON-NLS-1$
- private static final String TITLE = "%role.pluginTitle"; //$NON-NLS-1$
- private static final String CATEGORY = "OSGi"; //$NON-NLS-1$
- private static final String CSS[] = { "/" + LABEL + "/res/plugin.css" };
//$NON-NLS-1$ //$NON-NLS-2$
-
- private final UserAdmin userAdmin;
-
- // templates
- private final String TEMPLATE;
-
- /** Default constructor */
- WebConsolePlugin(UserAdmin userAdmin)
- {
- super(LABEL, TITLE, CSS);
- this.userAdmin = userAdmin;
-
- // load templates
- TEMPLATE = readTemplateFile("/res/plugin.html"); //$NON-NLS-1$
- }
-
- @Override
- public String getCategory()
- {
- return CATEGORY;
- }
-
- /**
- * @see
org.apache.felix.webconsole.AbstractWebConsolePlugin#renderContent(HttpServletRequest,
HttpServletResponse)
- */
- @Override
- protected final void renderContent(HttpServletRequest req,
- HttpServletResponse response) throws ServletException, IOException
- {
- response.getWriter().print(TEMPLATE);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException
- {
-
- resp.setContentType("application/json"); //$NON-NLS-1$
- resp.setCharacterEncoding("UTF-8"); //$NON-NLS-1$
- final PrintWriter out = resp.getWriter();
- final JSONWriter jw = new JSONWriter(out);
- final String action = req.getParameter("action"); //$NON-NLS-1$
-
- final String role = req.getParameter("role"); //$NON-NLS-1$
- final String group = req.getParameter("group"); //$NON-NLS-1$
-
- try
- {
-
- if ("addMember".equals(action)) { //$NON-NLS-1$
- final Role xrole = userAdmin.getRole(role);
- final Group xgroup = (Group) userAdmin.getRole(group);
- xgroup.addMember(xrole);
- toJSON(jw, xgroup, false);
- }
- else if ("addRequiredMember".equals(action)) { //$NON-NLS-1$
- final Role xrole = userAdmin.getRole(role);
- final Group xgroup = (Group) userAdmin.getRole(group);
- xgroup.addRequiredMember(xrole);
- toJSON(jw, xgroup, false);
- }
- else if ("removeMember".equals(action)) { //$NON-NLS-1$
- final Role xrole = userAdmin.getRole(role);
- final Group xgroup = (Group) userAdmin.getRole(group);
- xgroup.removeMember(xrole);
- toJSON(jw, xgroup, false);
- }
- else if ("toggleMembership".equals(action)) { //$NON-NLS-1$
- final Role xrole = userAdmin.getRole(role);
- final Group xgroup = (Group) userAdmin.getRole(group);
- if (contains(xgroup.getRequiredMembers(), xrole)) // if
required
- {
- xgroup.removeMember(xrole);
- xgroup.addMember(xrole); // add as basic
- }
- else
- {
- xgroup.removeMember(xrole);
- xgroup.addRequiredMember(xrole); // add as required
- }
- toJSON(jw, xgroup, false);
- }
- else if ("getDigestAlgorithms".equals(action)) { //$NON-NLS-1$
- getMessageDigestAlgorithms(jw);
- }
- else if ("digest".equals(action)) { //$NON-NLS-1$
- final String dataRaw = req.getParameter("data"); //$NON-NLS-1$
- final String algorithm = req.getParameter("algorithm");
//$NON-NLS-1$
- final MessageDigest digest =
MessageDigest.getInstance(algorithm);
- final byte[] encoded = digest.digest(dataRaw.getBytes());
- jw.object();
- jw.key("encoded"); //$NON-NLS-1$
- jw.value(encoded);
- jw.endObject();
- }
- else if ("del".equals(action)) { //$NON-NLS-1$
- out.print(userAdmin.removeRole(role));
- }
- else if ("get".equals(action)) { //$NON-NLS-1$
- final Role xrole = userAdmin.getRole(role);
- toJSON(jw, xrole, true);
- }
- else if ("set".equals(action)) { //$NON-NLS-1$
- final String dataRaw = req.getParameter("data"); //$NON-NLS-1$
- JSONParser parser = new JSONParser(dataRaw);
-
- final Map<String, Object> data = parser.getParsed();
- Role xrole = userAdmin.getRole((String)data.get("name"));
//$NON-NLS-1$
- if (null == xrole)
- {
- xrole = userAdmin.createRole(//
- (String)data.get("name"), //$NON-NLS-1$
- (int)(long)(Long)data.get("type")); //$NON-NLS-1$
- }
- doSetData(xrole, data);
- out.print(true);
- }
- else
- // list all roles without details
- {
-
- Role[] roles = userAdmin.getRoles(null);
- toJSON(jw, roles, false);
- }
- jw.flush();
- }
- catch (Exception e)
- {
- throw new ServletException(e);
- }
- }
-
- @SuppressWarnings("unchecked")
- private static final void doSetData(Role role, Map<String, Object> data)
throws IOException
- {
- putProps(role.getProperties(), (Map<String,
Object>)data.get("properties")); //$NON-NLS-1$
- if (role instanceof User)
- {
- putProps(((User) role).getCredentials(), (Map<String,
Object>)data.get("credentials")); //$NON-NLS-1$
- }
- }
-
- private static final void putProps(Dictionary dest, Map<String, Object>
props)
- throws IOException
- {
- // clear the old properties
- if (!dest.isEmpty())
- {
- for (Enumeration e = dest.keys(); e.hasMoreElements();)
- {
- dest.remove(e.nextElement());
- }
- }
- // it's empty - don't process it at all
- if (props == null || props.size() == 0)
- {
- return;
- }
- // append the new one
- for (Iterator i = props.keySet().iterator(); i.hasNext();)
- {
- Object key = i.next();
- Object val = props.get(key);
-
- if (val instanceof Collection)
- {
- val = toArray((Collection) val);
- }
- dest.put(key, val);
- }
- }
-
- private static final byte[] toArray(Collection array) throws IOException
- {
- final byte[] ret = new byte[array.size()];
- Iterator iter = array.iterator();
- for (int i = 0; i < ret.length; i++)
- {
- ret[i] = (byte) ((Long)iter.next() & 0xff);
- }
- return ret;
- }
-
- private static final void toJSON(JSONWriter jw, Role role, boolean details)
- throws IOException
- {
- jw.object();
- jw.key("type"); //$NON-NLS-1$
- jw.value(role.getType());
- jw.key("name"); //$NON-NLS-1$
- jw.value(role.getName());
-
- if (role instanceof Group)
- {
- final Group group = (Group) role;
- Role[] roles;
-
- roles = group.getMembers();
- if (null != roles && roles.length > 0)
- {
- jw.key("members"); //$NON-NLS-1$
- toJSON(jw, roles, details);
- }
-
- roles = group.getRequiredMembers();
- if (null != roles && roles.length > 0)
- {
- jw.key("rmembers"); //$NON-NLS-1$
- toJSON(jw, roles, details);
- }
- }
-
- if (details)
- {
- Dictionary p;
- p = role.getProperties();
- if (null != p && !p.isEmpty())
- {
- jw.key("properties"); //$NON-NLS-1$
- toJSON(jw, p);
- }
- if (role instanceof User)
- {
- p = ((User) role).getCredentials();
- if (null != p && !p.isEmpty())
- {
- jw.key("credentials"); //$NON-NLS-1$
- toJSON(jw, p);
- }
- }
- }
-
- jw.endObject();
- }
-
- private static final void toJSON(JSONWriter jw, Dictionary props)
- throws IOException
- {
- jw.object();
- for (Enumeration e = props.keys(); e.hasMoreElements();)
- {
- final Object key = e.nextElement();
- final Object val = props.get(key);
- jw.key((String) key);
- jw.value(val);
- }
- jw.endObject();
- }
-
- private static final void toJSON(JSONWriter jw, Role[] roles, boolean
details)
- throws IOException
- {
- jw.array();
- for (int i = 0; roles != null && i < roles.length; i++)
- {
- toJSON(jw, roles[i], details);
- }
- jw.endArray();
- }
-
- private static final String DIGEST_KEY_PREFIX = "MessageDigest.";
//$NON-NLS-1$
-
- private static void getMessageDigestAlgorithms(final JSONWriter jw)
- throws IOException
- {
- Provider[] providers = Security.getProviders();
- jw.array();
- for (int i = 0; providers != null && i < providers.length; i++)
- {
- for (Iterator keys = providers[i].keySet().iterator();
keys.hasNext();)
- {
- final String key = (String) keys.next();
- if (key.startsWith(DIGEST_KEY_PREFIX) && key.indexOf(' ') ==
-1)
- {
- jw.value(key.substring(DIGEST_KEY_PREFIX.length()));
- }
- }
- }
- jw.endArray();
- }
-
- private static boolean contains(final Role[] roles, final Role role)
- {
- for (int i = 0; roles != null && role != null && i < roles.length; i++)
- {
- if (roles[i].getName().equals(role.getName()))
- {
- return true;
- }
- }
- return false;
-
- }
-
-}
diff --git
a/webconsole-plugins/useradmin/src/main/resources/OSGI-INF/l10n/bundle.properties
b/webconsole-plugins/useradmin/src/main/resources/OSGI-INF/l10n/bundle.properties
deleted file mode 100644
index b707f2c7f4..0000000000
---
a/webconsole-plugins/useradmin/src/main/resources/OSGI-INF/l10n/bundle.properties
+++ /dev/null
@@ -1,51 +0,0 @@
-#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.
-
-#
-# Web Console strings for reference all strings here are commented.
-# This file may be used to produce a translation of the strings
-#
-# Note that properties files are ISO-8859-1 encoded. To provide translations
-# for languages requiring different character encodings, you may use the
-# native2ascii Maven Plugin from
http://mojo.codehaus.org/native2ascii-maven-plugin/
-# to translate the natively encoded files to ISO-8859-1 during bundle build
-#
-# Translations requiring non-ISO-8859-1 encoding are placed in the
-# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said
-# plugin while building the bundle
-#
-role.pluginTitle=Users
-role.tree.root=Users and Groups
-role.new=New Role
-role.key=Key
-role.value=Value
-role.properties=Properties
-role.credentials=Credentials
-role.new.title=New role
-role.name=Name
-role.type.1=User
-role.type.2=Group
-type.string=String
-type.bytes=Byte[]
-type.password=Password Hash
-role.statline=There are {1} user(s) and {2} role(s) arranged in {0} groups.
-role.help.initial=\
-- Select a role on the left side to open it and edit it's properties and
credentials<br/>\
-- You can drag groups, roles and users in the tree to arrange them and declare
membership<br/>\
-- While dragging, hold Ctrl button to copy, instead of move<br/>\
-- To remove a role from a group - drag it to the root node<br/>\
-- The roles which are in <i>italic</i> are 'required' members of the current
group<br/>\
-- To change the membership, select the role and use 'Toggle Membership' button.
-toggleRequired=Toggle Membership
diff --git
a/webconsole-plugins/useradmin/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
b/webconsole-plugins/useradmin/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
deleted file mode 100644
index 59fd9504e3..0000000000
---
a/webconsole-plugins/useradmin/src/main/resources/OSGI-INF/l10n/bundle_bg.properties
+++ /dev/null
@@ -1,52 +0,0 @@
-#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.
-
-#
-# Web Console strings for reference all strings here are commented.
-# This file may be used to produce a translation of the strings
-#
-# Note that properties files are ISO-8859-1 encoded. To provide translations
-# for languages requiring different character encodings, you may use the
-# native2ascii Maven Plugin from
http://mojo.codehaus.org/native2ascii-maven-plugin/
-# to translate the natively encoded files to ISO-8859-1 during bundle build
-#
-# Translations requiring non-ISO-8859-1 encoding are placed in the
-# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said
-# plugin while building the bundle
-#
-role.pluginTitle=Потребители
-role.tree.root=Групи и потребители
-role.new=Нова роля
-role.key=Ключ
-role.value=Стойност
-role.properties=Атрибути
-role.credentials=Акредитиви
-role.new.title=Създаване на нова роля
-role.name=Име
-role.type.1=Потребител
-role.type.2=Група
-type.string=Низ
-type.bytes=Данни
-type.password=Парола
-role.statline=Има {1} потребител(я) и {2} роли организирани в {0} групи.
-role.help.initial=\
-- Изберете роля от ляво, за да я отворите и промените нейните атрибути<br/>\
-- Можете да завлачвате с мишката ролите за да ги аранжирате. По този начин
декларирате тяхното членство в определена група<br/>\
-- Ако при завлачването натиснете клавиша Ctrl, ще копирате избраната роля,
вместо да я преместите<br/>\
-- За да премахнете роля от група - завлачете я в основата на дървото<br/>\
-- Ролите, които са в <i>курсив</i> са задължителни членове на групата<br/>\
-- За да направите роля задължителна (или обикновена) за групата, изберете
ролята и използвайте бутона за промяна на членство.
-toggleRequired=Задължителен/Обикновен член
-
diff --git
a/webconsole-plugins/useradmin/src/main/resources/OSGI-INF/l10n/bundle_de.properties
b/webconsole-plugins/useradmin/src/main/resources/OSGI-INF/l10n/bundle_de.properties
deleted file mode 100644
index 714a3ad02c..0000000000
---
a/webconsole-plugins/useradmin/src/main/resources/OSGI-INF/l10n/bundle_de.properties
+++ /dev/null
@@ -1,51 +0,0 @@
-#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.
-
-#
-# Web Console strings for reference all strings here are commented.
-# This file may be used to produce a translation of the strings
-#
-# Note that properties files are ISO-8859-1 encoded. To provide translations
-# for languages requiring different character encodings, you may use the
-# native2ascii Maven Plugin from
http://mojo.codehaus.org/native2ascii-maven-plugin/
-# to translate the natively encoded files to ISO-8859-1 during bundle build
-#
-# Translations requiring non-ISO-8859-1 encoding are placed in the
-# src/main/native2ascii/OSGI-INF/l10n folder and are converted using said
-# plugin while building the bundle
-#
-role.pluginTitle=Benutzer
-role.tree.root=Benutzer und Gruppen
-role.new=Neue Rolle
-role.key=Schlüssel
-role.value=Wert
-role.properties=Eigenschaften
-role.credentials=Zugangsdaten
-role.new.title=Neue Rolle
-role.name=Name
-role.type.1=Benutzer
-role.type.2=Gruppe
-type.string=Text
-type.bytes=Byte[]
-type.password=Passwort Hash
-role.statline=Registriert sind {1} Benutzer und {2} Rolle(n) in {0} Gruppen.
-role.help.initial=\
-- Wählen Sie eine Rolle auf der linken Seite um sie zu öffnen und ihre
Eigenschaften und Zugangsdaten zu bearbeiten.<br/>\
-- Sie können Gruppen, Rollen und Benutzer im Baum nach Bedarf verschieben um
sie zu arrangieren und Mitgliedschaften zu definieren.<br/>\
-- Halten Sie die Ctrl/Strg Taste beim Ziehen um zu kopieren anstatt zu
verschieben.<br/>\
-- Um eine Rolle aus einer Gruppe zu entfernen, ziehen Sie sie auf das
Wurzel-Element.<br/>\
-- Rollen in <i>Kursivschrift</i> sind 'verlangte' Mitglieder in der aktuellen
Gruppe.<br/>\
-- Um eine Rolle von verlangter auf normale Mitgliedschaft umzuschalten,
doppelklicken Sie sie.
-toggleRequired=Toggle Mitgliedschaft
diff --git a/webconsole-plugins/useradmin/src/main/resources/res/book-2.png
b/webconsole-plugins/useradmin/src/main/resources/res/book-2.png
deleted file mode 100644
index e421eaa3bf..0000000000
Binary files a/webconsole-plugins/useradmin/src/main/resources/res/book-2.png
and /dev/null differ
diff --git a/webconsole-plugins/useradmin/src/main/resources/res/group.png
b/webconsole-plugins/useradmin/src/main/resources/res/group.png
deleted file mode 100644
index 1bfe488cb7..0000000000
Binary files a/webconsole-plugins/useradmin/src/main/resources/res/group.png
and /dev/null differ
diff --git
a/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/jstree.min.js
b/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/jstree.min.js
deleted file mode 100644
index e19446dd9a..0000000000
---
a/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/jstree.min.js
+++ /dev/null
@@ -1,5 +0,0 @@
-/*! jsTree - v3.0.9 - 2015-01-05 - (MIT) */
-!function(a){"use strict";"function"==typeof
define&&define.amd?define(["jquery"],a):a("object"==typeof
exports?require("jquery"):jQuery)}(function(a,b){"use strict";if(!a.jstree){var
c=0,d=!1,e=!1,f=!1,g=[],h=a("script:last").attr("src"),i=document,j=i.createElement("LI"),k,l;j.setAttribute("role","treeitem"),k=i.createElement("I"),k.className="jstree-icon
jstree-ocl",k.setAttribute("role","presentation"),j.appendChild(k),k=i.createElement("A"),k.className="jstree-anchor",k.setAttribute
[...]
-b.appendChild(m)}if(i&&b.appendChild(i),!d){for(g||(g=this.element[0]),k=0,l=g.childNodes.length;l>k;k++)if(g.childNodes[k]&&g.childNodes[k].className&&-1!==g.childNodes[k].className.indexOf("jstree-children")){s=g.childNodes[k];break}s||(s=o.createElement("UL"),s.setAttribute("role","group"),s.className="jstree-children",g.appendChild(s)),g=s,h<g.childNodes.length?g.insertBefore(b,g.childNodes[h]):g.appendChild(b),q&&(t=this.element[0].scrollTop,u=this.element[0].scrollLeft,b.childNodes
[...]
-for(f=0,g=e.length;g>f;f++)c[e[f]].state.checked=c[e[f]].original&&c[e[f]].original.state&&c[e[f]].original.state.checked,c[e[f]].state.checked&&this._data.checkbox.selected.push(e[f])},this)),(-1!==this.settings.checkbox.cascade.indexOf("up")||-1!==this.settings.checkbox.cascade.indexOf("down"))&&this.element.on("model.jstree",a.proxy(function(b,c){var
d=this._model.data,e=d[c.parent],f=c.nodes,g=[],h,i,j,k,l,m,n=this.settings.checkbox.cascade,o=this.settings.checkbox.tie_selection;if(-
[...]
-},drag:function(c){if("touchmove"===c.type&&c.originalEvent&&c.originalEvent.changedTouches&&c.originalEvent.changedTouches[0]&&(c.pageX=c.originalEvent.changedTouches[0].pageX,c.pageY=c.originalEvent.changedTouches[0].pageY,c.target=document.elementFromPoint(c.originalEvent.changedTouches[0].pageX-window.pageXOffset,c.originalEvent.changedTouches[0].pageY-window.pageYOffset)),b.is_down){if(!b.is_drag){if(!(Math.abs(c.pageX-b.init_x)>(b.is_touch?a.vakata.dnd.settings.threshold_touch:a.va
[...]
\ No newline at end of file
diff --git
a/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/themes/default/32px.png
b/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/themes/default/32px.png
deleted file mode 100644
index 1532715248..0000000000
Binary files
a/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/themes/default/32px.png
and /dev/null differ
diff --git
a/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/themes/default/40px.png
b/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/themes/default/40px.png
deleted file mode 100644
index 1959347aea..0000000000
Binary files
a/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/themes/default/40px.png
and /dev/null differ
diff --git
a/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/themes/default/style.min.css
b/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/themes/default/style.min.css
deleted file mode 100644
index 4440528ecf..0000000000
---
a/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/themes/default/style.min.css
+++ /dev/null
@@ -1 +0,0 @@
-.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:#000;white-space:nowrap;padding:0
4px 0
1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:no
[...]
\ No newline at end of file
diff --git
a/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/themes/default/throbber.gif
b/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/themes/default/throbber.gif
deleted file mode 100644
index 1b5b2fde42..0000000000
Binary files
a/webconsole-plugins/useradmin/src/main/resources/res/jstree-3.0.9/themes/default/throbber.gif
and /dev/null differ
diff --git a/webconsole-plugins/useradmin/src/main/resources/res/plugin.css
b/webconsole-plugins/useradmin/src/main/resources/res/plugin.css
deleted file mode 100644
index c375b9fada..0000000000
--- a/webconsole-plugins/useradmin/src/main/resources/res/plugin.css
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-@import url("jstree-3.0.9/themes/default/style.min.css");
-#userTree { width: 20% }
-#userTree li a { padding-left: 12px ! important}
-.header ul { float: right }
-#roleDetails .actions { width: 32px }
-input.k, input.v { width: 100% }
-#roleDetails .property-type {width: 5em}
-.actions ul { float : right }
-#newDialogRole select { width : 100% }
-li.required > a { font-style:italic }
diff --git a/webconsole-plugins/useradmin/src/main/resources/res/plugin.html
b/webconsole-plugins/useradmin/src/main/resources/res/plugin.html
deleted file mode 100644
index 9ed83f1b16..0000000000
--- a/webconsole-plugins/useradmin/src/main/resources/res/plugin.html
+++ /dev/null
@@ -1,125 +0,0 @@
-<!--
-<script type="text/javascript"
src="${pluginRoot}/res/jsTree.v.0.9.9a/jquery.tree.min.js"></script>
--->
-<script type="text/javascript"
src="${pluginRoot}/res/jstree-3.0.9/jstree.min.js"></script>
-<script type="text/javascript" src="${pluginRoot}/res/plugin.js"></script>
-<script type="text/javascript">
-// <![CDATA[
-var i18n = {
- abort : '${abort}',
- close : '${abort}',
- add : '${save}',
- root : '${role.tree.root}',
- status: '${role.statline}',
- paswd : '${type.password}'
-}
-// ]]>
-</script>
-
-<!-- status line -->
-<p class="statline"> </p>
-
-<!-- table caption -->
-<form method="post" action="${pluginRoot}">
- <div class="ui-widget-header ui-corner-top buttonGroup">
- <button id="newRole">${role.new}</button>
- <button id="reload">${reload}</button>
- </div>
-</form>
-
-<table class="nicetable">
- <tr>
- <td id="userTree">-</td>
- <td id="roleDetails">
- <table class="nicetable ui-helper-hidden">
- <thead class="ui-widget-header ">
- <tr>
- <td
class="property-name">${role.key}</td>
- <td
class="property-value">${role.value}</td>
- <td
class="property-type">${type}</td>
- <td
class="actions">${bundles.actions}</td>
- </tr>
- </thead>
- <tfoot class="ui-widget-header">
- <tr>
- <td colspan="4">
- <button
id="delRole">${delete}</button>
- <button
id="savRole">${save}</button>
- <button
id="toggleRequiredRole">${toggleRequired}</button>
- </td>
- </tr>
- </tfoot>
- <tbody>
- <tr class="ui-priority-primary header
header-props">
- <td colspan="4" class="">
- ${role.properties}
- <ul class="icons">
- <li
class="dynhover">
- <span
class="ui-icon ui-icon-plus"> </span>
- </li>
- </ul>
- </td>
- </tr>
- <tr class="ui-priority-primary header
header-cred">
- <td colspan="4">
- ${role.credentials}
- <ul class="icons">
- <li
class="dynhover">
- <span
class="ui-icon ui-icon-plus"> </span>
- </li>
- </ul>
- </td>
- </tr>
- <tr>
- <td><input class="k" /></td>
- <td><input class="v" /></td>
- <td>
- <select class="dynhover
propertyType">
- <option
value="string">${type.string}</option>
- <option
value="byte[]">${type.bytes}</option>
- <!--
- <option
value="password-MD5">${type.password-MD5}</option>
- <option
value="password-SHA1">${type.password-SHA1}</option>
- <option
value="password-SHA256">${type.password-SHA256}</option>
- <option
value="password-SHA512">${type.password-SHA512}</option>
- -->
- </select>
- </td>
- <td class="actions">
- <ul class="icons">
- <li
class="dynhover">
- <span
class="ui-icon ui-icon-trash"> </span>
- </li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <div id="roleDetailsHelp">${role.help.initial}</div>
- </td>
- </tr>
-</table>
-
-<div class="ui-helper-hidden1" title="${role.new.title}" id="newDialogRole">
- <table class="nicetable">
- <tr>
- <td class="label">
- ${role.name}
- </td>
- <td>
- <input/>
- </td>
- </tr>
- <tr>
- <td class="label">
- ${type}
- </td>
- <td>
- <select class="dynhover">
- <option
value="1">${role.type.1}</option>
- <option
value="2">${role.type.2}</option>
- </select>
- </td>
- </tr>
- </table>
-</div>
diff --git a/webconsole-plugins/useradmin/src/main/resources/res/plugin.js
b/webconsole-plugins/useradmin/src/main/resources/res/plugin.js
deleted file mode 100644
index 12f1ec61b9..0000000000
--- a/webconsole-plugins/useradmin/src/main/resources/res/plugin.js
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * 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.
- */
-// fix for jQuery tree to work with this version of jQuery
-jQuery.curCSS = jQuery.css;
-
-var userTree = false;
-var selectedRole = false;
-var selectedParent = false;
-var newDialogRole = false;
-var roleDetails = false;
-var roleDetailsHelp = false;
-var roleDetailsTable = false;
-var roleDetailsBody = false;
-var roleDetailsTemplate = false;
-var roleDetailsTemplateP = false;
-var roleDetailsTemplateC = false;
-
-function roleObj(node) {
- node = node && node.attr ? node.attr('role') : false;
- return node ? JSON.parse(node) : false;
-}
-
-var treeSettings = {
- core : {
- data : [], // will be set on load
- multiple : false,
- themes : { stripes : true },
- check_callback : function (operation, node, node_parent,
node_position, more) {
- // disable copy to root node
- if ('#' === node_parent.id) return false;
- if (operation === 'copy_node' && 'root' ===
node_parent.id) return false;
-
- if (operation === 'move_node' || operation ===
'copy_node') {
- // don't copy/move things around the same/root
level
- if (node.parent === node_parent.id) return
false;
-
- // don't copy/move if target alreay contains
the same member
- var target = node_parent.original.role;
- if (target && isMember(node.original.role,
target)) return false;
- }
- return true;
- }
- },
- plugins : [ 'dnd', 'types', 'sort' ],
- types : {
- root : { valid_children: ['t0', 't1', 't2'], icon : pluginRoot
+ '/res/book-2.png' },
- t2 : { valid_children: ['t0', 't1', 't2'], icon : pluginRoot
+ '/res/group.png' },
- t1 : { valid_children: [], icon : pluginRoot +
'/res/user.png' },
- t0 : { valid_children: [], icon : pluginRoot +
'/res/role.png' }
- }
-}
-
-function initTree(data) {
- // show help message
- roleDetailsHelp.removeClass('ui-helper-hidden');
- roleDetailsTable.addClass('ui-helper-hidden');
-
- var openNodes = [];
-
- // recreate tree, because reload doesn't work
- var userTreeRef = $.jstree.reference('#userTree');
- if (userTreeRef) {
- userTreeRef.destroy();
-
- // save state
- $.each(userTreeRef.get_node('root').children_d, function(idx,
child) {
- var node = userTreeRef.get_node(child);
- if ( node.state.opened ) openNodes.push(node.text);
- });
- }
-
- // prepare data
- var sortedGroups = sortGroups(data);
- treeSettings.core['data'] = buildTree(sortedGroups);
-
- // build tree
- userTree = $('#userTree')
- .on('select_node.jstree', function(e, data) {
- var role = data.node.original.role;
- if (role) {
- var parent = data.node.parent;
- var parent_name = parent === '#' || parent ===
'root' ? false : data.instance.get_node(parent).text;
- onSelectNode(role.name, parent_name);
- } else {
- roleDetailsHelp.removeClass('ui-helper-hidden');
- roleDetailsTable.addClass('ui-helper-hidden');
- }
- })
- .on('move_node.jstree', function(e, data) {
- var role = data.node.original.role;
- var parent = data.parent;
- var parent_name = parent === '#' || parent === 'root' ?
false : data.instance.get_node(parent).text;
- var old_parent = data.old_parent;
- var old_parent_name = old_parent === '#' || old_parent
=== 'root' ? false : data.instance.get_node(old_parent).text;
-
- if (parent_name) {
- //console.log('move: adding role', role, 'to
group', parent);
- $.post(pluginRoot, {'action': 'addMember',
'role' : role.name, 'group' : parent_name});
- }
- if (old_parent_name) {
- //console.log('move: removed role', role, 'to
group', old_parent);
- $.post(pluginRoot, {'action': 'removeMember',
'role' : role.name, 'group' : old_parent_name});
- }
- $('#reload').click();
- })
- .on('copy_node.jstree', function(e, data) {
- var role = data.original.original.role;
- var parent_name =
data.instance.get_node(data.parent).text;
-
- if (parent_name) {
- //console.log('copy: copying role', role, 'to
group', parent);
- $.post(pluginRoot, {'action': 'addMember',
'role' : role.name, 'group' : parent_name});
- }
- $('#reload').click();
- })
- .on('ready.jstree', function(e, data) { // restore state
- var _ = data.instance;
- if (openNodes.length)
$.each(_.get_node('root').children_d, function(idx, child) {
- var node = _.get_node(child);
- if ($.inArray(node.text, openNodes) > -1)
_.open_node(node, false, false);
- });
-
- }).jstree(treeSettings);
-}
-
-$(function() {
- // read the available digest algorithms
- $.ajax({
- type : "POST",
- url : pluginRoot,
- async : false,
- data : {'action': 'getDigestAlgorithms' },
- dataType: 'json',
- success : function(data) {
- var _select = $('select.propertyType');
- $.each(data, function(id, alg) {
- _select.append('<option
value="password-{0}">{1} {2}</option>'.msgFormat(alg, i18n.paswd, alg));
- });
- }
- });
-
- roleDetails = $('#roleDetails');
- roleDetailsTable = roleDetails.find('table');
- roleDetailsHelp = roleDetails.find('#roleDetailsHelp');
- roleDetailsBody = roleDetailsTable.find('tbody');
- roleDetailsTemplateP = roleDetailsBody.find('tr:eq(0)');
- roleDetailsTemplateC = roleDetailsBody.find('tr:eq(1)');
- roleDetailsTemplate = roleDetailsBody.find('tr:eq(2)').clone();
- roleDetailsBody.find('tr').not('.header').remove();
-
- // add new property/credential code
- $('tr.header span.ui-icon-plus').click(function() {
- $(this).parent().parent().parent().parent().after(newProp());
- });
-
- // new role dialog
- var _buttons = {};
- _buttons[i18n.close] = function() {
- $(this).dialog('close');
- }
- _buttons[i18n.add] = function() {
- var _ = newDialogRole;
- var n = _.find('input');
- if (!n.val()) {
- n.addClass('ui-state-error');
- return false;
- } else n.removeClass('ui-state-error');
- var t = _.find('select').val();
- $.post(pluginRoot, {'action': 'set', 'data' :
JSON.stringify({'name': n.val(), 'type': new Number(t)})} , function(data) {
- _.dialog('close');
- $('#reload').click();
- }, 'json');
- }
- newDialogRole = $("#newDialogRole").dialog({
- autoOpen : false,
- modal : true,
- open : function() {
$(this).find('input').val('').removeClass('ui-state-error') },
- closeText: i18n.abort,
- buttons : _buttons
- });
-
- // role info buttons
- $('#delRole').click( function() {
- if (selectedRole) $.post(pluginRoot, {'action': 'del', 'role' :
selectedRole}, function() {
- $('#reload').click();
- });
- });
- $('#savRole').click( doSaveRole );
- $('#toggleRequiredRole').click( function() {
- if (selectedRole && selectedParent)
- $.post(pluginRoot, { action: 'toggleMembership', role:
selectedRole, group: selectedParent }, function() {
- $('#reload').click()
- });
- });
-
- // top-frame buttons
- $('#newRole').click( function() {
- newDialogRole.dialog('open');
- return false;
- });
- $('#reload').click( function() {
- $.post(pluginRoot, {'action': 'list'} , initTree, 'json');
- return false;
- }).click();
-});
-
-function digest(val, alg) {
- var _ret = false;
- $.ajax({
- type : "POST",
- url : pluginRoot,
- async : false,
- data : {
- 'action': 'digest',
- 'data' : val,
- 'algorithm' : alg
- },
- dataType: 'json',
- success : function(data) {
- _ret = data['encoded'];
- }
- });
- return _ret;
-}
-function newProp() {
- var tr = roleDetailsTemplate.clone()
- .find('li').click( function() {
- tr.remove();
- }).end()
- .find('select').change( function(evt) {
- tr.find('.v').replaceWith('<input class="v" '+
($(this).val().indexOf('password') == 0 ? 'type="password"' : '') + '/>');
- initStaticWidgets(tr);
- }).end()
- initStaticWidgets(tr);
- return tr;
-}
-function hashToArray(s) {
- var r = [];
- while(s.length > 0) {
- r.push(parseInt(s.substring(0, 2), 16));
- s = s.substring(2);
- }
- return r;
-}
-function strToArray(s) {
- var r = [];
- var el = s.split(',');
- for(var i=0;i<el.length;i++) r.push( parseInt(el[i], 10) );
- return r;
-}
-function doSaveRole() {
- if (!selectedRole) return;
- var doProps = true;
- var data = {
- name : selectedRole,
- properties : {},
- credentials : {}
- };
- roleDetailsBody.find('tr').each( function() {
- var _ = $(this);
- if (_.hasClass('header-props')) doProps = true;
- else if (_.hasClass('header-cred')) doProps = false;
- else {
- var k = _.find('.k').val();
- var v = _.find('.v').val();
- var t = _.find('select').val();
-
- if (t.indexOf('password-') == 0) {
- var hash = digest(v, t.substring(9));
- v = hash;
- } else if (t == 'byte[]') {
- v = strToArray(v);
- }
-
- if (doProps) data.properties[k] = v;
- else data.credentials[k] = v;
- }
- });
- $.post(pluginRoot, {'action': 'set', 'data' : JSON.stringify(data)});
-}
-
-function isInMemberArray(role, g) {
- if(g) for(var i in g) if (g[i].name == role.name) return true;
- return false;
-}
-
-function isMember(role, group) {
- if (!role) return false;
- if (!group) return false;
- if (isInMemberArray(role, group.members)) return true;
- if (isInMemberArray(role, group.rmembers)) return true;
-}
-
-function buildTree(sortedGroups) {
- var treeRoot = {
- text : i18n.root,
- id : 'root',
- type : 'root',
- state: { opened : true },
- children: []
- };
- var treeNode = function(name, role, parent, req) {
- if (!role) return;
- if (!parent) parent = treeRoot.children;
- var node = {
- 'text' : role.name,
- 'type' : 't' + role.type,
- 'role' : role,
- }
- if (req) node.li_attr = { 'class' : 'required' };
- parent.push(node);
- if (role.type == 2) {
- node['children'] = [];
- node = node['children'];
- if (role.members) $.each(role.members, function(idx,
xrole) {
- treeNode(xrole.name, xrole, node, 0);
- });
- if (role.rmembers) $.each(role.rmembers, function(idx,
xrole) {
- treeNode(xrole.name, xrole, node, 1);
- });
- }
- }
-
- $.each(sortedGroups, treeNode);
- return treeRoot;
-}
-
-function sortGroups(data) {
- var rootGroups = {}; // only root groups - without parents
- var unassigned = {}; // non-groups, not assigned to any group
- var processed = {}; // all processed entries
- var u = 0;
- var g = 0;
- var r = 0;
-
- var _st = function(map, n, role) {
- if (typeof map[n] == 'undefined') { // not added - add
- map[n] = role;
- } else if (map[n] != false) { // already added
- map[n] = false; // mark for removal
- }
- }
-
- var groupF = function(i1, role) {
- var n = role.name;
- var t = role.type;
-
- if (t == 2) { // group
- // don't process twice
- if (processed[n]) {
- rootGroups[n] = false;
- return true;
- }
- processed[n]=role;
-
- _st(rootGroups, n, role);
-
- if (role.members) $.each(role.members, groupF);
- if (role.rmembers) $.each(role.rmembers, groupF);
- g++;
- } else { // role or user
- if (t == 1) u++; else r++;
- _st(unassigned, n, role);
- }
- }
-
- $.each(data, groupF);
- $('.statline').text( i18n.status.msgFormat(g,u,r) );
-
- return $.extend(rootGroups, unassigned);
-}
-
-function onSelectNode(role, parent) {
- if (parent) {
- $('#toggleRequiredRole').removeClass('ui-state-disabled');
- } else {
- $('#toggleRequiredRole').addClass('ui-state-disabled')
- }
-
- $.post(pluginRoot, {'action': 'get', 'role' : role} , function(data) {
- selectedRole = role;
- selectedParent = parent;
- roleDetailsHelp.addClass('ui-helper-hidden');
- roleDetailsTable.removeClass('ui-helper-hidden');
- roleDetailsBody.find('tr').not('.header').remove();
-
- var target = false;
- var _append = function(k,v) {
- var t = $.isArray(v) ? 'byte[]' : 'string';
- target.after(newProp()
- .data('k', k)
- .find('input.k').val(k).end()
- .find('input.v').val(v).end()
- .find('select').val(t).end()
- );
- }
- var x = data.properties;
- if (x) {
- target = roleDetailsTemplateP;
- $.each(x, _append);
- }
- x = data.credentials;
- if (x) {
- target = roleDetailsTemplateC;
- $.each(x, _append);
- }
- // show/user credentials view if user/or not (respectively)
- x = roleDetailsBody.find('.header-cred');
- if (data.type != 1) x.addClass('ui-helper-hidden');
- else x.removeClass('ui-helper-hidden');
- }, 'json')
- return false;
-}
-
diff --git a/webconsole-plugins/useradmin/src/main/resources/res/role.png
b/webconsole-plugins/useradmin/src/main/resources/res/role.png
deleted file mode 100644
index 4e9abc4b73..0000000000
Binary files a/webconsole-plugins/useradmin/src/main/resources/res/role.png and
/dev/null differ
diff --git a/webconsole-plugins/useradmin/src/main/resources/res/user.png
b/webconsole-plugins/useradmin/src/main/resources/res/user.png
deleted file mode 100644
index 627c93571f..0000000000
Binary files a/webconsole-plugins/useradmin/src/main/resources/res/user.png and
/dev/null differ