git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/create-users@126787 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
40624a6850
commit
752ddb820d
|
@ -0,0 +1,50 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" output="target/create-users-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/gwt-user.jar">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="javadoc_location" value="file:/home/costantino/Downloads/gwt-2.7.0/doc/javadoc/"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/gwt-codeserver.jar">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="javadoc_location" value="file:/home/costantino/Downloads/gwt-2.7.0/doc/javadoc/"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/gwt-dev.jar">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="javadoc_location" value="file:/home/costantino/Downloads/gwt-2.7.0/doc/javadoc/"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/validation-api-1.0.0.GA-sources.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/home/costantino/Downloads/gwt-2.7.0/validation-api-1.0.0.GA.jar" sourcepath="/home/costantino/Downloads/gwt-2.7.0/validation-api-1.0.0.GA-sources.jar"/>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/create-users-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>create-users</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||||
|
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||||
|
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src/main/webapp"/>
|
||||||
|
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="hide" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||||
|
<classpathentry kind="output" path=""/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1,2 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
filesCopiedToWebInfLib=
|
|
@ -0,0 +1,4 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
lastWarOutDir=/home/costantino/workspace/create-users/target/create-users-1.0.0-SNAPSHOT
|
||||||
|
warSrcDir=src/main/webapp
|
||||||
|
warSrcDirIsOutput=false
|
|
@ -0,0 +1,2 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
entryPointModules=
|
|
@ -0,0 +1,6 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/main/resources=UTF-8
|
||||||
|
encoding//src/test/java=UTF-8
|
||||||
|
encoding//src/test/resources=UTF-8
|
||||||
|
encoding/<project>=UTF-8
|
|
@ -0,0 +1,8 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.7
|
|
@ -0,0 +1,3 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
validateFragments=false
|
||||||
|
validation.use-project-settings=true
|
|
@ -0,0 +1,4 @@
|
||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
<wb-module deploy-name="create-users-portlet">
|
||||||
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
<property name="java-output-path" value="/create-users/target/subscribe-users-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
|
<property name="context-root" value="create-users"/>
|
||||||
|
</wb-module>
|
||||||
|
</project-modules>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<root>
|
||||||
|
<facet id="jst.jaxrs">
|
||||||
|
<node name="libprov">
|
||||||
|
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
|
||||||
|
</node>
|
||||||
|
</facet>
|
||||||
|
</root>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<faceted-project>
|
||||||
|
<fixed facet="wst.jsdt.web"/>
|
||||||
|
<installed facet="java" version="1.7"/>
|
||||||
|
<installed facet="jst.web" version="2.3"/>
|
||||||
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
|
<installed facet="jst.jaxrs" version="2.0"/>
|
||||||
|
<installed facet="liferay.portlet" version="6.0"/>
|
||||||
|
</faceted-project>
|
|
@ -0,0 +1 @@
|
||||||
|
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
|
@ -0,0 +1 @@
|
||||||
|
Window
|
|
@ -0,0 +1,2 @@
|
||||||
|
disabled=06target
|
||||||
|
eclipse.preferences.version=1
|
|
@ -0,0 +1,2 @@
|
||||||
|
${gcube.license}
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
The gCube System - ${name}
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
${description}
|
||||||
|
|
||||||
|
|
||||||
|
${gcube.description}
|
||||||
|
|
||||||
|
${gcube.funding}
|
||||||
|
|
||||||
|
|
||||||
|
Version
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
${version} (${buildDate})
|
||||||
|
|
||||||
|
Please see the file named "changelog.xml" in this directory for the release notes.
|
||||||
|
|
||||||
|
|
||||||
|
Authors
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
* Costantino Perciante at ISTI-CNR(Pisa), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||||
|
|
||||||
|
Maintainers
|
||||||
|
-----------
|
||||||
|
|
||||||
|
* Costantino Perciante at ISTI-CNR(Pisa), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||||
|
|
||||||
|
Download information
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
Source code is available from SVN:
|
||||||
|
${scm.url}
|
||||||
|
|
||||||
|
Binaries can be downloaded from the gCube website:
|
||||||
|
${gcube.website}
|
||||||
|
|
||||||
|
|
||||||
|
Installation
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
Installation documentation is available on-line in the gCube Wiki:
|
||||||
|
${gcube.wikiRoot}
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
Documentation is available on-line in the gCube Wiki:
|
||||||
|
${gcube.wikiRoot}
|
||||||
|
${gcube.wikiRoot}
|
||||||
|
|
||||||
|
Support
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
Bugs and support requests can be reported in the gCube issue tracking tool:
|
||||||
|
${gcube.issueTracking}
|
||||||
|
|
||||||
|
|
||||||
|
Licensing
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
|
@ -0,0 +1,6 @@
|
||||||
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.portlets.admin.create-users.1-0-0"
|
||||||
|
date="2016-03-28">
|
||||||
|
<Change>First Release</Change>
|
||||||
|
</Changeset>
|
||||||
|
</ReleaseNotes>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<assembly
|
||||||
|
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||||
|
<id>servicearchive</id>
|
||||||
|
<formats>
|
||||||
|
<format>tar.gz</format>
|
||||||
|
</formats>
|
||||||
|
<baseDirectory>/</baseDirectory>
|
||||||
|
<fileSets>
|
||||||
|
<fileSet>
|
||||||
|
<directory>${distroDirectory}</directory>
|
||||||
|
<outputDirectory>/</outputDirectory>
|
||||||
|
<useDefaultExcludes>true</useDefaultExcludes>
|
||||||
|
<includes>
|
||||||
|
<include>README</include>
|
||||||
|
<include>LICENSE</include>
|
||||||
|
<include>changelog.xml</include>
|
||||||
|
<include>profile.xml</include>
|
||||||
|
</includes>
|
||||||
|
<fileMode>755</fileMode>
|
||||||
|
<filtered>true</filtered>
|
||||||
|
</fileSet>
|
||||||
|
</fileSets>
|
||||||
|
<files>
|
||||||
|
<file>
|
||||||
|
<source>target/${build.finalName}.${project.packaging}</source>
|
||||||
|
<outputDirectory>/${artifactId}</outputDirectory>
|
||||||
|
</file>
|
||||||
|
|
||||||
|
</files>
|
||||||
|
</assembly>
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<ID></ID>
|
||||||
|
<Type>Service</Type>
|
||||||
|
<Profile>
|
||||||
|
<Description>${description}</Description>
|
||||||
|
<Class>PortletUser</Class>
|
||||||
|
<Name>${artifactId}</Name>
|
||||||
|
<Version>${version}</Version>
|
||||||
|
<Packages>
|
||||||
|
<Software>
|
||||||
|
<Name>${artifactId}</Name>
|
||||||
|
<Version>${version}</Version>
|
||||||
|
<MavenCoordinates>
|
||||||
|
<groupId>${groupId}</groupId>
|
||||||
|
<artifactId>${artifactId}</artifactId>
|
||||||
|
<version>${version}</version>
|
||||||
|
</MavenCoordinates>
|
||||||
|
<Files>
|
||||||
|
<File>target/${build.finalName}.war</File>
|
||||||
|
</Files>
|
||||||
|
</Software>
|
||||||
|
</Packages>
|
||||||
|
</Profile>
|
||||||
|
</Resource>
|
|
@ -0,0 +1,245 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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>
|
||||||
|
<artifactId>maven-parent</artifactId>
|
||||||
|
<groupId>org.gcube.tools</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<relativePath />
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<groupId>org.gcube.portlets.admin</groupId>
|
||||||
|
<artifactId>create-users</artifactId>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
<name>Create users portlet</name>
|
||||||
|
<description>
|
||||||
|
Create users portlet allows a VRE-Manager to enter user's personal data and automatically register he/she in the portal.
|
||||||
|
The portlet also sends a temporary password to the just registered user.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/${project.artifactId}</connection>
|
||||||
|
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/${project.artifactId}</developerConnection>
|
||||||
|
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/${project.artifactId}</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<!-- Convenience property to set the GWT version -->
|
||||||
|
<gwtVersion>2.7.0</gwtVersion>
|
||||||
|
<liferayVersion>6.0.6</liferayVersion>
|
||||||
|
<!-- GWT needs at least java 1.6 -->
|
||||||
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.7</maven.compiler.target>
|
||||||
|
|
||||||
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.gwt</groupId>
|
||||||
|
<artifactId>gwt</artifactId>
|
||||||
|
<version>${gwtVersion}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.distribution</groupId>
|
||||||
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
|
<version>LATEST</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common.portal</groupId>
|
||||||
|
<artifactId>portal-manager</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.mail</groupId>
|
||||||
|
<artifactId>javax.mail</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.gwt</groupId>
|
||||||
|
<artifactId>gwt-servlet</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<version>${gwtVersion}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.gwt</groupId>
|
||||||
|
<artifactId>gwt-user</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<version>${gwtVersion}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.gwt</groupId>
|
||||||
|
<artifactId>gwt-dev</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<version>${gwtVersion}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portal</groupId>
|
||||||
|
<artifactId>custom-portal-handler</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.gwtbootstrap</groupId>
|
||||||
|
<artifactId>gwt-bootstrap</artifactId>
|
||||||
|
<version>2.3.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.dvos</groupId>
|
||||||
|
<artifactId>usermanagement-core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.liferay.portal</groupId>
|
||||||
|
<artifactId>portal-service</artifactId>
|
||||||
|
<version>${liferayVersion}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
|
<artifactId>aslcore</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.core</groupId>
|
||||||
|
<artifactId>common-scope-maps</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.portlet</groupId>
|
||||||
|
<artifactId>portlet-api</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portal</groupId>
|
||||||
|
<artifactId>social-networking-library</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>home-library-model</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>home-library</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>asm-all</artifactId>
|
||||||
|
<groupId>asm</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>home-library-jcr</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.11</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<!-- Output classes directly into the webapp, so that IDEs and "mvn process-classes"
|
||||||
|
update them in DevMode -->
|
||||||
|
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
|
||||||
|
|
||||||
|
<plugins>
|
||||||
|
|
||||||
|
<!-- GWT Maven Plugin -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>gwt-maven-plugin</artifactId>
|
||||||
|
<version>${gwtVersion}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
<!-- <goal>test</goal> -->
|
||||||
|
<!-- <goal>generateAsync</goal> -->
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
|
||||||
|
documentation at codehaus.org -->
|
||||||
|
<configuration>
|
||||||
|
<runTarget>Statistics.html</runTarget>
|
||||||
|
<hostedWebapp>${webappDirectory}</hostedWebapp>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!-- Copy static web files before executing gwt:run -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
|
<version>2.1.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>exploded</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<webappDirectory>${webappDirectory}</webappDirectory>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>servicearchive</id>
|
||||||
|
<phase>install</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.3.2</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.7</source>
|
||||||
|
<target>1.7</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!-- SA Plugin -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.client;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main module that contains the entry point of the portlet.
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
public class CreateUsers implements EntryPoint {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onModuleLoad() {
|
||||||
|
|
||||||
|
RootPanel.get("create-users-container").add(new CreateUsersPanel());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,124 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.client;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.createusers.client.ui.AddUserForm;
|
||||||
|
import org.gcube.portlets.admin.createusers.client.ui.LoadingText;
|
||||||
|
import org.gcube.portlets.admin.createusers.client.ui.RegisteredUsersTable;
|
||||||
|
import org.gcube.portlets.admin.createusers.shared.VreUserBean;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||||
|
import com.github.gwtbootstrap.client.ui.TabPane;
|
||||||
|
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The panel that contains the list of users already registered and the form to add new ones.
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
public class CreateUsersPanel extends Composite {
|
||||||
|
|
||||||
|
// main vertical panel
|
||||||
|
private VerticalPanel mainPanel = new VerticalPanel();
|
||||||
|
|
||||||
|
// Tab panel
|
||||||
|
private TabPanel navTabs = new TabPanel();
|
||||||
|
|
||||||
|
// add user subpanel
|
||||||
|
private TabPane addUserSubPanel = new TabPane("Create New User");
|
||||||
|
|
||||||
|
// registered users subpanel
|
||||||
|
private TabPane registeredUsersSubPanel = new TabPane("Already Created Users") ;
|
||||||
|
|
||||||
|
// Create a remote service proxy to talk to the server-side user manager service.
|
||||||
|
private final HandleUsersServiceAsync userServices = GWT.create(HandleUsersService.class);
|
||||||
|
|
||||||
|
// table of registered users
|
||||||
|
private RegisteredUsersTable registeredUsersTable;
|
||||||
|
|
||||||
|
// event bus
|
||||||
|
private final HandlerManager eventBus = new HandlerManager(null);
|
||||||
|
|
||||||
|
public CreateUsersPanel(){
|
||||||
|
|
||||||
|
super();
|
||||||
|
initWidget(mainPanel);
|
||||||
|
|
||||||
|
// form panel
|
||||||
|
AddUserForm addUserForm = new AddUserForm(userServices, eventBus, this);
|
||||||
|
addUserSubPanel.add(addUserForm);
|
||||||
|
|
||||||
|
// add temporary loader for registered users table
|
||||||
|
LoadingText loader = new LoadingText();
|
||||||
|
loader.setVisible(true);
|
||||||
|
registeredUsersSubPanel.add(loader);
|
||||||
|
|
||||||
|
// add stuff to the main panel
|
||||||
|
navTabs.add(addUserSubPanel);
|
||||||
|
navTabs.add(registeredUsersSubPanel);
|
||||||
|
mainPanel.add(navTabs);
|
||||||
|
|
||||||
|
// select add user form tab
|
||||||
|
navTabs.selectTab(0);
|
||||||
|
|
||||||
|
// enlarge navTabs
|
||||||
|
mainPanel.setWidth("100%");
|
||||||
|
|
||||||
|
// squeeze the form panel
|
||||||
|
addUserSubPanel.setWidth("50%");
|
||||||
|
|
||||||
|
// require already registered users
|
||||||
|
userServices.getAlreadyRegisterdUsers(new AsyncCallback<List<VreUserBean>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<VreUserBean> result) {
|
||||||
|
|
||||||
|
if(result == null){
|
||||||
|
showProblemsRetrievingList();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GWT.log("List of registered users received!");
|
||||||
|
registeredUsersTable = new RegisteredUsersTable(result, eventBus, userServices);
|
||||||
|
registeredUsersSubPanel.clear();
|
||||||
|
registeredUsersSubPanel.add(registeredUsersTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
GWT.log("Unable to retrieve list of registered users!" + caught.toString());
|
||||||
|
showProblemsRetrievingList();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show error block if retrieving registered data fails.
|
||||||
|
*/
|
||||||
|
private void showProblemsRetrievingList() {
|
||||||
|
|
||||||
|
registeredUsersSubPanel.clear();
|
||||||
|
AlertBlock error = new AlertBlock(AlertType.ERROR);
|
||||||
|
error.setText("It is not possible to retrieve the requested data at the moment. Retry later...");
|
||||||
|
error.setAnimation(true);
|
||||||
|
error.setClose(false);
|
||||||
|
registeredUsersSubPanel.add(error);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if a user with this email has been already registered
|
||||||
|
* @param actualEmail
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isUserPresent(String actualEmail) {
|
||||||
|
return registeredUsersTable.isUserPresent(actualEmail);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.client;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.createusers.shared.VreUserBean;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
|
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
|
/**
|
||||||
|
* The client side stub for the RPC service.
|
||||||
|
*/
|
||||||
|
@RemoteServiceRelativePath("usersservice")
|
||||||
|
public interface HandleUsersService extends RemoteService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register this user to the current vre.
|
||||||
|
* @param name
|
||||||
|
* @param surname
|
||||||
|
* @param institution/organization
|
||||||
|
* @param email
|
||||||
|
* @param sendEmail
|
||||||
|
* @param isMale
|
||||||
|
* @return the registered user information or null if the registration failed
|
||||||
|
*/
|
||||||
|
VreUserBean register(String name, String surname, String institution, String email, boolean sendEmail, boolean isMale);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the list of already registered users.
|
||||||
|
* @return a list of already registered users or null in case of error
|
||||||
|
*/
|
||||||
|
List<VreUserBean> getAlreadyRegisterdUsers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete an already invited user that didn't change his password.
|
||||||
|
* @param email
|
||||||
|
*/
|
||||||
|
public boolean deleteInvitedUser(String email);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send the registration email to this user
|
||||||
|
* @param email
|
||||||
|
*/
|
||||||
|
public void sendEmailToUser(String email);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.client;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.createusers.shared.VreUserBean;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Async version of the service for the client.
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
public interface HandleUsersServiceAsync {
|
||||||
|
|
||||||
|
void getAlreadyRegisterdUsers(AsyncCallback<List<VreUserBean>> callback);
|
||||||
|
|
||||||
|
void register(String name, String surname, String institution, String email,
|
||||||
|
boolean sendEmail, boolean isMale, AsyncCallback<VreUserBean> callback);
|
||||||
|
|
||||||
|
void deleteInvitedUser(String email, AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
|
void sendEmailToUser(String email, AsyncCallback<Void> callback);
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.client.event;
|
||||||
|
import org.gcube.portlets.admin.createusers.shared.VreUserBean;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
|
||||||
|
public class AddUserEvent extends GwtEvent<AddUserEventHandler> {
|
||||||
|
public static Type<AddUserEventHandler> TYPE = new Type<AddUserEventHandler>();
|
||||||
|
|
||||||
|
private VreUserBean addedUserBean;
|
||||||
|
|
||||||
|
public AddUserEvent(VreUserBean addedUserBean) {
|
||||||
|
this.addedUserBean = addedUserBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VreUserBean getAddedUserBean() {
|
||||||
|
return addedUserBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<AddUserEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(AddUserEventHandler handler) {
|
||||||
|
handler.onAddUser(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.client.event;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
public interface AddUserEventHandler extends EventHandler {
|
||||||
|
void onAddUser(AddUserEvent event);
|
||||||
|
}
|
|
@ -0,0 +1,271 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.client.ui;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.createusers.client.CreateUsersPanel;
|
||||||
|
import org.gcube.portlets.admin.createusers.client.HandleUsersServiceAsync;
|
||||||
|
import org.gcube.portlets.admin.createusers.client.event.AddUserEvent;
|
||||||
|
import org.gcube.portlets.admin.createusers.shared.VreUserBean;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Form;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Image;
|
||||||
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.core.client.Scheduler;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.uibinder.client.UiHandler;
|
||||||
|
import com.google.gwt.user.client.Timer;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Form to add new user to the vre.
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
public class AddUserForm extends Composite{
|
||||||
|
|
||||||
|
private static AddUserFormUiBinder uiBinder = GWT
|
||||||
|
.create(AddUserFormUiBinder.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path of the image to be shown during loading
|
||||||
|
*/
|
||||||
|
public static final String imagePath = GWT.getModuleBaseURL() + "../images/loader.gif";
|
||||||
|
|
||||||
|
interface AddUserFormUiBinder extends UiBinder<Widget, AddUserForm> {
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Form form;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button submit;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
CheckBox sendMailCheckbox;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Image performingRequest;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
TextBox emailTextbox;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
TextBox nameTextbox;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
TextBox surnameTextbox;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
TextBox companyTextbox;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
AlertBlock errorBlock;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
AlertBlock successBlock;
|
||||||
|
|
||||||
|
private static final String NAME_SURNAME_PATTERN = "^[a-zA-Z\\s]*$";
|
||||||
|
|
||||||
|
private static final String EMAIL_PATTERN =
|
||||||
|
"^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
|
||||||
|
+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
|
||||||
|
|
||||||
|
private static final int HIDE_AFTER_MILLISECONDS = 10000;
|
||||||
|
|
||||||
|
private final HandleUsersServiceAsync registrationService;
|
||||||
|
|
||||||
|
private final HandlerManager eventBus;
|
||||||
|
|
||||||
|
private final CreateUsersPanel parent;
|
||||||
|
|
||||||
|
public AddUserForm(HandleUsersServiceAsync userServices, HandlerManager eventBus, CreateUsersPanel parent) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
this.registrationService = userServices;
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
this.parent = parent;
|
||||||
|
|
||||||
|
// set loader url
|
||||||
|
performingRequest.setUrl(imagePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onAttach() {
|
||||||
|
super.onAttach();
|
||||||
|
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand () {
|
||||||
|
public void execute () {
|
||||||
|
GWT.log("Setting focus");
|
||||||
|
emailTextbox.getElement().focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@UiHandler("submit")
|
||||||
|
void onClick(ClickEvent e) {
|
||||||
|
|
||||||
|
// input validation
|
||||||
|
String actualName = nameTextbox.getText();
|
||||||
|
String actualSurname = surnameTextbox.getText();
|
||||||
|
String actualEmail = emailTextbox.getText();
|
||||||
|
String actualCompany = companyTextbox.getText();
|
||||||
|
|
||||||
|
if(actualEmail.isEmpty() || !actualEmail.matches(EMAIL_PATTERN)){
|
||||||
|
|
||||||
|
showError("Wrong or empty Email field");
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(actualName.isEmpty() || !actualName.matches(NAME_SURNAME_PATTERN)){
|
||||||
|
|
||||||
|
showError("Wrong or empty Name field");
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(actualSurname.isEmpty() || !actualSurname.matches(NAME_SURNAME_PATTERN)){
|
||||||
|
|
||||||
|
showError("Wrong or empty Surname field");
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if this user is already present among the people added with this portlet
|
||||||
|
boolean presentTable = parent.isUserPresent(actualEmail);
|
||||||
|
|
||||||
|
if(presentTable){
|
||||||
|
|
||||||
|
showAlertBlockThenHide(
|
||||||
|
errorBlock,
|
||||||
|
"Please note that a user with this email already exists",
|
||||||
|
HIDE_AFTER_MILLISECONDS
|
||||||
|
);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
// show loading image
|
||||||
|
performingRequest.setVisible(true);
|
||||||
|
|
||||||
|
// disable add button
|
||||||
|
submit.setEnabled(false);
|
||||||
|
|
||||||
|
// remote service invocation
|
||||||
|
registrationService.register(
|
||||||
|
actualName,
|
||||||
|
actualSurname,
|
||||||
|
actualCompany,
|
||||||
|
actualEmail,
|
||||||
|
sendMailCheckbox.getValue(),
|
||||||
|
// maleCheckbox.getValue(),
|
||||||
|
true,
|
||||||
|
new AsyncCallback<VreUserBean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
GWT.log("There was an error while adding the new user.", caught);
|
||||||
|
showAlertBlockThenHide(
|
||||||
|
errorBlock,
|
||||||
|
"It is not possible to add this user at the moment, retry later.",
|
||||||
|
HIDE_AFTER_MILLISECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(VreUserBean result) {
|
||||||
|
|
||||||
|
if(result == null){
|
||||||
|
|
||||||
|
GWT.log("There was an error while adding the new user."
|
||||||
|
+ " Are you sure he/she is not already present?");
|
||||||
|
|
||||||
|
showAlertBlockThenHide(
|
||||||
|
errorBlock,
|
||||||
|
"It is not possible to add this user at the moment, retry later."
|
||||||
|
+ " Also check that he/she was not already registered in the portal.",
|
||||||
|
HIDE_AFTER_MILLISECONDS);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
showAlertBlockThenHide(
|
||||||
|
successBlock,
|
||||||
|
"User correctly added to this VRE",
|
||||||
|
HIDE_AFTER_MILLISECONDS);
|
||||||
|
|
||||||
|
// append to the list of registered users
|
||||||
|
eventBus.fireEvent(new AddUserEvent(result));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset form
|
||||||
|
form.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showAlertBlockThenHide(final AlertBlock alert, String msg, int hideAfterMs){
|
||||||
|
|
||||||
|
// hide loading image
|
||||||
|
performingRequest.setVisible(false);
|
||||||
|
|
||||||
|
// enable button again
|
||||||
|
submit.setEnabled(true);
|
||||||
|
|
||||||
|
// set text
|
||||||
|
alert.setText(msg);
|
||||||
|
alert.setVisible(true);
|
||||||
|
|
||||||
|
// hide after a while
|
||||||
|
Timer t = new Timer() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
alert.setVisible(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
t.schedule(hideAfterMs);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showError(String msg) {
|
||||||
|
|
||||||
|
errorBlock.setText(msg);
|
||||||
|
errorBlock.setVisible(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideAlertBlocks(){
|
||||||
|
|
||||||
|
errorBlock.setVisible(false);
|
||||||
|
successBlock.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiHandler("emailTextbox")
|
||||||
|
void onChangeEmailTextbox(KeyUpEvent event){
|
||||||
|
hideAlertBlocks();
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiHandler("nameTextbox")
|
||||||
|
void onChangeNameTextbox(KeyUpEvent event){
|
||||||
|
hideAlertBlocks();
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiHandler("surnameTextbox")
|
||||||
|
void onChangeSurnameTextbox(KeyUpEvent event){
|
||||||
|
hideAlertBlocks();
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiHandler("companyTextbox")
|
||||||
|
void onChangeCompanyTextbox(KeyUpEvent event){
|
||||||
|
hideAlertBlocks();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
<ui:style>
|
||||||
|
.form-main-style {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fieldset-border-style {
|
||||||
|
border: 1px groove #444;
|
||||||
|
-webkit-box-shadow: 0px 0px 0px 0px #000;
|
||||||
|
box-shadow: 0px 0px 0px 0px #000;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legend-style {
|
||||||
|
width: auto;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@external .form-horizontal .control-label;
|
||||||
|
.form-horizontal .control-label {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
@external .form-horizontal .input-large;
|
||||||
|
.form-horizontal .input-large {
|
||||||
|
width: 95%;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-alert-style {
|
||||||
|
margin-top: 10px;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel>
|
||||||
|
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
|
||||||
|
ui:field="form">
|
||||||
|
<b:Fieldset styleName="{style.fieldset-border-style}">
|
||||||
|
|
||||||
|
<b:Legend styleName="{style.legend-style}">
|
||||||
|
Insert User Information
|
||||||
|
<small>* is required</small>
|
||||||
|
</b:Legend>
|
||||||
|
|
||||||
|
<b:ControlGroup>
|
||||||
|
|
||||||
|
<b:ControlLabel for="email" title="User's email">
|
||||||
|
<font color="red">*</font>
|
||||||
|
E-mail:
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:TextBox alternateSize="LARGE" placeholder="E-mail"
|
||||||
|
b:id="email" title="User's email" ui:field="emailTextbox" />
|
||||||
|
</b:Controls>
|
||||||
|
|
||||||
|
<b:ControlLabel for="name" title="User's name">
|
||||||
|
<font color="red">*</font>
|
||||||
|
Name:
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:TextBox alternateSize="LARGE" placeholder="Name"
|
||||||
|
b:id="name" title="User's name" ui:field="nameTextbox" />
|
||||||
|
</b:Controls>
|
||||||
|
|
||||||
|
<b:ControlLabel for="surname" title="User's surname">
|
||||||
|
<font color="red">*</font>
|
||||||
|
Surname:
|
||||||
|
</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:TextBox alternateSize="LARGE" placeholder="Surname"
|
||||||
|
b:id="surname" title="User's surname" ui:field="surnameTextbox" />
|
||||||
|
</b:Controls>
|
||||||
|
|
||||||
|
<b:ControlLabel for="company" title="User's company">Institution/Organization:</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:TextBox alternateSize="LARGE" placeholder="Institution/Organization"
|
||||||
|
b:id="company" title="User's Institution/Organization" ui:field="companyTextbox" />
|
||||||
|
</b:Controls>
|
||||||
|
|
||||||
|
<b:ControlLabel for="sendmail"
|
||||||
|
title="Send a notification mail to the user">Send mail:</b:ControlLabel>
|
||||||
|
<b:Controls>
|
||||||
|
<b:CheckBox b:id="sendmail" title="Send a notification mail to the user"
|
||||||
|
checked="true" ui:field="sendMailCheckbox"></b:CheckBox>
|
||||||
|
</b:Controls>
|
||||||
|
|
||||||
|
<!-- <b:ControlLabel title="User's gender">Gender</b:ControlLabel> -->
|
||||||
|
<!-- <b:Controls> -->
|
||||||
|
<!-- <b:RadioButton b:id="gender" checked="true" title="Male" -->
|
||||||
|
<!-- ui:field="maleCheckbox" name="gender">Male</b:RadioButton> -->
|
||||||
|
<!-- <b:RadioButton b:id="gender" title="Female" -->
|
||||||
|
<!-- ui:field="femaleCheckbox" name="gender">Female</b:RadioButton> -->
|
||||||
|
<!-- </b:Controls> -->
|
||||||
|
|
||||||
|
<br></br>
|
||||||
|
|
||||||
|
<b:Controls>
|
||||||
|
<b:Button addStyleNames="btn" ui:field="submit" type="PRIMARY"
|
||||||
|
title="Add user" block="true">Add</b:Button>
|
||||||
|
</b:Controls>
|
||||||
|
|
||||||
|
<br></br>
|
||||||
|
|
||||||
|
<b:Image ui:field="performingRequest" visible="false"></b:Image>
|
||||||
|
|
||||||
|
<b:AlertBlock type="ERROR" close="false" animation="true"
|
||||||
|
visible="false" ui:field="errorBlock" styleName="{style.block-alert-style}"></b:AlertBlock>
|
||||||
|
|
||||||
|
<b:AlertBlock type="SUCCESS" close="false" animation="true"
|
||||||
|
visible="false" ui:field="successBlock" styleName="{style.block-alert-style}"></b:AlertBlock>
|
||||||
|
|
||||||
|
</b:ControlGroup>
|
||||||
|
</b:Fieldset>
|
||||||
|
</b:Form>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -0,0 +1,19 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.client.ui;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
public class LoadingText extends Composite {
|
||||||
|
|
||||||
|
private static LoadingTextUiBinder uiBinder = GWT
|
||||||
|
.create(LoadingTextUiBinder.class);
|
||||||
|
|
||||||
|
interface LoadingTextUiBinder extends UiBinder<Widget, LoadingText> {
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoadingText() {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
<g:VerticalPanel horizontalAlignment="CENTER" width="100%">
|
||||||
|
<b:Icon type="GEAR" size="FOUR_TIMES" spin="true" />
|
||||||
|
<b:Caption>
|
||||||
|
<b:Heading size="4">Please wait</b:Heading>
|
||||||
|
<b:Paragraph>
|
||||||
|
Contacting database...
|
||||||
|
</b:Paragraph>
|
||||||
|
</b:Caption>
|
||||||
|
</g:VerticalPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -0,0 +1,432 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.client.ui;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.createusers.client.HandleUsersServiceAsync;
|
||||||
|
import org.gcube.portlets.admin.createusers.client.event.AddUserEvent;
|
||||||
|
import org.gcube.portlets.admin.createusers.client.event.AddUserEventHandler;
|
||||||
|
import org.gcube.portlets.admin.createusers.shared.VreUserBean;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.CellTable;
|
||||||
|
import com.google.gwt.cell.client.ButtonCell;
|
||||||
|
import com.google.gwt.cell.client.Cell;
|
||||||
|
import com.google.gwt.cell.client.TextCell;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.dom.client.Element;
|
||||||
|
import com.google.gwt.dom.client.EventTarget;
|
||||||
|
import com.google.gwt.dom.client.NativeEvent;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
|
import com.google.gwt.user.cellview.client.Column;
|
||||||
|
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.view.client.ListDataProvider;
|
||||||
|
import com.google.gwt.view.client.Range;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show already registered users list.
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
public class RegisteredUsersTable extends Composite {
|
||||||
|
|
||||||
|
//CellTable custom UI resource
|
||||||
|
private CellTable.Resources tableRes = GWT.create(TableResources.class);
|
||||||
|
protected ListDataProvider<VreUserBean> dataProvider = new ListDataProvider<VreUserBean>();
|
||||||
|
private CellTable<VreUserBean> table = new CellTable<VreUserBean>(1, tableRes);
|
||||||
|
private final HandlerManager eventBus;
|
||||||
|
|
||||||
|
public RegisteredUsersTable(List<VreUserBean> registeredUsers, HandlerManager eventBus, final HandleUsersServiceAsync userServices) {
|
||||||
|
|
||||||
|
super();
|
||||||
|
initWidget(table);
|
||||||
|
|
||||||
|
// bind event
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
bind();
|
||||||
|
|
||||||
|
dataProvider.setList(registeredUsers);
|
||||||
|
dataProvider.addDataDisplay(table);
|
||||||
|
table.setStriped(true);
|
||||||
|
table.setWidth("95%", false);
|
||||||
|
table.addStyleName("table-style");
|
||||||
|
table.setVisibleRange(new Range(0, registeredUsers.size()));
|
||||||
|
table.setBordered(true);
|
||||||
|
table.setRowCount(registeredUsers.size(), true);
|
||||||
|
|
||||||
|
// column for mail and sorting handler
|
||||||
|
Column<VreUserBean, String> emailCol = getColumn(new TextCell(), new GetValue<String>() {
|
||||||
|
@Override
|
||||||
|
public String getValue(VreUserBean user) {
|
||||||
|
return user.getEmail();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ListHandler<VreUserBean> emailColHandler = new ListHandler<VreUserBean>(dataProvider.getList());
|
||||||
|
emailColHandler.setComparator(emailCol, new Comparator<VreUserBean>() {
|
||||||
|
@Override
|
||||||
|
public int compare(VreUserBean o1, VreUserBean o2) {
|
||||||
|
|
||||||
|
return o1.getEmail().compareTo(o2.getEmail());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
emailCol.setSortable(true);
|
||||||
|
emailCol.setDefaultSortAscending(false);
|
||||||
|
table.addColumnSortHandler(emailColHandler);
|
||||||
|
|
||||||
|
// name column plus handler for sorting
|
||||||
|
Column<VreUserBean, String> nameCol = getColumn(new TextCell(), new GetValue<String>() {
|
||||||
|
@Override
|
||||||
|
public String getValue(VreUserBean user) {
|
||||||
|
return user.getName();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ListHandler<VreUserBean> nameColHandler = new ListHandler<VreUserBean>(dataProvider.getList());
|
||||||
|
nameColHandler.setComparator(nameCol, new Comparator<VreUserBean>() {
|
||||||
|
@Override
|
||||||
|
public int compare(VreUserBean o1, VreUserBean o2) {
|
||||||
|
|
||||||
|
return o1.getName().compareTo(o2.getName());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
nameCol.setSortable(true);
|
||||||
|
nameCol.setDefaultSortAscending(false);
|
||||||
|
table.addColumnSortHandler(nameColHandler);
|
||||||
|
|
||||||
|
// surname column plus handler for sorting
|
||||||
|
Column<VreUserBean, String> surnameCol = getColumn(new TextCell(), new GetValue<String>() {
|
||||||
|
@Override
|
||||||
|
public String getValue(VreUserBean user) {
|
||||||
|
return user.getSurname();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ListHandler<VreUserBean> surnameColHandler = new ListHandler<VreUserBean>(dataProvider.getList());
|
||||||
|
nameColHandler.setComparator(surnameCol, new Comparator<VreUserBean>() {
|
||||||
|
@Override
|
||||||
|
public int compare(VreUserBean o1, VreUserBean o2) {
|
||||||
|
|
||||||
|
return o1.getSurname().compareTo(o2.getSurname());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
surnameCol.setSortable(true);
|
||||||
|
surnameCol.setDefaultSortAscending(false);
|
||||||
|
table.addColumnSortHandler(surnameColHandler);
|
||||||
|
|
||||||
|
// institution/organization and handler for sorting
|
||||||
|
Column<VreUserBean, String> institutionCol = getColumn(new TextCell(), new GetValue<String>() {
|
||||||
|
@Override
|
||||||
|
public String getValue(VreUserBean user) {
|
||||||
|
return user.getInstitution();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ListHandler<VreUserBean> institutionColHandler = new ListHandler<VreUserBean>(dataProvider.getList());
|
||||||
|
institutionColHandler.setComparator(institutionCol, new Comparator<VreUserBean>() {
|
||||||
|
@Override
|
||||||
|
public int compare(VreUserBean o1, VreUserBean o2) {
|
||||||
|
|
||||||
|
return o1.getInstitution().compareTo(o2.getInstitution());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
institutionCol.setSortable(true);
|
||||||
|
institutionCol.setDefaultSortAscending(false);
|
||||||
|
table.addColumnSortHandler(institutionColHandler);
|
||||||
|
|
||||||
|
// password and handler for sorting
|
||||||
|
Column<VreUserBean, String> passwordChanged = getColumn(new TextCell(), new GetValue<String>() {
|
||||||
|
@Override
|
||||||
|
public String getValue(VreUserBean user) {
|
||||||
|
return (user.isPasswordChanged() ? "True" : "False");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ListHandler<VreUserBean> passwordChangedColHandler = new ListHandler<VreUserBean>(dataProvider.getList());
|
||||||
|
passwordChangedColHandler.setComparator(passwordChanged, new Comparator<VreUserBean>() {
|
||||||
|
@Override
|
||||||
|
public int compare(VreUserBean o1, VreUserBean o2) {
|
||||||
|
|
||||||
|
String o1PasswordChangedString = o1.isPasswordChanged() ? "True" : "False";
|
||||||
|
String o2PasswordChangedString = o2.isPasswordChanged() ? "True" : "False";
|
||||||
|
return o1PasswordChangedString.compareTo(o2PasswordChangedString);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
passwordChanged.setSortable(true);
|
||||||
|
passwordChanged.setDefaultSortAscending(false);
|
||||||
|
table.addColumnSortHandler(passwordChangedColHandler);
|
||||||
|
|
||||||
|
// registration column plus handler for sorting
|
||||||
|
Column<VreUserBean, String> registrationDate = getColumn(new TextCell(), new GetValue<String>() {
|
||||||
|
@Override
|
||||||
|
public String getValue(VreUserBean user) {
|
||||||
|
return DateTimeFormat.getShortDateFormat().format(new Date(user.getRegisrationDate()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ListHandler<VreUserBean> registrationDateColHandler = new ListHandler<VreUserBean>(dataProvider.getList());
|
||||||
|
registrationDateColHandler.setComparator(registrationDate, new Comparator<VreUserBean>() {
|
||||||
|
@Override
|
||||||
|
public int compare(VreUserBean o1, VreUserBean o2) {
|
||||||
|
return new Long(o1.getRegisrationDate()).compareTo(new Long(o2.getRegisrationDate()));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
registrationDate.setDefaultSortAscending(false);
|
||||||
|
registrationDate.setSortable(true);
|
||||||
|
table.addColumnSortHandler(registrationDateColHandler);
|
||||||
|
table.getColumnSortList().push(registrationDate);
|
||||||
|
|
||||||
|
// delete option
|
||||||
|
Column<VreUserBean, String> deleteUser = new Column<VreUserBean, String>(new ButtonCell()) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValue(VreUserBean object) {
|
||||||
|
return object.isPasswordChanged() ? "True" : "False"; // useless
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Cell.Context context, VreUserBean value, SafeHtmlBuilder sb){
|
||||||
|
|
||||||
|
if(value == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!value.isPasswordChanged())
|
||||||
|
sb.appendHtmlConstant("<Button>Delete User</Button>");
|
||||||
|
else
|
||||||
|
sb.appendHtmlConstant("<Button disabled>Delete User</Button>");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBrowserEvent(Cell.Context context, final Element parent, final VreUserBean user, NativeEvent event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
if(!"click".equals(event.getType()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
EventTarget eventTarget = event.getEventTarget();
|
||||||
|
|
||||||
|
if(parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))){
|
||||||
|
|
||||||
|
// get the button and disable it
|
||||||
|
parent.getFirstChildElement().setPropertyBoolean("disabled", true);
|
||||||
|
|
||||||
|
userServices.deleteInvitedUser(user.getEmail(), new AsyncCallback<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Boolean result) {
|
||||||
|
|
||||||
|
// delete this row too
|
||||||
|
if(result){
|
||||||
|
|
||||||
|
dataProvider.getList().remove(user);
|
||||||
|
table.setVisibleRange(new Range(0, dataProvider.getList().size()));
|
||||||
|
table.setRowCount(dataProvider.getList().size(), true);
|
||||||
|
dataProvider.refresh();
|
||||||
|
|
||||||
|
Window.alert("Deleted user with email " + user.getEmail());
|
||||||
|
|
||||||
|
}else
|
||||||
|
Window.alert("Unable to delete this user, sorry!");
|
||||||
|
|
||||||
|
// enable the button again
|
||||||
|
parent.getFirstChildElement().setPropertyBoolean("disabled", false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
Window.alert("Unable to delete this user, sorry!");
|
||||||
|
|
||||||
|
// enable the button again
|
||||||
|
parent.getFirstChildElement().setPropertyBoolean("disabled", false);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// send email option
|
||||||
|
Column<VreUserBean, String> sendWelcomeMessage = new Column<VreUserBean, String>(new ButtonCell()) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getValue(VreUserBean object) {
|
||||||
|
return "Send Welcome"; // useless
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Cell.Context context, VreUserBean value, SafeHtmlBuilder sb){
|
||||||
|
|
||||||
|
if(value == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sb.appendHtmlConstant("<Button>Send Welcome</Button>");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBrowserEvent(Cell.Context context, final Element parent, final VreUserBean user, NativeEvent event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
if(!"click".equals(event.getType()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
EventTarget eventTarget = event.getEventTarget();
|
||||||
|
|
||||||
|
if(parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))){
|
||||||
|
|
||||||
|
// get the button and disable it
|
||||||
|
parent.getFirstChildElement().setPropertyBoolean("disabled", true);
|
||||||
|
|
||||||
|
userServices.sendEmailToUser(user.getEmail(), new AsyncCallback<Void>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Void result) {
|
||||||
|
|
||||||
|
Window.alert("Welcome message sent to " + user.getEmail());
|
||||||
|
|
||||||
|
// get the button and enable it
|
||||||
|
parent.getFirstChildElement().setPropertyBoolean("disabled", false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
Window.alert("Unable to send the welcome message to " + user.getEmail());
|
||||||
|
|
||||||
|
// get the button and enable it
|
||||||
|
parent.getFirstChildElement().setPropertyBoolean("disabled", false);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// add columns
|
||||||
|
SafeHtmlBuilder builder = new SafeHtmlBuilder();
|
||||||
|
builder.appendHtmlConstant("<span title=\"" + "Registered user's email"+ "\">");
|
||||||
|
builder.appendEscaped("Email");
|
||||||
|
builder.appendHtmlConstant("</span>");
|
||||||
|
table.addColumn(emailCol, builder.toSafeHtml());
|
||||||
|
builder = new SafeHtmlBuilder();
|
||||||
|
builder.appendHtmlConstant("<span title=\"" + "Registered user's name"+ "\">");
|
||||||
|
builder.appendEscaped("Name");
|
||||||
|
builder.appendHtmlConstant("</span>");
|
||||||
|
table.addColumn(nameCol, builder.toSafeHtml());
|
||||||
|
builder = new SafeHtmlBuilder();
|
||||||
|
builder.appendHtmlConstant("<span title=\"" + "Registered user's surname"+ "\">");
|
||||||
|
builder.appendEscaped("Surname");
|
||||||
|
builder.appendHtmlConstant("</span>");
|
||||||
|
table.addColumn(surnameCol, builder.toSafeHtml());
|
||||||
|
builder = new SafeHtmlBuilder();
|
||||||
|
builder.appendHtmlConstant("<span title=\"" + "Registered user's institution/organization"+ "\">");
|
||||||
|
builder.appendEscaped("Institution / Organisation");
|
||||||
|
builder.appendHtmlConstant("</span>");
|
||||||
|
table.addColumn(institutionCol, builder.toSafeHtml());
|
||||||
|
builder = new SafeHtmlBuilder();
|
||||||
|
builder.appendHtmlConstant("<span title=\"" + "Did he/she change the default password?"+ "\">");
|
||||||
|
builder.appendEscaped("Password Changed");
|
||||||
|
builder.appendHtmlConstant("</span>");
|
||||||
|
table.addColumn(passwordChanged, builder.toSafeHtml());
|
||||||
|
builder = new SafeHtmlBuilder();
|
||||||
|
builder.appendHtmlConstant("<span title=\"" + "Registration date"+ "\">");
|
||||||
|
builder.appendEscaped("Registration date");
|
||||||
|
builder.appendHtmlConstant("</span>");
|
||||||
|
table.addColumn(registrationDate, builder.toSafeHtml());
|
||||||
|
builder = new SafeHtmlBuilder();
|
||||||
|
builder.appendHtmlConstant("<span title=\"" + "Delete User"+ "\">");
|
||||||
|
builder.appendEscaped("Delete");
|
||||||
|
builder.appendHtmlConstant("</span>");
|
||||||
|
table.addColumn(deleteUser, builder.toSafeHtml());
|
||||||
|
builder = new SafeHtmlBuilder();
|
||||||
|
builder.appendHtmlConstant("<span title=\"" + "Send Welcome Message" + "\">");
|
||||||
|
builder.appendEscaped("Send Welcome");
|
||||||
|
builder.appendHtmlConstant("</span>");
|
||||||
|
table.addColumn(sendWelcomeMessage, builder.toSafeHtml());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* events binder
|
||||||
|
*/
|
||||||
|
private void bind() {
|
||||||
|
eventBus.addHandler(AddUserEvent.TYPE, new AddUserEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddUser(AddUserEvent user) {
|
||||||
|
|
||||||
|
addUserToTable(user);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the list of registered users
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
private void addUserToTable(AddUserEvent event) {
|
||||||
|
|
||||||
|
VreUserBean userToAdd = event.getAddedUserBean();
|
||||||
|
GWT.log("Adding " + userToAdd);
|
||||||
|
dataProvider.getList().add(userToAdd);
|
||||||
|
table.setVisibleRange(new Range(0, dataProvider.getList().size()));
|
||||||
|
table.setRowCount(dataProvider.getList().size(), true);
|
||||||
|
dataProvider.refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if a user whit this email already exists
|
||||||
|
* @param actualEmail
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isUserPresent(String actualEmail) {
|
||||||
|
List<VreUserBean> users = dataProvider.getList();
|
||||||
|
|
||||||
|
for (VreUserBean vreUserBean : users) {
|
||||||
|
if(vreUserBean.getEmail().equals(actualEmail))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for getting a cell value
|
||||||
|
* @param <C>
|
||||||
|
*/
|
||||||
|
private static interface GetValue<C> {
|
||||||
|
C getValue(VreUserBean user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get a column
|
||||||
|
*
|
||||||
|
* @param <C> the cell type
|
||||||
|
* @param cell the cell used to render the column
|
||||||
|
* @param getter the value getter for the cell
|
||||||
|
*/
|
||||||
|
private <C> Column<VreUserBean, C> getColumn(Cell<C> cell, final GetValue<C> getter) {
|
||||||
|
Column<VreUserBean, C> column = new Column<VreUserBean, C>(cell) {
|
||||||
|
@Override
|
||||||
|
public C getValue(VreUserBean object) {
|
||||||
|
return getter.getValue(object);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return column;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
.cellTableHeader {
|
||||||
|
/* padding: 0px; */
|
||||||
|
/* color: #545454; */
|
||||||
|
/* text-align: center !important; */
|
||||||
|
/* font-size: 13px; */
|
||||||
|
/* background-image: none; */
|
||||||
|
/* background-color: #cfcfcf; */
|
||||||
|
/* height: 25px; */
|
||||||
|
vertical-align: bottom!important;
|
||||||
|
font-weight: bold;
|
||||||
|
/* text-shadow: 0 1px 1px rgba(255, 255, 255, .7); */
|
||||||
|
/* border: 2px solid #999999; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableFirstColumnHeader {
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableLastColumnHeader {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableCell {
|
||||||
|
padding: 4px;
|
||||||
|
/* text-align: center !important; */
|
||||||
|
vertical-align: middle !important;
|
||||||
|
overflow: hidden;
|
||||||
|
font-size: 12px;
|
||||||
|
/* border: 1px dotted #999999; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableEvenRow {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableOddRow {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableSelectedRow {
|
||||||
|
background: #628cd5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableSelectedRowCell {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableHoveredRow {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableHoveredRowCell {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableKeyboardSelectedRow {
|
||||||
|
background: #c9c9c1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableKeyboardSelectedRowCell {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableKeyboardSelectedCell {
|
||||||
|
border: none;
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.client.ui;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.CellTable;
|
||||||
|
|
||||||
|
public interface TableResources extends CellTable.Resources{
|
||||||
|
|
||||||
|
@Source({CellTable.Style.DEFAULT_CSS, "org/gcube/portlets/admin/createusers/client/ui/Table.css"})
|
||||||
|
TableStyle cellTableStyle();
|
||||||
|
|
||||||
|
interface TableStyle extends CellTable.Style {}
|
||||||
|
}
|
|
@ -0,0 +1,551 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.server;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.mail.internet.InternetAddress;
|
||||||
|
|
||||||
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
|
import org.gcube.application.framework.core.session.SessionManager;
|
||||||
|
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||||
|
import org.gcube.common.portal.PortalContext;
|
||||||
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
|
import org.gcube.portlets.admin.createusers.client.HandleUsersService;
|
||||||
|
import org.gcube.portlets.admin.createusers.shared.VreUserBean;
|
||||||
|
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||||
|
import org.gcube.vomanagement.usermanagement.exception.UserManagementPortalException;
|
||||||
|
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||||
|
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayGroupManager;
|
||||||
|
import org.gcube.vomanagement.usermanagement.impl.liferay.LiferayUserManager;
|
||||||
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
import com.liferay.mail.service.MailServiceUtil;
|
||||||
|
import com.liferay.portal.kernel.dao.jdbc.DataAccess;
|
||||||
|
import com.liferay.portal.kernel.exception.PortalException;
|
||||||
|
import com.liferay.portal.kernel.exception.SystemException;
|
||||||
|
import com.liferay.portal.kernel.mail.MailMessage;
|
||||||
|
import com.liferay.portal.kernel.util.GetterUtil;
|
||||||
|
import com.liferay.portal.kernel.util.PropsUtil;
|
||||||
|
import com.liferay.portal.model.Company;
|
||||||
|
import com.liferay.portal.service.CompanyLocalServiceUtil;
|
||||||
|
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
|
import com.liferay.portal.util.PortalUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The server side implementation of the RPC service.
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
public class CreateUsersImpl extends RemoteServiceServlet implements HandleUsersService{
|
||||||
|
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(CreateUsersImpl.class);
|
||||||
|
private static final long serialVersionUID = -3124676000683430170L;
|
||||||
|
private static final String REGISTERED_USERS_TABLE = "registered_users";
|
||||||
|
|
||||||
|
//dev user
|
||||||
|
public static final String userid = "test.user";
|
||||||
|
|
||||||
|
//dev vre
|
||||||
|
private static final String vreID = "/gcube/devsec/devVRE";
|
||||||
|
|
||||||
|
// SQL TABLE FIELDS
|
||||||
|
private static final String FIELD_EMAIL = "email";
|
||||||
|
private static final String FIELD_NAME = "name";
|
||||||
|
private static final String FIELD_SURNAME = "surname";
|
||||||
|
private static final String FIELD_INSTITUTION = "institution_organization";
|
||||||
|
private static final String FIELD_REGISTRATION_DATE = "registration_date";
|
||||||
|
private static final String FIELD_VRE = "vre";
|
||||||
|
|
||||||
|
public static final String DEFAULT_COMPANY_WEB_ID = "liferay.com";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(){
|
||||||
|
|
||||||
|
logger.debug("Trying to get connect to liferay's DB from API");
|
||||||
|
try {
|
||||||
|
|
||||||
|
Connection con = DataAccess.getConnection();
|
||||||
|
logger.debug("Connected!");
|
||||||
|
|
||||||
|
// check if the table already exists
|
||||||
|
boolean exists = tableExists(con);
|
||||||
|
|
||||||
|
if(exists){
|
||||||
|
logger.debug("Table " + REGISTERED_USERS_TABLE + " already exists.");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
initializeTable(con);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Failed to connect to liferay's DB");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check if tables exist in the database
|
||||||
|
* @param conn .
|
||||||
|
* @throws SQLException
|
||||||
|
*/
|
||||||
|
private boolean tableExists(Connection con) throws SQLException {
|
||||||
|
logger.debug("Looking for " + REGISTERED_USERS_TABLE + " table");
|
||||||
|
Statement s = con.createStatement();
|
||||||
|
ResultSet rs = s.executeQuery("SELECT * FROM pg_tables where schemaname='public' and tablename = '" + REGISTERED_USERS_TABLE +"' ");
|
||||||
|
boolean toReturn = rs.next();
|
||||||
|
if (toReturn)
|
||||||
|
logger.debug("Auxiliary Table Found! Returning ... ");
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create the table REGISTERED_USERS_TABLE
|
||||||
|
* @throws SQLException
|
||||||
|
*/
|
||||||
|
private void initializeTable(Connection con) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
logger.debug("Creating table " + REGISTERED_USERS_TABLE);
|
||||||
|
Statement s = con.createStatement();
|
||||||
|
|
||||||
|
s.execute("CREATE TABLE " + REGISTERED_USERS_TABLE
|
||||||
|
+ " (id serial primary key, " // like autoincrement
|
||||||
|
+ "email varchar(255) NOT NULL, "
|
||||||
|
+ "name" + " varchar(255) NOT NULL, "
|
||||||
|
+ "surname" + " varchar(255) NOT NULL, "
|
||||||
|
+ "institution_organization" + " varchar(255) DEFAULT NULL, "
|
||||||
|
+ "vre" + " varchar(255) NOT NULL, "
|
||||||
|
+ "registration_date" + " TIMESTAMP NOT NULL)");
|
||||||
|
|
||||||
|
logger.debug(REGISTERED_USERS_TABLE + " created");
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
logger.error("Error while creating table", e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
con.close();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
logger.error("Error while closing connection", e1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* the current ASLSession
|
||||||
|
* @return the session
|
||||||
|
*/
|
||||||
|
private ASLSession getASLSession() {
|
||||||
|
|
||||||
|
String sessionID = this.getThreadLocalRequest().getSession().getId();
|
||||||
|
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
||||||
|
|
||||||
|
if (user == null) {
|
||||||
|
|
||||||
|
logger.warn("USER IS NULL setting " + userid + " and Running OUTSIDE PORTAL");
|
||||||
|
user = getDevelopmentUser();
|
||||||
|
SessionManager.getInstance().getASLSession(sessionID, user).setScope(vreID);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Online or in development mode?
|
||||||
|
* @return true if you're running into the portal, false if in development
|
||||||
|
*/
|
||||||
|
private boolean isWithinPortal() {
|
||||||
|
try {
|
||||||
|
UserLocalServiceUtil.getService();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (com.liferay.portal.kernel.bean.BeanLocatorException ex) {
|
||||||
|
logger.trace("Development Mode ON");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* when packaging test will fail if the user is not set to test.user
|
||||||
|
* @return .
|
||||||
|
*/
|
||||||
|
public String getDevelopmentUser() {
|
||||||
|
String user = userid;
|
||||||
|
// user = "costantino.perciante";
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteInvitedUser(String email) {
|
||||||
|
|
||||||
|
// if in dev mode return some samples
|
||||||
|
if (!isWithinPortal()) {
|
||||||
|
|
||||||
|
logger.debug("In dev mode.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
Connection con = DataAccess.getConnection();
|
||||||
|
boolean deletedLiferay = deleteUserFromLiferay(email);
|
||||||
|
boolean deletedTable = deleteUserFromTable(email, con);
|
||||||
|
return deletedLiferay && deletedTable;
|
||||||
|
|
||||||
|
}catch(SQLException e){
|
||||||
|
logger.debug("Error while trying to delete user with email = " + email, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendEmailToUser(String email) {
|
||||||
|
|
||||||
|
logger.debug("Sending welcome message to user with email " + email);
|
||||||
|
try{
|
||||||
|
|
||||||
|
PortalContext context = PortalContext.getConfiguration();
|
||||||
|
String gatewayName = context.getGatewayName();
|
||||||
|
String emailSender = context.getSenderEmail();
|
||||||
|
|
||||||
|
InternetAddress to = new InternetAddress(email);
|
||||||
|
InternetAddress from = new InternetAddress(emailSender);
|
||||||
|
|
||||||
|
LiferayUserManager userManager = new LiferayUserManager();
|
||||||
|
String portalUrl = PortalUtil.getPortalURL(getCompany().getVirtualHost(), 443, true);
|
||||||
|
String username = userManager.getFullNameFromEmail(email);
|
||||||
|
|
||||||
|
MailMessage mailMessage = new MailMessage();
|
||||||
|
mailMessage.setFrom(from);
|
||||||
|
mailMessage.setTo(to);
|
||||||
|
|
||||||
|
String body = "<p>Dear " + username + ",<br />" + "<br />" +
|
||||||
|
"Welcome! You recently created an account at " + portalUrl + ". Your password is not sent by email for security purposes.<br />" +
|
||||||
|
"<br />" + "Sincerely,<br />" +
|
||||||
|
gatewayName + "<br />" +
|
||||||
|
emailSender + "<br />" + portalUrl;
|
||||||
|
String subject = portalUrl + ": Your New Account was created successfully!";
|
||||||
|
|
||||||
|
mailMessage.setBody(body);
|
||||||
|
mailMessage.setSubject(subject);
|
||||||
|
mailMessage.setHTMLFormat(true);
|
||||||
|
MailServiceUtil.sendEmail(mailMessage);
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("Error while sending email to user " + email, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VreUserBean register(String name, String surname, String institution,
|
||||||
|
String email, boolean sendEmail, boolean isMale) {
|
||||||
|
|
||||||
|
// if in dev mode return ok
|
||||||
|
if (!isWithinPortal()) {
|
||||||
|
|
||||||
|
logger.debug("In dev mode.");
|
||||||
|
return new VreUserBean(name, surname, institution, email, false, System.currentTimeMillis(), isMale);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
ASLSession session = getASLSession();
|
||||||
|
String userName = session.getUsername();
|
||||||
|
|
||||||
|
//in case the portal is restarted and you have the social home open it will get test.user (no callback to set session info)
|
||||||
|
//this check just return nothing if that happens
|
||||||
|
if (userName.compareTo("test.user") == 0) {
|
||||||
|
logger.debug("Found " + userName + " returning nothing");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String vre = session.getScopeName();
|
||||||
|
long timestamp = System.currentTimeMillis();
|
||||||
|
|
||||||
|
//checking if the user has been already registered or is already in the portal
|
||||||
|
LiferayUserManager userManager = new LiferayUserManager();
|
||||||
|
boolean exists = userManager.userExistsByEmail(email);
|
||||||
|
|
||||||
|
if(exists){
|
||||||
|
|
||||||
|
logger.debug("User with this email already present in the portal.");
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
logger.debug("Trying to add user: " + name + ", " + surname + ", " + email + ", " + institution);
|
||||||
|
Connection con = null;
|
||||||
|
try{
|
||||||
|
|
||||||
|
con = DataAccess.getConnection();
|
||||||
|
String insert = "INSERT into " + REGISTERED_USERS_TABLE +
|
||||||
|
"("+ FIELD_EMAIL + ","
|
||||||
|
+ FIELD_NAME +","
|
||||||
|
+ FIELD_SURNAME + ","
|
||||||
|
+ FIELD_INSTITUTION + ","
|
||||||
|
+ FIELD_REGISTRATION_DATE + ","
|
||||||
|
+ FIELD_VRE
|
||||||
|
+ ") values(?, ?, ?, ?, ?, ?)";
|
||||||
|
|
||||||
|
PreparedStatement statement = con.prepareStatement(insert);
|
||||||
|
|
||||||
|
statement.setString(1, email);
|
||||||
|
statement.setString(2, name);
|
||||||
|
statement.setString(3, surname);
|
||||||
|
statement.setString(4, institution);
|
||||||
|
statement.setTimestamp(5, new Timestamp(timestamp));
|
||||||
|
statement.setString(6, vre);
|
||||||
|
int res = statement.executeUpdate();
|
||||||
|
|
||||||
|
if(res != 0){
|
||||||
|
|
||||||
|
logger.debug("User added in " + REGISTERED_USERS_TABLE);
|
||||||
|
|
||||||
|
// add in liferay too
|
||||||
|
try{
|
||||||
|
GCubeUser user = userManager.createUser(
|
||||||
|
true,
|
||||||
|
"",
|
||||||
|
email,
|
||||||
|
name,
|
||||||
|
"",
|
||||||
|
surname,
|
||||||
|
institution,
|
||||||
|
"",
|
||||||
|
isMale,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
sendEmail, // determine if we need to send him/her an email
|
||||||
|
true); // force the password reset
|
||||||
|
|
||||||
|
// adding to the current VRE
|
||||||
|
userManager.assignUserToGroup(getCurrentGroupID(), userManager.getUserId(user.getUsername()));
|
||||||
|
|
||||||
|
//adding to the HL
|
||||||
|
addUserToHLGroup(user.getUsername(), session.getScope());
|
||||||
|
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
// unable to create.. we need to delete it from the list of users
|
||||||
|
logger.error("Unable to create the user " + email + " in liferay. Removing he/she from the table " +
|
||||||
|
REGISTERED_USERS_TABLE, e);
|
||||||
|
|
||||||
|
deleteUserFromTable(email, con);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
logger.debug("User NOT added in " + REGISTERED_USERS_TABLE);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("Unable to add user, sorry..", e);
|
||||||
|
return null;
|
||||||
|
}finally{
|
||||||
|
try {
|
||||||
|
if(con != null)
|
||||||
|
con.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
logger.error("Unable to close connection to the DB");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new VreUserBean(name, surname, institution, email, false, timestamp, isMale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VreUserBean> getAlreadyRegisterdUsers() {
|
||||||
|
|
||||||
|
List<VreUserBean> toReturn = new ArrayList<VreUserBean>();
|
||||||
|
|
||||||
|
// if in dev mode return some samples
|
||||||
|
if (!isWithinPortal()) {
|
||||||
|
|
||||||
|
logger.debug("In dev mode.");
|
||||||
|
toReturn.add(new VreUserBean("Dylan", "Dog", "ISTI-CNR", "dylan.dog@gmail.com", true, System.currentTimeMillis(), true));
|
||||||
|
toReturn.add(new VreUserBean("Costantino", "Perciante", "ISTI-CNR", "costantino8@gmail.com", false, System.currentTimeMillis(), true));
|
||||||
|
return toReturn;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
LiferayUserManager userManager = new LiferayUserManager();
|
||||||
|
ASLSession session = getASLSession();
|
||||||
|
String userName = session.getUsername();
|
||||||
|
|
||||||
|
//in case the portal is restarted and you have the social home open it will get test.user (no callback to set session info)
|
||||||
|
//this check just return nothing if that happens
|
||||||
|
if (userName.compareTo("test.user") == 0) {
|
||||||
|
logger.debug("Found " + userName + " returning nothing");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// evaluate current vre
|
||||||
|
String vre = session.getScopeName();
|
||||||
|
|
||||||
|
Connection con = null;
|
||||||
|
try{
|
||||||
|
|
||||||
|
con = DataAccess.getConnection();
|
||||||
|
Statement stmt = con.createStatement();
|
||||||
|
|
||||||
|
String sql = "SELECT * FROM " + REGISTERED_USERS_TABLE + " WHERE " + FIELD_VRE + "='" + vre + "';";
|
||||||
|
ResultSet rs = stmt.executeQuery(sql);
|
||||||
|
|
||||||
|
while(rs.next()){
|
||||||
|
|
||||||
|
String name = rs.getString(FIELD_NAME);
|
||||||
|
String surname = rs.getString(FIELD_SURNAME);
|
||||||
|
String institution = rs.getString(FIELD_INSTITUTION);
|
||||||
|
String email = rs.getString(FIELD_EMAIL);
|
||||||
|
long registrationDate = rs.getTimestamp(FIELD_REGISTRATION_DATE).getTime();
|
||||||
|
|
||||||
|
// check if the password has been changed or not wrt the default one
|
||||||
|
boolean passwordChanged = userManager.isPasswordChanged(email);
|
||||||
|
|
||||||
|
|
||||||
|
toReturn.add(new VreUserBean(name, surname, institution, email, passwordChanged, registrationDate, false));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// now, make sure these users are still on portal
|
||||||
|
Iterator<VreUserBean> iterator = toReturn.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
VreUserBean user = (VreUserBean) iterator.next();
|
||||||
|
|
||||||
|
if(!userManager.userExistsByEmail(user.getEmail())){
|
||||||
|
|
||||||
|
// remove from the table
|
||||||
|
deleteUserFromTable(user.getEmail(), con);
|
||||||
|
|
||||||
|
// remove from this collection
|
||||||
|
iterator.remove();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch(Exception e){
|
||||||
|
logger.error("Unable to retrieve users list, sorry...", e);
|
||||||
|
return null;
|
||||||
|
}finally{
|
||||||
|
try {
|
||||||
|
if(con != null)
|
||||||
|
con.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
logger.error("Unable to close connection to the DB");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a row from the table of the registered users
|
||||||
|
* @param email
|
||||||
|
* @param con
|
||||||
|
*/
|
||||||
|
private boolean deleteUserFromTable(String email, Connection con) {
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
logger.debug("Going to delete user with email " + email + " from the table of registered users");
|
||||||
|
|
||||||
|
String remove = "DELETE FROM " + REGISTERED_USERS_TABLE + " WHERE " + FIELD_EMAIL + "= ?";
|
||||||
|
PreparedStatement statementDelete = con.prepareStatement(remove);
|
||||||
|
statementDelete.setString(1, email);
|
||||||
|
int res = statementDelete.executeUpdate();
|
||||||
|
|
||||||
|
if(res == 1)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}catch(Exception e){
|
||||||
|
|
||||||
|
logger.error("Error while deleting user=" + email + "from the table");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete user from liferay
|
||||||
|
* @param email
|
||||||
|
*/
|
||||||
|
private boolean deleteUserFromLiferay(String email) {
|
||||||
|
|
||||||
|
LiferayUserManager userManager = new LiferayUserManager();
|
||||||
|
try {
|
||||||
|
userManager.deleteUserByEMail(email);
|
||||||
|
return true;
|
||||||
|
} catch (PortalException | SystemException
|
||||||
|
| UserManagementSystemException | UserManagementPortalException e) {
|
||||||
|
logger.error("Unable to delete user from liferay", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add user to Home Library Group
|
||||||
|
* @param username
|
||||||
|
* @param group
|
||||||
|
*/
|
||||||
|
private void addUserToHLGroup(String username, String group) {
|
||||||
|
try {
|
||||||
|
org.gcube.common.homelibrary.home.workspace.usermanager.UserManager um = HomeLibrary.getHomeManagerFactory().getUserManager();
|
||||||
|
um.associateUserToGroup(group, username);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Failed to get the usermanager from HL. Could not add user to the HL group");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current group ID
|
||||||
|
*
|
||||||
|
* @return the current group ID or null if an exception is thrown
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private String getCurrentGroupID() {
|
||||||
|
ASLSession session = getASLSession();
|
||||||
|
logger.debug("The current group NAME is --> " + session.getGroupName());
|
||||||
|
String toReturn = null;
|
||||||
|
try {
|
||||||
|
toReturn = new LiferayGroupManager().getGroupId(session.getGroupName());
|
||||||
|
} catch (UserManagementSystemException | GroupRetrievalFault e) {
|
||||||
|
logger.error("Unable to retrieve id for group " + session.getGroupName());
|
||||||
|
}
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Company getCompany() throws PortalException, SystemException {
|
||||||
|
return CompanyLocalServiceUtil.getCompanyByWebId(getDefaultCompanyWebId());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the default company web-id (e.g. iMarine.eu)
|
||||||
|
*/
|
||||||
|
public static String getDefaultCompanyWebId() {
|
||||||
|
String defaultWebId = "";
|
||||||
|
try {
|
||||||
|
defaultWebId = GetterUtil.getString(PropsUtil.get("company.default.web.id"));
|
||||||
|
}
|
||||||
|
catch (NullPointerException e) {
|
||||||
|
logger.error("Cound not find property company.default.web.id in portal.ext file returning default web id: " + DEFAULT_COMPANY_WEB_ID);
|
||||||
|
return DEFAULT_COMPANY_WEB_ID;
|
||||||
|
}
|
||||||
|
return defaultWebId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
package org.gcube.portlets.admin.createusers.server.portlet;
|
||||||
|
|
||||||
|
import javax.portlet.GenericPortlet;
|
||||||
|
import javax.portlet.ActionRequest;
|
||||||
|
import javax.portlet.RenderRequest;
|
||||||
|
import javax.portlet.ActionResponse;
|
||||||
|
import javax.portlet.RenderResponse;
|
||||||
|
import javax.portlet.PortletException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.portlet.PortletRequestDispatcher;
|
||||||
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
public class CreateUsersPortlet extends GenericPortlet {
|
||||||
|
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
|
||||||
|
response.setContentType("text/html");
|
||||||
|
ScopeHelper.setContext(request);
|
||||||
|
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/CreateUsers_view.jsp");
|
||||||
|
dispatcher.include(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void processAction(ActionRequest request, ActionResponse response)
|
||||||
|
throws PortletException, IOException {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,115 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Information of an already registered user to the VRE.
|
||||||
|
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||||
|
*/
|
||||||
|
public class VreUserBean implements Serializable{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8674087530839002999L;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String surname;
|
||||||
|
private String institution;
|
||||||
|
private String email;
|
||||||
|
private boolean passwordChanged;
|
||||||
|
private long regisrationDate;
|
||||||
|
private boolean isMale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a default user bean object.
|
||||||
|
*/
|
||||||
|
public VreUserBean(){
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a user bean object.
|
||||||
|
* @param name
|
||||||
|
* @param surname
|
||||||
|
* @param institution
|
||||||
|
* @param email
|
||||||
|
* @param passwordChanged
|
||||||
|
* @param registrationDate
|
||||||
|
* @param isMale
|
||||||
|
*/
|
||||||
|
public VreUserBean(String name, String surname, String institution,
|
||||||
|
String email, boolean passwordChanged, long registrationDate, boolean isMale) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.surname = surname;
|
||||||
|
this.institution = institution;
|
||||||
|
this.email = email;
|
||||||
|
this.passwordChanged = passwordChanged;
|
||||||
|
this.regisrationDate = registrationDate;
|
||||||
|
this.isMale = isMale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurname() {
|
||||||
|
return surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurname(String surname) {
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInstitution() {
|
||||||
|
return institution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInstitution(String institution) {
|
||||||
|
this.institution = institution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPasswordChanged() {
|
||||||
|
return passwordChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPasswordChanged(boolean passwordChanged) {
|
||||||
|
this.passwordChanged = passwordChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getRegisrationDate() {
|
||||||
|
return regisrationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegisrationDate(long regisrationDate) {
|
||||||
|
this.regisrationDate = regisrationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isMale() {
|
||||||
|
return isMale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMale(boolean isMale) {
|
||||||
|
this.isMale = isMale;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "VreUserBean [name=" + name + ", surname=" + surname
|
||||||
|
+ ", institution=" + institution + ", email=" + email
|
||||||
|
+ ", passwordChanged=" + passwordChanged + ", regisrationDate="
|
||||||
|
+ regisrationDate + ", isMale=" + isMale + "]";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
log4j.rootLogger=DEBUG, A1
|
||||||
|
log4j.appender.A1=org.apache.log4j.ConsoleAppender
|
||||||
|
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
|
||||||
|
|
||||||
|
# Print the date in ISO 8601 format
|
||||||
|
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
|
||||||
|
|
||||||
|
# Print only messages of level TRACE or above in the package org.gcube
|
||||||
|
log4j.logger.org.gcube=TRACE
|
||||||
|
log4j.logger.org.gcube.application.framework.core.session=INFO
|
||||||
|
log4j.logger.org.gcube.common.scope.impl.DefaultScopeProvider=ERROR
|
||||||
|
log4j.logger.com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor=ERROR
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module rename-to='createusers'>
|
||||||
|
<!-- Inherit the core Web Toolkit stuff. -->
|
||||||
|
<inherits name='com.google.gwt.user.User' />
|
||||||
|
|
||||||
|
<!-- Other module inherits -->
|
||||||
|
<inherits name='com.google.gwt.activity.Activity' />
|
||||||
|
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||||
|
|
||||||
|
<!-- Specify the app entry point class. -->
|
||||||
|
<entry-point
|
||||||
|
class='org.gcube.portlets.admin.createusers.client.CreateUsers' />
|
||||||
|
|
||||||
|
<!-- Specify the paths for translatable code -->
|
||||||
|
<source path='client' />
|
||||||
|
<source path='shared' />
|
||||||
|
|
||||||
|
</module>
|
|
@ -0,0 +1,12 @@
|
||||||
|
/** Add css rules here for your application. */
|
||||||
|
.portlet-title-style {
|
||||||
|
display: block;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #555;
|
||||||
|
font-weight: bolder;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-style {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<!doctype html>
|
||||||
|
<!-- The DOCTYPE declaration above will set the -->
|
||||||
|
<!-- browser's rendering engine into -->
|
||||||
|
<!-- "Standards Mode". Replacing this declaration -->
|
||||||
|
<!-- with a "Quirks Mode" doctype may lead to some -->
|
||||||
|
<!-- differences in layout. -->
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- Consider inlining CSS to reduce the number of requested files -->
|
||||||
|
<!-- -->
|
||||||
|
<link type="text/css" rel="stylesheet" href="CreateUsers.css">
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- Any title is fine -->
|
||||||
|
<!-- -->
|
||||||
|
<title>Create users portlet</title>
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- This script loads your compiled module. -->
|
||||||
|
<!-- If you add any GWT meta tags, they must -->
|
||||||
|
<!-- be added before this line. -->
|
||||||
|
<!-- -->
|
||||||
|
<script src='js/jquery.min.js'></script>
|
||||||
|
<script src='js/jquery.autosize.js'></script>
|
||||||
|
<script type="text/javascript"
|
||||||
|
src="createusers/createusers.nocache.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- OPTIONAL: include this if you want history support -->
|
||||||
|
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1'
|
||||||
|
style="position: absolute; width: 0; height: 0; border: 0"></iframe>
|
||||||
|
|
||||||
|
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
|
||||||
|
<noscript>
|
||||||
|
<div
|
||||||
|
style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
|
||||||
|
Your web browser must have JavaScript enabled in order for this
|
||||||
|
application to display correctly.</div>
|
||||||
|
</noscript>
|
||||||
|
|
||||||
|
<div id="create-users-container"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,187 @@
|
||||||
|
/*!
|
||||||
|
jQuery Autosize v1.16.12
|
||||||
|
(c) 2013 Jack Moore - jacklmoore.com
|
||||||
|
updated: 2013-05-31
|
||||||
|
license: http://www.opensource.org/licenses/mit-license.php
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function ($) {
|
||||||
|
var
|
||||||
|
defaults = {
|
||||||
|
className: 'autosizejs',
|
||||||
|
append: '',
|
||||||
|
callback: false
|
||||||
|
},
|
||||||
|
hidden = 'hidden',
|
||||||
|
borderBox = 'border-box',
|
||||||
|
lineHeight = 'lineHeight',
|
||||||
|
|
||||||
|
// border:0 is unnecessary, but avoids a bug in FireFox on OSX
|
||||||
|
copy = '<textarea tabindex="-1" style="position:absolute; top:-999px; left:0; right:auto; bottom:auto; border:0; -moz-box-sizing:content-box; -webkit-box-sizing:content-box; box-sizing:content-box; word-wrap:break-word; height:0 !important; min-height:0 !important; overflow:hidden;"/>',
|
||||||
|
|
||||||
|
// line-height is conditionally included because IE7/IE8/old Opera do not return the correct value.
|
||||||
|
copyStyle = [
|
||||||
|
'fontFamily',
|
||||||
|
'fontSize',
|
||||||
|
'fontWeight',
|
||||||
|
'fontStyle',
|
||||||
|
'letterSpacing',
|
||||||
|
'textTransform',
|
||||||
|
'wordSpacing',
|
||||||
|
'textIndent'
|
||||||
|
],
|
||||||
|
oninput = 'oninput',
|
||||||
|
onpropertychange = 'onpropertychange',
|
||||||
|
|
||||||
|
// to keep track which textarea is being mirrored when adjust() is called.
|
||||||
|
mirrored,
|
||||||
|
|
||||||
|
// the mirror element, which is used to calculate what size the mirrored element should be.
|
||||||
|
mirror = $(copy).data('autosize', true)[0];
|
||||||
|
|
||||||
|
// test that line-height can be accurately copied.
|
||||||
|
mirror.style.lineHeight = '99px';
|
||||||
|
if ($(mirror).css(lineHeight) === '99px') {
|
||||||
|
copyStyle.push(lineHeight);
|
||||||
|
}
|
||||||
|
mirror.style.lineHeight = '';
|
||||||
|
|
||||||
|
$.fn.autosize = function (options) {
|
||||||
|
options = $.extend({}, defaults, options || {});
|
||||||
|
|
||||||
|
if (mirror.parentNode !== document.body) {
|
||||||
|
$(document.body).append(mirror);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.each(function () {
|
||||||
|
var
|
||||||
|
ta = this,
|
||||||
|
$ta = $(ta),
|
||||||
|
minHeight,
|
||||||
|
maxHeight,
|
||||||
|
resize,
|
||||||
|
boxOffset = 0,
|
||||||
|
callback = $.isFunction(options.callback);
|
||||||
|
|
||||||
|
if ($ta.data('autosize')) {
|
||||||
|
// exit if autosize has already been applied, or if the textarea is the mirror element.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ta.css('box-sizing') === borderBox || $ta.css('-moz-box-sizing') === borderBox || $ta.css('-webkit-box-sizing') === borderBox){
|
||||||
|
boxOffset = $ta.outerHeight() - $ta.height();
|
||||||
|
}
|
||||||
|
|
||||||
|
// IE8 and lower return 'auto', which parses to NaN, if no min-height is set.
|
||||||
|
minHeight = Math.max(parseInt($ta.css('minHeight'), 10) - boxOffset || 0, $ta.height());
|
||||||
|
|
||||||
|
resize = ($ta.css('resize') === 'none' || $ta.css('resize') === 'vertical') ? 'none' : 'horizontal';
|
||||||
|
|
||||||
|
$ta.css({
|
||||||
|
overflow: hidden,
|
||||||
|
overflowY: hidden,
|
||||||
|
wordWrap: 'break-word',
|
||||||
|
resize: resize
|
||||||
|
}).data('autosize', true);
|
||||||
|
|
||||||
|
function initMirror() {
|
||||||
|
mirrored = ta;
|
||||||
|
mirror.className = options.className;
|
||||||
|
maxHeight = parseInt($ta.css('maxHeight'), 10);
|
||||||
|
|
||||||
|
// mirror is a duplicate textarea located off-screen that
|
||||||
|
// is automatically updated to contain the same text as the
|
||||||
|
// original textarea. mirror always has a height of 0.
|
||||||
|
// This gives a cross-browser supported way getting the actual
|
||||||
|
// height of the text, through the scrollTop property.
|
||||||
|
$.each(copyStyle, function(i, val){
|
||||||
|
mirror.style[val] = $ta.css(val);
|
||||||
|
});
|
||||||
|
|
||||||
|
// The textarea overflow is probably now hidden, but Chrome doesn't reflow the text to account for the
|
||||||
|
// new space made available by removing the scrollbars. This workaround causes Chrome to reflow the text.
|
||||||
|
if (oninput in ta) {
|
||||||
|
var value = ta.value;
|
||||||
|
ta.value = '';
|
||||||
|
ta.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Using mainly bare JS in this function because it is going
|
||||||
|
// to fire very often while typing, and needs to very efficient.
|
||||||
|
function adjust() {
|
||||||
|
var height, overflow, original;
|
||||||
|
|
||||||
|
if (mirrored !== ta) {
|
||||||
|
initMirror();
|
||||||
|
}
|
||||||
|
|
||||||
|
mirror.value = ta.value + options.append;
|
||||||
|
mirror.style.overflowY = ta.style.overflowY;
|
||||||
|
original = parseInt(ta.style.height,10);
|
||||||
|
|
||||||
|
// Update the width in case the original textarea width has changed
|
||||||
|
// A floor of 0 is needed because IE8 returns a negative value for hidden textareas, raising an error.
|
||||||
|
mirror.style.width = Math.max($ta.width(), 0) + 'px';
|
||||||
|
|
||||||
|
// Needed for IE8 and lower to reliably return the correct scrollTop
|
||||||
|
mirror.scrollTop = 0;
|
||||||
|
|
||||||
|
mirror.scrollTop = 9e4;
|
||||||
|
|
||||||
|
// Using scrollTop rather than scrollHeight because scrollHeight is non-standard and includes padding.
|
||||||
|
height = mirror.scrollTop;
|
||||||
|
|
||||||
|
if (maxHeight && height > maxHeight) {
|
||||||
|
height = maxHeight;
|
||||||
|
overflow = 'scroll';
|
||||||
|
} else if (height < minHeight) {
|
||||||
|
height = minHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
height += boxOffset;
|
||||||
|
ta.style.overflowY = overflow || hidden;
|
||||||
|
|
||||||
|
if (original !== height) {
|
||||||
|
ta.style.height = height + 'px';
|
||||||
|
if (callback) {
|
||||||
|
options.callback.call(ta,ta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onpropertychange in ta) {
|
||||||
|
if (oninput in ta) {
|
||||||
|
// Detects IE9. IE9 does not fire onpropertychange or oninput for deletions,
|
||||||
|
// so binding to onkeyup to catch most of those occassions. There is no way that I
|
||||||
|
// know of to detect something like 'cut' in IE9.
|
||||||
|
ta[oninput] = ta.onkeyup = adjust;
|
||||||
|
} else {
|
||||||
|
// IE7 / IE8
|
||||||
|
ta[onpropertychange] = function(){
|
||||||
|
if(event.propertyName === 'value'){
|
||||||
|
adjust();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Modern Browsers
|
||||||
|
ta[oninput] = adjust;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(window).on('resize', function(){
|
||||||
|
active = false;
|
||||||
|
adjust();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Allow for manual triggering if needed.
|
||||||
|
$ta.on('autosize', function(){
|
||||||
|
active = false;
|
||||||
|
adjust();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Call adjust in case the textarea already contains text.
|
||||||
|
adjust();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}(window.jQuery || window.Zepto));
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,182 @@
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2006-2007, TIBCO Software Inc.
|
||||||
|
* Use, modification, and distribution subject to terms of license.
|
||||||
|
*
|
||||||
|
* TIBCO(R) PageBus 1.1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(typeof window.PageBus == 'undefined') {
|
||||||
|
|
||||||
|
PageBus = {
|
||||||
|
version: "1.1.0",
|
||||||
|
S: {c:{},s:[]},
|
||||||
|
X: 0,
|
||||||
|
P: 0,
|
||||||
|
U: [],
|
||||||
|
H: "undefined"
|
||||||
|
};
|
||||||
|
|
||||||
|
PageBus.subscribe = function(name, scope, callback, subscriberData)
|
||||||
|
{
|
||||||
|
if(name == null)
|
||||||
|
this._badName();
|
||||||
|
if(scope == null)
|
||||||
|
scope = window;
|
||||||
|
var path = name.split(".");
|
||||||
|
var sub = { f: callback, d: subscriberData, i: this.X++, p: path, w: scope };
|
||||||
|
for(var i = 0; i < path.length; i++) {
|
||||||
|
if((path[i].indexOf("*") != -1) && (path[i] != "*") && (path[i] != "**"))
|
||||||
|
this._badName();
|
||||||
|
}
|
||||||
|
this._subscribe(this.S, path, 0, sub);
|
||||||
|
return sub;
|
||||||
|
}
|
||||||
|
|
||||||
|
PageBus.publish = function (name, message)
|
||||||
|
{
|
||||||
|
if((name == null) || (name.indexOf("*") != -1))
|
||||||
|
this._badName();
|
||||||
|
var path = name.split(".");
|
||||||
|
if(this.P > 100)
|
||||||
|
this._throw("StackOverflow");
|
||||||
|
try {
|
||||||
|
this.P++;
|
||||||
|
this._publish(this.S, path, 0, name, message);
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
this.P--;
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
this.P--;
|
||||||
|
if((this.U.length > 0) && (this.P == 0)) {
|
||||||
|
for(var i = 0; i < this.U.length; i++)
|
||||||
|
this.unsubscribe(this.U[i]);
|
||||||
|
this.U = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
// All unsubscribe exceptions should already have
|
||||||
|
// been handled when unsubscribe was called in the
|
||||||
|
// publish callback. This is a repeat appearance
|
||||||
|
// of this exception. Discard it.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PageBus.unsubscribe = function(sub)
|
||||||
|
{
|
||||||
|
this._unsubscribe(this.S, sub.p, 0, sub.i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @private @jsxobf-clobber
|
||||||
|
*/
|
||||||
|
PageBus._throw = function(n)
|
||||||
|
{
|
||||||
|
throw new Error("PageBus." + n);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @private @jsxobf-clobber
|
||||||
|
*/
|
||||||
|
PageBus._badName = function(n)
|
||||||
|
{
|
||||||
|
this._throw("BadName");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @private @jsxobf-clobber
|
||||||
|
*/
|
||||||
|
PageBus._subscribe = function(tree, path, index, sub)
|
||||||
|
{
|
||||||
|
var tok = path[index];
|
||||||
|
if(tok == "")
|
||||||
|
this._badName();
|
||||||
|
if(index == path.length)
|
||||||
|
tree.s.push(sub);
|
||||||
|
else {
|
||||||
|
if(typeof tree.c == this.H)
|
||||||
|
tree.c = {};
|
||||||
|
if(typeof tree.c[tok] == this.H) {
|
||||||
|
try {
|
||||||
|
tree.c[tok] = { c: {}, s: [] };
|
||||||
|
this._subscribe(tree.c[tok], path, index + 1, sub);
|
||||||
|
}
|
||||||
|
catch(err) {
|
||||||
|
delete tree.c[tok];
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this._subscribe( tree.c[tok], path, index + 1, sub );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @private @jsxobf-clobber
|
||||||
|
*/
|
||||||
|
PageBus._publish = function(tree, path, index, name, msg) {
|
||||||
|
if(path[index] == "")
|
||||||
|
this._badName();
|
||||||
|
if(typeof tree != this.H) {
|
||||||
|
if(index < path.length) {
|
||||||
|
this._publish(tree.c[path[index]], path, index + 1, name, msg);
|
||||||
|
this._publish(tree.c["*"], path, index + 1, name, msg);
|
||||||
|
this._call(tree.c["**"], name, msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this._call(tree, name, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @private @jsxobf-clobber
|
||||||
|
*/
|
||||||
|
PageBus._call = function(node, name, msg) {
|
||||||
|
if(typeof node != this.H) {
|
||||||
|
var callbacks = node.s;
|
||||||
|
var max = callbacks.length;
|
||||||
|
for(var i = 0; i < max; i++)
|
||||||
|
if(callbacks[i].f != null)
|
||||||
|
callbacks[i].f.apply(callbacks[i].w, [name, msg, callbacks[i].d]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @jsxobf-clobber
|
||||||
|
*/
|
||||||
|
PageBus._unsubscribe = function(tree, path, index, sid) {
|
||||||
|
if(typeof tree != this.H) {
|
||||||
|
if(index < path.length) {
|
||||||
|
var childNode = tree.c[path[index]];
|
||||||
|
this._unsubscribe(childNode, path, index + 1, sid);
|
||||||
|
if(childNode.s.length == 0) {
|
||||||
|
for(var x in childNode.c) // not empty. We're done.
|
||||||
|
return;
|
||||||
|
delete tree.c[path[index]]; // if we got here, c is empty
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var callbacks = tree.s;
|
||||||
|
var max = callbacks.length;
|
||||||
|
for(var i = 0; i < max; i++) {
|
||||||
|
if(sid == callbacks[i].i) {
|
||||||
|
if(this.P > 0) {
|
||||||
|
if(callbacks[i].f == null)
|
||||||
|
this._throw("BadParameter");
|
||||||
|
callbacks[i].f = null;
|
||||||
|
this.U.push(callbacks[i]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
callbacks.splice(i, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Not found. Fall through
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._throw("BadParameter");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
<%@page contentType="text/html"%>
|
||||||
|
<%@page pageEncoding="UTF-8"%>
|
||||||
|
|
||||||
|
<%-- Uncomment below lines to add portlet taglibs to jsp
|
||||||
|
<%@ page import="javax.portlet.*"%>
|
||||||
|
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
|
||||||
|
|
||||||
|
<portlet:defineObjects />
|
||||||
|
--%>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
<script type="text/javascript" src="<%=request.getContextPath()%>/createusers/js/jquery-1.10.1.min.js"></script>
|
||||||
|
<script type="text/javascript" src="<%=request.getContextPath()%>/createusers/js/bootstrap.min.js"></script>
|
||||||
|
<script type="text/javascript" src='<%=request.getContextPath()%>/createusers/createusers.nocache.js'></script>
|
||||||
|
<div id="create-users-container"></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.2.0//EN" "http://www.liferay.com/dtd/liferay-display_6_2_0.dtd">
|
||||||
|
|
||||||
|
<display>
|
||||||
|
<category name="gCube Enabling Apps">
|
||||||
|
<portlet id="CreateUsers" />
|
||||||
|
</category>
|
||||||
|
</display>
|
|
@ -0,0 +1,9 @@
|
||||||
|
name=CreateUsers
|
||||||
|
module-group-id=liferay
|
||||||
|
module-incremental-version=1
|
||||||
|
tags=
|
||||||
|
short-description=
|
||||||
|
change-log=
|
||||||
|
page-url=http://www.d4science.org
|
||||||
|
author=D4Science Org.
|
||||||
|
licenses=EUPL
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
|
||||||
|
|
||||||
|
<liferay-portlet-app>
|
||||||
|
<portlet>
|
||||||
|
<portlet-name>CreateUsers</portlet-name>
|
||||||
|
<layout-cacheable>false</layout-cacheable>
|
||||||
|
<instanceable>false</instanceable>
|
||||||
|
<ajaxable>false</ajaxable>
|
||||||
|
<!-- LOCATION CSS HERE -->
|
||||||
|
<header-portlet-css>/CreateUsers.css</header-portlet-css>
|
||||||
|
</portlet>
|
||||||
|
<role-mapper>
|
||||||
|
<role-name>administrator</role-name>
|
||||||
|
<role-link>Administrator</role-link>
|
||||||
|
</role-mapper>
|
||||||
|
<role-mapper>
|
||||||
|
<role-name>guest</role-name>
|
||||||
|
<role-link>Guest</role-link>
|
||||||
|
</role-mapper>
|
||||||
|
<role-mapper>
|
||||||
|
<role-name>power-user</role-name>
|
||||||
|
<role-link>Power User</role-link>
|
||||||
|
</role-mapper>
|
||||||
|
<role-mapper>
|
||||||
|
<role-name>user</role-name>
|
||||||
|
<role-link>User</role-link>
|
||||||
|
</role-mapper>
|
||||||
|
</liferay-portlet-app>
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
|
||||||
|
version="2.0">
|
||||||
|
<portlet>
|
||||||
|
<portlet-name>CreateUsers</portlet-name>
|
||||||
|
<display-name>gCube Create Users</display-name>
|
||||||
|
<portlet-class>org.gcube.portlets.admin.createusers.server.portlet.CreateUsersPortlet</portlet-class>
|
||||||
|
<init-param>
|
||||||
|
<name>view-jsp</name>
|
||||||
|
<value>/view.jsp</value>
|
||||||
|
</init-param>
|
||||||
|
<expiration-cache>0</expiration-cache>
|
||||||
|
<supports>
|
||||||
|
<mime-type>text/html</mime-type>
|
||||||
|
</supports>
|
||||||
|
<portlet-info>
|
||||||
|
<title>Create Users</title>
|
||||||
|
<short-title>Create Users</short-title>
|
||||||
|
<keywords>Create Users</keywords>
|
||||||
|
</portlet-info>
|
||||||
|
<portlet-preferences>
|
||||||
|
<preference>
|
||||||
|
<name>portlet-setup-show-borders</name>
|
||||||
|
<value>true</value>
|
||||||
|
</preference>
|
||||||
|
</portlet-preferences>
|
||||||
|
<security-role-ref>
|
||||||
|
<role-name>administrator</role-name>
|
||||||
|
</security-role-ref>
|
||||||
|
</portlet>
|
||||||
|
</portlet-app>
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE web-app
|
||||||
|
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||||
|
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||||
|
|
||||||
|
<web-app>
|
||||||
|
|
||||||
|
<!-- Servlets -->
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>servlet</servlet-name>
|
||||||
|
<servlet-class>org.gcube.portlets.admin.createusers.server.CreateUsersImpl</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>servlet</servlet-name>
|
||||||
|
<url-pattern>/createusers/usersservice</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<!-- Default page to serve -->
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>CreateUsers.html</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
|
||||||
|
</web-app>
|
Binary file not shown.
After Width: | Height: | Size: 9.3 KiB |
|
@ -0,0 +1,19 @@
|
||||||
|
package org.gcube.portlets.admin.createusers.client;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import org.gcube.portlets.admin.createusers.server.CreateUsersImpl;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class TestForDeploy {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUserIsTestUser() {
|
||||||
|
CreateUsersImpl serviceImpl = new CreateUsersImpl();
|
||||||
|
String username = serviceImpl.getDevelopmentUser();
|
||||||
|
System.out.println("username for deploy is: " + username);
|
||||||
|
assertTrue(username.compareTo("test.user") == 0);
|
||||||
|
System.out.println("Test OK!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module rename-to="createusers">
|
||||||
|
<!-- Inherit our applications main module. -->
|
||||||
|
<inherits name='org.gcube.portlets.admin.createusers.CreateUsers' />
|
||||||
|
|
||||||
|
<!-- Specify the path to any remote services. -->
|
||||||
|
<servlet path="/CreateUsers/greet" class="org.gcube.portlets.admin.createusers.server.GreetingServiceImpl" />
|
||||||
|
|
||||||
|
</module>
|
Loading…
Reference in New Issue