[jboss-svn-commits] JBoss Portal SVN: r5631 - in trunk/core/src: main/org/jboss/portal/core/portlet/cms/admin resources/portal-core-war/WEB-INF/classes resources/portal-core-war/WEB-INF/jsp/cms/admin

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Nov 13 12:31:59 EST 2006


Author: roy.russo at jboss.com
Date: 2006-11-13 12:31:54 -0500 (Mon, 13 Nov 2006)
New Revision: 5631

Added:
   trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/securenode.jsp
Modified:
   trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminConstants.java
   trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.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/cms/admin/main.jsp
   trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/viewfile.jsp
Log:
JBPORTAL-1112 - Create cms security functionality in UI

Modified: trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminConstants.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminConstants.java	2006-11-13 17:01:04 UTC (rev 5630)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminConstants.java	2006-11-13 17:31:54 UTC (rev 5631)
@@ -91,4 +91,8 @@
    public static final String OP_EXPORTARCHIVE = "exportarchive";
 
    public static final String OP_EXPORTARCHIVE_PICKUP = "exportarchive_pickup";
+
+   public static final String OP_CONFIRMSECURE = "confirmsecure";
+
+   public static final String  OP_SECURE = "secure";
 }

Modified: trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.java	2006-11-13 17:01:04 UTC (rev 5630)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.java	2006-11-13 17:31:54 UTC (rev 5631)
@@ -39,6 +39,9 @@
 import org.jboss.portal.cms.util.NodeUtil;
 import org.jboss.portal.core.cms.StreamContentCommand;
 import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.UserModule;
 import org.jboss.portal.server.request.URLContext;
 import org.jboss.portal.server.request.URLFormat;
 import org.jboss.portlet.JBossActionRequest;
