[jboss-svn-commits] JBoss Portal SVN: r5185 - in trunk/core/src: bin/portal-core-war/images/user main/org/jboss/portal/core/portlet/user resources/portal-core-war/WEB-INF/classes resources/portal-core-war/WEB-INF/jsp/user
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Sep 12 14:11:30 EDT 2006
Author: roy.russo at jboss.com
Date: 2006-09-12 14:11:27 -0400 (Tue, 12 Sep 2006)
New Revision: 5185
Added:
trunk/core/src/bin/portal-core-war/images/user/new_user.png
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/registerUser.jsp
Modified:
trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_en.properties
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/listUsers.jsp
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/menu.jsp
Log:
JBPORTAL-1029 - Ability for an administrator to add/remove users
Added: trunk/core/src/bin/portal-core-war/images/user/new_user.png
===================================================================
(Binary files differ)
Property changes on: trunk/core/src/bin/portal-core-war/images/user/new_user.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2006-09-12 17:41:25 UTC (rev 5184)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/user/UserPortlet.java 2006-09-12 18:11:27 UTC (rev 5185)
@@ -22,6 +22,8 @@
package org.jboss.portal.core.portlet.user;
import org.jboss.logging.Logger;
+import org.jboss.portal.api.node.PortalNode;
+import org.jboss.portal.api.node.PortalNodeURL;
import org.jboss.portal.common.context.DelegateContext;
import org.jboss.portal.common.util.LocaleInfo;
import org.jboss.portal.common.util.Tools;
@@ -38,13 +40,11 @@
import org.jboss.portal.theme.PortalTheme;
import org.jboss.portal.theme.ThemeInfo;
import org.jboss.portal.theme.ThemeService;
-import org.jboss.portal.api.node.PortalNodeURL;
import org.jboss.portlet.JBossActionRequest;
import org.jboss.portlet.JBossActionResponse;
import org.jboss.portlet.JBossPortlet;
import org.jboss.portlet.JBossRenderRequest;
import org.jboss.portlet.JBossRenderResponse;
-import org.jboss.portal.api.node.PortalNode;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
@@ -71,30 +71,51 @@
extends JBossPortlet
{
- /** The class logger. */
+ /**
+ * The class logger.
+ */
public static final Logger log = Logger.getLogger(JBossPortlet.class);
- /** Render operation to show the login screen. */
+ /**
+ * Render operation to show the login screen.
+ */
public static final String OP_SHOWLOGIN = "showLogin";
- /** Render operation to show the register screen. */
+ /**
+ * Render operation to show the register screen.
+ */
public static final String OP_SHOWREGISTER = "showRegister";
- /** Render operation to show the user menu screen. */
+ /**
+ * Render operation to show the user menu screen.
+ */
public static final String OP_SHOWMENU = "showMenu";
- /** Render operation to show the user profile to edit. */
+ /**
+ * Render operation to show the user profile to edit.
+ */
public static final String OP_SHOWPROFILE = "showProfile";
- /** Render operation to show the screen to assign roles to a user. */
+ /**
+ * Render operation to show the screen to assign roles to a user.
+ */
public static final String OP_SHOWADDROLESTOUSER = "showAddRolesToUser";
- /** Render operation to show the list of users. */
+ /**
+ * Render operation to show the list of users.
+ */
public static final String OP_SHOWLISTUSERS = "showListUsers";
- /** Logout the user. */
+ /**
+ * Logout the user.
+ */
public static final String OP_USERLOGOUT = "userLogout";
+ /**
+ * Deletes the user
+ */
+ public static final String OP_DELETEUSER = "deleteUser";
+
private UserModule userModule;
private RoleModule roleModule;
private MailModule mailModule;
@@ -266,18 +287,18 @@
localeCtx.put("selected", "selected");
}
}
-
+
//
- String selectedTheme = (String)user.getProperties().get(User.INFO_USER_THEME);
- ThemeService themeService = (ThemeService)getPortletContext().getAttribute("ThemeService");
- for (Iterator i = themeService.getThemes().iterator(); i.hasNext();)
+ String selectedTheme = (String) user.getProperties().get(User.INFO_USER_THEME);
+ ThemeService themeService = (ThemeService) getPortletContext().getAttribute("ThemeService");
+ for(Iterator i = themeService.getThemes().iterator(); i.hasNext();)
{
- PortalTheme theme = (PortalTheme)i.next();
+ PortalTheme theme = (PortalTheme) i.next();
ThemeInfo info = theme.getThemeInfo();
DelegateContext themeCtx = ctx.next("theme");
themeCtx.put("name", info.getAppId() + "." + info.getName());
- themeCtx.put("id", info.getRegistrationId().toString());
- if ((selectedTheme != null) && selectedTheme.equals(info.getRegistrationId().toString()))
+ themeCtx.put("id", info.getRegistrationId().toString());
+ if((selectedTheme != null) && selectedTheme.equals(info.getRegistrationId().toString()))
{
themeCtx.put("selected", "selected");
}
@@ -357,8 +378,13 @@
rolesURL.setParameter(getOperationName(), OP_SHOWADDROLESTOUSER);
rolesURL.setParameter("userid", "" + user.getId());
+ PortletURL deleteUrl = resp.createActionURL();
+ deleteUrl.setParameter(getOperationName(), OP_DELETEUSER);
+ deleteUrl.setParameter("userid", "" + user.getId());
+
rowCtx.put("editURL" + oddeven, editURL.toString());
rowCtx.put("rolesURL" + oddeven, rolesURL.toString());
+ rowCtx.put("deleteURL" + oddeven, deleteUrl.toString());
}
if(offset != 0)
@@ -455,6 +481,14 @@
rd.include(req, resp);
}
}
+ else if(OP_SHOWREGISTER.equals(op))
+ {
+ if(req.isUserInRole("Admin"))
+ {
+ PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/user/registerUser.jsp");
+ rd.include(req, resp);
+ }
+ }
else
{
log.error("This operation does not exist when user is logged in:" + op);
@@ -1036,21 +1070,38 @@
}
}
+ public void deleteUser(JBossActionRequest request, JBossActionResponse response)
+ {
+ if(request.isUserInRole("Admin"))
+ {
+ try
+ {
+ User user = userModule.findUserById(request.getParameter("userid"));
+ userModule.removeUser(user.getId());
+ }
+ catch(IdentityException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ portletHelper.setRenderParameter(response, getOperationName(), OP_SHOWLISTUSERS);
+ }
+
/*
- * private String getTimezoneOffsetString(short timezoneOffset) {
- * StringBuffer timeZone = new StringBuffer(); for (int i = 0; i <
- * UserPortletConstants.TIME_ZONE_OFFSETS.length; i++) { if
- * (UserPortletConstants.TIME_ZONE_OFFSETS[i] != null) { timeZone.append("
- * <option value=\"").append(i); if (timezoneOffset == i) {
- * timeZone.append("\" selected>"); } else { timeZone.append("\">"); }
- * timeZone.append(UserPortletConstants.TIME_ZONE_OFFSETS[i]).append("
- * </option>"); } } return timeZone.toString(); }
- *
- * private String getTimezoneOffsetString() { return
- * getTimezoneOffsetString((short)0); }
- *
- * private String getTimezoneOffsetString(String timezoneOffset) { short
- * offset = Short.parseShort(timezoneOffset); return
- * getTimezoneOffsetString(offset); }
- */
+ * private String getTimezoneOffsetString(short timezoneOffset) {
+ * StringBuffer timeZone = new StringBuffer(); for (int i = 0; i <
+ * UserPortletConstants.TIME_ZONE_OFFSETS.length; i++) { if
+ * (UserPortletConstants.TIME_ZONE_OFFSETS[i] != null) { timeZone.append("
+ * <option value=\"").append(i); if (timezoneOffset == i) {
+ * timeZone.append("\" selected>"); } else { timeZone.append("\">"); }
+ * timeZone.append(UserPortletConstants.TIME_ZONE_OFFSETS[i]).append("
+ * </option>"); } } return timeZone.toString(); }
+ *
+ * private String getTimezoneOffsetString() { return
+ * getTimezoneOffsetString((short)0); }
+ *
+ * private String getTimezoneOffsetString(String timezoneOffset) { short
+ * offset = Short.parseShort(timezoneOffset); return
+ * getTimezoneOffsetString(offset); }
+ */
}
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties 2006-09-12 17:41:25 UTC (rev 5184)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties 2006-09-12 18:11:27 UTC (rev 5185)
@@ -159,6 +159,7 @@
// Registration
REGISTER_REGISTER=Don't have an account yet? You can
REGISTER_REGISTER_LINK=create one
+REGISTER_REGISTER_ADMIN_LINK=Create new account
REGISTER_NEWUSER=New user registration
REGISTER_PASSWORDAGAIN=Confirm your password
REGISTER_REALEMAIL=Real e-mail
@@ -228,6 +229,7 @@
LIST_ACTIONSSHOWPROFILE=Profile
LIST_ACTIONADDROLESTOUSER=Roles
LIST_ACTIONEDITROLES=Edit Roles
+LIST_ACTIONDELETEUSER=Delete user
FILTER=Filter
NEXTPAGE=Next page
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_en.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_en.properties 2006-09-12 17:41:25 UTC (rev 5184)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_en.properties 2006-09-12 18:11:27 UTC (rev 5185)
@@ -159,6 +159,7 @@
// Registration
REGISTER_REGISTER=Don't have an account yet? You can
REGISTER_REGISTER_LINK=create one
+REGISTER_REGISTER_ADMIN_LINK=Create new account
REGISTER_NEWUSER=New user registration
REGISTER_PASSWORDAGAIN=Confirm your password
REGISTER_REALEMAIL=Real e-mail
@@ -228,6 +229,7 @@
LIST_ACTIONSSHOWPROFILE=Profile
LIST_ACTIONADDROLESTOUSER=Roles
LIST_ACTIONEDITROLES=Edit Roles
+LIST_ACTIONDELETEUSER=Delete user
FILTER=Filter
NEXTPAGE=Next page
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties 2006-09-12 17:41:25 UTC (rev 5184)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties 2006-09-12 18:11:27 UTC (rev 5185)
@@ -159,6 +159,7 @@
// Registration
REGISTER_REGISTER=¿No tiene una cuenta todavía? Puede
REGISTER_REGISTER_LINK=crear una
+REGISTER_REGISTER_ADMIN_LINK=Crear una cuenta
REGISTER_NEWUSER=Registro de nuevo usuario
REGISTER_PASSWORDAGAIN=Confirme su clave
REGISTER_REALEMAIL=E-mail real
@@ -228,6 +229,7 @@
LIST_ACTIONSSHOWPROFILE=Perfil
LIST_ACTIONADDROLESTOUSER=Roles
LIST_ACTIONEDITROLES=Editar Roles
+LIST_ACTIONDELETEUSER=Borrar el usario
FILTER=Filtro
NEXTPAGE=Página siguiente
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties 2006-09-12 17:41:25 UTC (rev 5184)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties 2006-09-12 18:11:27 UTC (rev 5185)
@@ -138,6 +138,7 @@
// Registration
REGISTER_REGISTER=Pas encore membre ?
REGISTER_REGISTER_LINK=Créer un compte
+REGISTER_REGISTER_ADMIN_LINK=Créer un compte
REGISTER_NEWUSER=Enregistrement d'un nouvel utilisateur
REGISTER_PASSWORDAGAIN=Comfirmer votre mot de passe
REGISTER_REALEMAIL=e-mail réel
@@ -205,6 +206,7 @@
LIST_ACTIONS=Actions
LIST_ACTIONSSHOWPROFILE=Profil
LIST_ACTIONADDROLESTOUSER=Roles
+LIST_ACTIONDELETEUSER=Delete user
FILTER=Filtre
NEXTPAGE=Page suivante
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/listUsers.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/listUsers.jsp 2006-09-12 17:41:25 UTC (rev 5184)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/listUsers.jsp 2006-09-12 18:11:27 UTC (rev 5185)
@@ -1,57 +1,62 @@
<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
-<%@ page isELIgnored ="false" %>
-<span class="portlet-font"><a href="<portlet:renderURL windowState="normal"><portlet:param name="op" value="showMenu"/></portlet:renderURL>">${n:i18n("REGISTER_SHOWMENU")}</a></span>
+<%@ page isELIgnored="false" %>
+<span class="portlet-font"><a
+ href="<portlet:renderURL windowState="normal"><portlet:param name="op" value="showMenu"/></portlet:renderURL>">${n:i18n("REGISTER_SHOWMENU")}</a></span>
<form action="<portlet:actionURL><portlet:param name="op" value="showListUsers"/></portlet:actionURL>" method="post">
-<table>
-<tr class="portlet-section-header">
- <th colspan="2">${n:i18n("LIST_FILTERS")}</th>
-</tr>
-<tr class="portlet-section-body">
- <td>${n:i18n("LIST_USERSPERPAGE")}
- <select name="usersperpage">
- <option value="10">10</option>
- <option value="20">20</option>
- <option value="30">30</option>
- <option value="50">50</option>
- <option value="75">75</option>
- <option value="100">100</option>
- </select>
- </td>
- <td>${n:i18n("LIST_USERNAMECONTAINS")}
- <input type="text" name="usernamefilter" value="${n:out("usernamefilter")}" size="15" />
- </td>
- <td>
- <input type="submit" value="${n:i18n("FILTER")}"/>
- </td>
-</tr>
-</table>
+ <table>
+ <tr class="portlet-section-header">
+ <th colspan="2">${n:i18n("LIST_FILTERS")}</th>
+ </tr>
+ <tr class="portlet-section-body">
+ <td>${n:i18n("LIST_USERSPERPAGE")}
+ <select name="usersperpage">
+ <option value="10">10</option>
+ <option value="20">20</option>
+ <option value="30">30</option>
+ <option value="50">50</option>
+ <option value="75">75</option>
+ <option value="100">100</option>
+ </select>
+ </td>
+ <td>${n:i18n("LIST_USERNAMECONTAINS")}
+ <input type="text" name="usernamefilter" value="${n:out("usernamefilter")}" size="15"/>
+ </td>
+ <td>
+ <input type="submit" value="${n:i18n("FILTER")}"/>
+ </td>
+ </tr>
+ </table>
</form>
<n:if ctx="previouspage"><a href="${n:out("previouspage.link")}">${n:i18n("PREVIOUSPAGE")}</a></n:if>
<n:if ctx="nextpage"><a href="${n:out("nextpage.link")}">${n:i18n("NEXTPAGE")}</a></n:if>
<table>
- <tr class="portlet-section-header">
- <th>${n:i18n("LIST_FULLNAME")}</th>
- <th>${n:i18n("LIST_USERNAME")}</th>
- <th>${n:i18n("LIST_ROLES")}</th>
- <th>${n:i18n("LIST_ACTIONS")}</th>
- </tr>
- <n:iterate ctx="row">
- <tr class="portlet-section-body">
- <td>${n:out("row.fullname0")}</td>
- <td>${n:out("row.username0")}</td>
- <td><n:iterate ctx="roles0">${n:out("row.roles0.name")}<br /></n:iterate></td>
- <td><a href="${n:out("row.editURL0")}">${n:i18n("LIST_ACTIONSSHOWPROFILE")}</a> <a href="${n:out("row.rolesURL0")}">${n:i18n("LIST_ACTIONADDROLESTOUSER")}</a></td>
- </tr>
- <tr class="portlet-section-alternate">
- <td>${n:out("row.fullname1")}</td>
- <td>${n:out("row.username1")}</td>
- <td><n:iterate ctx="roles1">${n:out("row.roles1.name")}<br /></n:iterate></td>
- <td><a href="${n:out("row.editURL1")}">${n:i18n("LIST_ACTIONSSHOWPROFILE")}</a> <a href="${n:out("row.rolesURL1")}">${n:i18n("LIST_ACTIONADDROLESTOUSER")}</a></td>
- </tr>
- </n:iterate>
+ <tr class="portlet-section-header">
+ <th>${n:i18n("LIST_FULLNAME")}</th>
+ <th>${n:i18n("LIST_USERNAME")}</th>
+ <th>${n:i18n("LIST_ROLES")}</th>
+ <th>${n:i18n("LIST_ACTIONS")}</th>
+ </tr>
+ <n:iterate ctx="row">
+ <tr class="portlet-section-body">
+ <td>${n:out("row.fullname0")}</td>
+ <td>${n:out("row.username0")}</td>
+ <td><n:iterate ctx="roles0">${n:out("row.roles0.name")}<br/></n:iterate></td>
+ <td><a href="${n:out("row.editURL0")}">${n:i18n("LIST_ACTIONSSHOWPROFILE")}</a> <a
+ href="${n:out("row.rolesURL0")}">${n:i18n("LIST_ACTIONADDROLESTOUSER")}</a> <a
+ href="${n:out("row.deleteURL0")}">${n:i18n("LIST_ACTIONDELETEUSER")}</a></td>
+ </tr>
+ <tr class="portlet-section-alternate">
+ <td>${n:out("row.fullname1")}</td>
+ <td>${n:out("row.username1")}</td>
+ <td><n:iterate ctx="roles1">${n:out("row.roles1.name")}<br/></n:iterate></td>
+ <td><a href="${n:out("row.editURL1")}">${n:i18n("LIST_ACTIONSSHOWPROFILE")}</a> <a
+ href="${n:out("row.rolesURL1")}">${n:i18n("LIST_ACTIONADDROLESTOUSER")}</a> <a
+ href="${n:out("row.deleteURL1")}">${n:i18n("LIST_ACTIONDELETEUSER")}</a></td>
+ </tr>
+ </n:iterate>
</table>
\ No newline at end of file
Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/menu.jsp
===================================================================
(Binary files differ)
Added: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/registerUser.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/registerUser.jsp 2006-09-12 17:41:25 UTC (rev 5184)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/user/registerUser.jsp 2006-09-12 18:11:27 UTC (rev 5185)
@@ -0,0 +1,44 @@
+<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
+<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+<%@ page isELIgnored ="false" %>
+<portlet:defineObjects/>
+
+
+<div style="margin: 0 15% 0 15%" align="center">
+ <form name="register" action="<portlet:actionURL><portlet:param name="op" value="userRegister"/></portlet:actionURL>" method="post">
+ <table cellspacing="2" cellpadding="2" border="0">
+ <th colspan="2" class="portlet-section-header">${n:i18n("REGISTER_NEWUSER")}</th>
+ <tr class="portlet-section-body">
+ <td><font class="portlet-form-label">${n:i18n("USERNAME")}: </font></td>
+ <td><input class="portlet-form-input-field" type="text" name="uname" value="${param["USERNAME"]}" size="26" maxlength="25"> * <n:error key="uname_error"/></td>
+ </tr>
+ <tr class="portlet-section-body">
+ <td><font class="portlet-form-label">${n:i18n("PASSWORD")}: </font></td>
+ <td><input class="portlet-form-input-field" type="password" name="pass1" size="26" maxlength="60"> * <n:error key="pass1_error"/></td>
+ </tr>
+ <tr class="portlet-section-body">
+ <td><font class="portlet-form-label">${n:i18n("REGISTER_PASSWORDAGAIN")}: </font></td>
+ <td><input class="portlet-form-input-field" type="password" name="pass2" size="26" maxlength="60"> * <n:error key="pass2_error"/></td>
+ </tr>
+ <tr class="portlet-section-body">
+ <td><font class="portlet-form-label">${n:i18n("REGISTER_REALEMAIL")}: </font></td>
+ <td><input class="portlet-form-input-field" type="text" name="realemail" value="${param["REALEMAIL"]}" size="26" maxlength="60"> * <n:error key="realemail_error"/></td>
+ </tr>
+ <tr class="portlet-section-body">
+ <td><font class="portlet-form-label">${n:i18n("REGISTER_FAKEEMAIL")}: </font></td>
+ <td><input class="portlet-form-input-field" type="text" name="fakeemail" value="${param["FAKEEMAIL"]}" size="26" maxlength="60"></td>
+ </tr>
+ <tr class="portlet-section-body">
+ <td colspan="2"><font class="portlet-form-label">*${n:i18n("REGISTER_FAKEEMAIL_EXPLAIN")}</font></td>
+ </tr>
+ <tr><td colspan="2" height="5"></td></tr>
+ <tr>
+ <td colspan="2" align="center"><input name="register" type="submit" class="portlet-form-button" value="${n:i18n("REGISTER_NEWUSER")}" /></td>
+ </tr>
+ </table>
+ </form>
+</div>
+ <br/>
+ <!-- END disclaimer -->
+
More information about the jboss-svn-commits
mailing list