@@ -57,6 +60,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+import java.util.Set;
 import java.util.Vector;
 
 /**
@@ -66,14 +70,27 @@
 public class CMSAdminPortlet extends JBossPortlet
 {
    private CMS CMSService;
+   private UserModule userModule;
+   private RoleModule roleModule;
 
    public void init() throws PortletException
    {
       CMSService = (CMS)getPortletContext().getAttribute("CMS");
+      userModule = (UserModule)getPortletContext().getAttribute("UserModule");
+      roleModule = (RoleModule)getPortletContext().getAttribute("RoleModule");
+
       if (CMSService == null)
       {
          throw new PortletException("Cannot start CMSAdmin portlet due to service unavailability");
       }
+      if (userModule == null)
+      {
+         throw new PortletException("No user module");
+      }
+      if (roleModule == null)
+      {
+         throw new PortletException("No role module");
+      }
    }
 
    protected void doView(final JBossRenderRequest rReq, final JBossRenderResponse rRes)
@@ -359,6 +376,29 @@
          rReq.setAttribute("currpath", sPath);
          prd.include(rReq, rRes);
       }
+      else if (CMSAdminConstants.OP_CONFIRMSECURE.equals(op))
+      {
+         String sPath = rReq.getParameter("path");
+
+         Set roleSet;
+         Set userSet;
+         try
+         {
+            roleSet = roleModule.findRoles();
+            userSet = userModule.findUsers(0, 1000);
+         }
+         catch (IdentityException ie)
+         {
+            throw new PortletException(ie);
+         }
+
+         rRes.setContentType("text/html");
+         rReq.setAttribute("currpath", sPath);
+         rReq.setAttribute("roles", roleSet);
+         rReq.setAttribute("users", userSet);
+         javax.portlet.PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH + "/securenode.jsp");
+         prd.include(rReq, rRes);
+      }
    }
 
    public void processAction(final JBossActionRequest aReq, final JBossActionResponse aRes) throws PortletException
@@ -850,6 +890,15 @@
                }
             }
          }
+         else if (CMSAdminConstants.OP_SECURE.equals(op))
+         {
+            String[] selectedRoles = aReq.getParameterValues("secureroles");
+            String[] selectedUsers = aReq.getParameterValues("secureusers");
+
+            aRes.setRenderParameter("op", CMSAdminConstants.OP_CONFIRMSECURE);
+            aRes.setRenderParameter("path", aReq.getParameter("path"));
+            aRes.setRenderParameter("confirm", "Security settings updated successfully.");
+         }
       }
       else
       {

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-11-13 17:01:04 UTC (rev 5630)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties	2006-11-13 17:31:54 UTC (rev 5631)
@@ -315,6 +315,7 @@
 TITLE_EDIT=Edit File
 TITLE_CREATE=Create File
 TITLE_UPLOAD=Upload File
+TITLE_SECURECONFIRM=Secure Node
 
 CMS_MENU=Action Menu
 CMS_ACTION=Action
@@ -339,6 +340,7 @@
 CMS_BACKTOBROWSER=Back to Directory Browser
 CMS_TRANSFER=Import/Export
 CMS_EXPORTARCHIVE=Export Folder
+CMS_SECURE=Secure
 
 CMS_CREATEFILEINDIR=Creating File in Directory
 CMS_FILENAME=FileName

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-11-13 17:01:04 UTC (rev 5630)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_en.properties	2006-11-13 17:31:54 UTC (rev 5631)
@@ -313,6 +313,7 @@
 TITLE_EDIT=Edit File
 TITLE_CREATE=Create File
 TITLE_UPLOAD=Upload File
+TITLE_SECURECONFIRM=Secure Node
 
 CMS_MENU=Action Menu
 CMS_ACTION=Action
@@ -337,6 +338,7 @@
 CMS_BACKTOBROWSER=Back to Directory Browser
 CMS_TRANSFER=Import/Export
 CMS_EXPORTARCHIVE=Export Folder
+CMS_SECURE=Secure
 
 CMS_CREATEFILEINDIR=Creating File in Directory
 CMS_FILENAME=FileName

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-11-13 17:01:04 UTC (rev 5630)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_es.properties	2006-11-13 17:31:54 UTC (rev 5631)
@@ -312,6 +312,7 @@
 TITLE_EDIT=Editar fichero
 TITLE_CREATE=Crear fichero
 TITLE_UPLOAD=Subir fichero
+TITLE_SECURECONFIRM=Secure Node
 
 CMS_MENU=Action Menu
 CMS_ACTION=Action
@@ -336,6 +337,7 @@
 CMS_BACKTOBROWSER=Back to Directory Browser
 CMS_TRANSFER=Import/Export
 CMS_EXPORTARCHIVE=Export Folder
+CMS_SECURE=Secure
 
 CMS_CREATEFILEINDIR=Creating File in Directory
 CMS_FILENAME=FileName

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-11-13 17:01:04 UTC (rev 5630)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_fr.properties	2006-11-13 17:31:54 UTC (rev 5631)
@@ -282,6 +282,7 @@
 TITLE_EDIT=Editer le fichier
 TITLE_CREATE=Creer le fichier
 TITLE_UPLOAD=Charger le fichier
+TITLE_SECURECONFIRM=Secure Node
 
 CMS_MENU=Action Menu
 CMS_ACTION=Action
@@ -306,6 +307,7 @@
 CMS_BACKTOBROWSER=Back to Directory Browser
 CMS_TRANSFER=Import/Export
 CMS_EXPORTARCHIVE=Export Folder
+CMS_SECURE=Secure
 
 CMS_CREATEFILEINDIR=Creating File in Directory
 CMS_FILENAME=FileName

Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/main.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/main.jsp	2006-11-13 17:01:04 UTC (rev 5630)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/main.jsp	2006-11-13 17:31:54 UTC (rev 5631)
@@ -89,6 +89,10 @@
    <portlet:param name="op" value="<%= CMSAdminConstants.OP_EXPORTARCHIVE %>"/>
    <portlet:param name="path" value="<%= sCurrPath %>"/>
    </portlet:renderURL>">${n:i18n("CMS_EXPORTARCHIVE")}</a></li>
+            <li><a href="<portlet:renderURL>
+   <portlet:param name="op" value="<%= CMSAdminConstants.OP_CONFIRMSECURE %>"/>
+   <portlet:param name="path" value="<%= sCurrPath %>"/>
+   </portlet:renderURL>">${n:i18n("CMS_SECURE")}</a></li>
             <%
                if (!"/".equals(sCurrPath))
                {

Added: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/securenode.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/securenode.jsp	2006-11-13 17:01:04 UTC (rev 5630)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/securenode.jsp	2006-11-13 17:31:54 UTC (rev 5631)
@@ -0,0 +1,105 @@
+<%@ page import="org.jboss.portal.core.portlet.cms.admin.CMSAdminConstants" %>
+<%@ page import="org.jboss.portal.identity.Role" %>
+<%@ page import="org.jboss.portal.identity.User" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="java.util.Set" %>
+<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" %>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
+<%@ taglib uri="/WEB-INF/portal-lib.tld" prefix="n" %>
+<%@ page isELIgnored="false" %>
+
+<portlet:defineObjects/>
+
+<%
+   String sCurrPath = (String)request.getAttribute("currpath");
+   Set roleSet = (Set)request.getAttribute("roles");
+   Set userSet = (Set)request.getAttribute("users");
+   String sConfirm = (String)request.getAttribute("confirm");
+%>
+
+<form action="<portlet:actionURL>
+ <portlet:param name="op" value="<%= CMSAdminConstants.OP_SECURE %>"/>
+ <portlet:param name="path" value="<%= sCurrPath %>"/>
+ </portlet:actionURL>" method="post">
+   <table width="100%">
+      <th colspan="2" align="center" class="portlet-section-header">${n:i18n("TITLE_SECURECONFIRM")}</th>
+      <%
+         if (sConfirm != null && !"".equals(sConfirm))
+         {
+      %>
+      <tr>
+         <td colspan="2">
+            <font color="red"><%= sConfirm %>
+            </font>
+         </td>
+      </tr>
+      <%
+         }
+      %>
+      <tr>
+         <td colspan="2">
+            <font class="portlet-font">Configure security restrictions on node: <%= sCurrPath %>
+            </font>
+         </td>
+      </tr>
+      <tr>
+         <td colspan="2" height="10"></td>
+      </tr>
+      <tr>
+         <td>
+            <select name="secureroles" multiple="multiple">
+               <option value="Anonymous">Anonymous</option>
+               <%
+                  Iterator iterator = roleSet.iterator();
+                  while (iterator.hasNext())
+                  {
+                     Role role = (Role)iterator.next();
+               %>
+               <option value="<%= role.getId() %>"><%= role.getDisplayName() %>
+               </option>
+               <%
+                  }
+               %>
+            </select>
+         </td>
+         <td>Select Roles that have access to this node.<br/>
+            (You may select multiple roles by using CTRL+click on the role names.)
+         </td>
+      </tr>
+      <tr>
+         <td colspan="2" height="10"></td>
+      </tr>
+      <tr>
+         <td>
+            <select name="secureusers" multiple="multiple">
+               <%
+                  Iterator iteratorUser = userSet.iterator();
+                  while (iteratorUser.hasNext())
+                  {
+                     User user = (User)iteratorUser.next();
+               %>
+               <option value="<%= user.getId() %>"><%= user.getUserName() %>
+               </option>
+               <%
+                  }
+               %>
+            </select>
+         </td>
+         <td>Select Users that have access to this node.<br/>
+            (You may select multiple users by using CTRL+click on the user names.)
+         </td>
+      </tr>
+      <tr>
+         <td align="center" colspan="2"><input type="submit" value="${n:i18n("CMS_SECURE")}" name="submit"
+                                               class="portlet-form-button"></td>
+      </tr>
+   </table>
+</form>
+
+<a href="<portlet:renderURL>
+                <portlet:param name="op" value="<%= CMSAdminConstants.OP_MAIN %>"/>
+                <portlet:param name="path"
+                  value="<%= sCurrPath %>"/>
+              </portlet:renderURL>">
+   <img src="<%= renderRequest.getContextPath() + CMSAdminConstants.DEFAULT_IMAGES_PATH%>/browse.gif" border="0"
+        alt="${n:i18n("CMS_BACKTOBROWSER")}"></a>
\ No newline at end of file

Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/viewfile.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/viewfile.jsp	2006-11-13 17:01:04 UTC (rev 5630)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/viewfile.jsp	2006-11-13 17:31:54 UTC (rev 5631)
@@ -115,6 +115,10 @@
    <portlet:param name="op" value="<%= CMSAdminConstants.OP_CONFIRMDELETE %>"/>
    <portlet:param name="path" value="<%= sCurrPath %>"/>
    </portlet:renderURL>">${n:i18n("CMS_DELETE")}</a></li>
+            <li><a href="<portlet:renderURL>
+   <portlet:param name="op" value="<%= CMSAdminConstants.OP_CONFIRMSECURE %>"/>
+   <portlet:param name="path" value="<%= sCurrPath %>"/>
+   </portlet:renderURL>">${n:i18n("CMS_SECURE")}</a></li>
          </ul>
       </li>
    </ul>




More information about the jboss-svn-commits mailing list