Author: roy.russo(a)jboss.com
Date: 2007-01-15 16:17:40 -0500 (Mon, 15 Jan 2007)
New Revision: 6006
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_pt_BR.properties
trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/viewfile.jsp
Log:
JBPORTAL-1153 - added ui for file approval/denial workflow
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 2007-01-13
01:48:24 UTC (rev 6005)
+++
trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminConstants.java 2007-01-15
21:17:40 UTC (rev 6006)
@@ -94,5 +94,9 @@
public static final String OP_CONFIRMSECURE = "confirmsecure";
- public static final String OP_SECURE = "secure";
+ public static final String OP_SECURE = "secure";
+
+ public static final String OP_APPROVE = "approve";
+
+ public static final String OP_DENY = "deny";
}
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 2007-01-13
01:48:24 UTC (rev 6005)
+++
trunk/core/src/main/org/jboss/portal/core/portlet/cms/admin/CMSAdminPortlet.java 2007-01-15
21:17:40 UTC (rev 6006)
@@ -22,8 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.portlet.cms.admin;
-import javax.portlet.PortletRequest;
-
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.portlet.PortletFileUpload;
@@ -37,52 +35,48 @@
import org.jboss.portal.cms.model.Content;
import org.jboss.portal.cms.model.File;
import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.cms.security.Criteria;
+import org.jboss.portal.cms.security.Permission;
+import org.jboss.portal.cms.security.PermissionManager;
import org.jboss.portal.cms.util.FileUtil;
import org.jboss.portal.cms.util.NodeUtil;
-import org.jboss.portal.cms.security.PermissionManager;
-import org.jboss.portal.cms.security.Permission;
-import org.jboss.portal.cms.security.Criteria;
-
import org.jboss.portal.core.cms.StreamContentCommand;
import org.jboss.portal.core.controller.ControllerContext;
+import org.jboss.portal.identity.AnnonymousRole;
import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.Role;
import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
+import org.jboss.portal.workflow.WorkflowException;
+import org.jboss.portal.workflow.cms.ApprovePublish;
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.identity.User;
-import org.jboss.portal.identity.Role;
-import org.jboss.portal.identity.AnnonymousRole;
-import org.jboss.portal.identity.MembershipModule;
-
-import org.jboss.portal.workflow.cms.ApprovePublish;
-import org.jboss.portal.workflow.WorkflowException;
-
+import javax.naming.InitialContext;
import javax.portlet.PortletException;
+import javax.portlet.PortletRequest;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletSession;
import javax.portlet.UnavailableException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
+import java.util.Collection;
import java.util.Date;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.Vector;
-import java.util.Collection;
-import java.util.ArrayList;
-import java.util.HashSet;
-import javax.naming.InitialContext;
-
/**
* @author <a href="mailto:roy@jboss.org">Roy Russo</a>
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
@@ -119,59 +113,58 @@
{
throw new PortletException("No membership module");
}
-
+
this.initializeApprovePublishWorkflow();
}
protected void doView(final JBossRenderRequest rReq, final JBossRenderResponse rRes)
throws PortletException, IOException, UnavailableException
{
- //check and make sure the CMSAdminPortlet is accessible to the current user
- if(!this.isPortletAccessible(rReq))
- {
- rRes.setContentType("text/html");
- PrintWriter writer = rRes.getWriter();
- String sHTML = "<h2>Access Denied</h2>";
- writer.write(sHTML);
- writer.close();
- return;
- }
-
-
- //now if the security console is being launched...make sure proper access is
fulfilled
- String op = rReq.getParameter("op");
- if(op!=null && CMSAdminConstants.OP_CONFIRMSECURE.equals(op))
- {
- if(!this.isSecurityConsoleAccessible(rReq))
- {
- rRes.setContentType("text/html");
- PrintWriter writer = rRes.getWriter();
- String sHTML = "<h2>Access Denied</h2>";
- writer.write(sHTML);
- writer.close();
- return;
- }
- }
-
-
+ //check and make sure the CMSAdminPortlet is accessible to the current user
+ if (!this.isPortletAccessible(rReq))
+ {
+ rRes.setContentType("text/html");
+ PrintWriter writer = rRes.getWriter();
+ String sHTML = "<h2>Access Denied</h2>";
+ writer.write(sHTML);
+ writer.close();
+ return;
+ }
+
+ //now if the security console is being launched...make sure proper access is
fulfilled
+ String op = rReq.getParameter("op");
+ if (op != null && CMSAdminConstants.OP_CONFIRMSECURE.equals(op))
+ {
+ if (!this.isSecurityConsoleAccessible(rReq))
+ {
+ rRes.setContentType("text/html");
+ PrintWriter writer = rRes.getWriter();
+ String sHTML = "<h2>Access Denied</h2>";
+ writer.write(sHTML);
+ writer.close();
+ return;
+ }
+ }
+
+
try
{
- if(rReq.getParameter("accessDenied")!=null)
- {
- throw new PortletException("Access to this resource is denied");
- }
- internalDoView(rReq, rRes);
+ if (rReq.getParameter("accessDenied") != null)
+ {
+ throw new PortletException("Access to this resource is denied");
+ }
+ internalDoView(rReq, rRes);
}
catch (CMSException e)
{
- if(e.toString().indexOf("Access to this resource is denied")!=-1)
- {
- throw new PortletException("Access to this resource is denied");
- }
- else
- {
- throw new PortletException(e);
- }
+ if (e.toString().indexOf("Access to this resource is denied") != -1)
+ {
+ throw new PortletException("Access to this resource is denied");
+ }
+ else
+ {
+ throw new PortletException(e);
+ }
}
}
@@ -250,19 +243,19 @@
List versionList = (List)CMSService.execute(getContentVersionsCMD);
contents.add(versionList);
}
-
+
//get the unapproved content for this file
- if(this.approvePublish!=null)
+ if (this.approvePublish != null)
{
- try
- {
- Collection pendingQueue = this.approvePublish.getPendingQueue(sPath);
- rReq.setAttribute("pendingQueue",pendingQueue);
- }
- catch(WorkflowException we)
- {
- rReq.setAttribute("pendingQueue",null);
- }
+ try
+ {
+ Collection pendingQueue = this.approvePublish.getPendingQueue(sPath);
+ rReq.setAttribute("pendingQueue", pendingQueue);
+ }
+ catch (WorkflowException we)
+ {
+ rReq.setAttribute("pendingQueue", null);
+ }
}
rRes.setContentType("text/html");
@@ -479,17 +472,17 @@
userSet = userModule.findUsers(0, 1000);
Collection permissions = PermissionManager.getInstance().
- findPermissionsByCriteria(new Criteria("path",sPath));
-
- readRoleSet = this.processRolePermissions(permissions,"read");
- readUserSet = this.processUserPermissions(permissions,"read");
-
- writeRoleSet = this.processRolePermissions(permissions,"write");
- writeUserSet = this.processUserPermissions(permissions,"write");
-
- manageRoleSet = this.processRolePermissions(permissions,"manage");
- manageUserSet = this.processUserPermissions(permissions,"manage");
-
+ findPermissionsByCriteria(new Criteria("path", sPath));
+
+ readRoleSet = this.processRolePermissions(permissions, "read");
+ readUserSet = this.processUserPermissions(permissions, "read");
+
+ writeRoleSet = this.processRolePermissions(permissions, "write");
+ writeUserSet = this.processUserPermissions(permissions, "write");
+
+ manageRoleSet = this.processRolePermissions(permissions,
"manage");
+ manageUserSet = this.processUserPermissions(permissions,
"manage");
+
}
catch (IdentityException ie)
{
@@ -501,15 +494,15 @@
rReq.setAttribute("roles", roleSet);
rReq.setAttribute("users", userSet);
- rReq.setAttribute("readRoleSet",readRoleSet);
- rReq.setAttribute("readUserSet",readUserSet);
- rReq.setAttribute("writeRoleSet",writeRoleSet);
- rReq.setAttribute("writeUserSet",writeUserSet);
- rReq.setAttribute("manageRoleSet",manageRoleSet);
- rReq.setAttribute("manageUserSet",manageUserSet);
-
+ rReq.setAttribute("readRoleSet", readRoleSet);
+ rReq.setAttribute("readUserSet", readUserSet);
+ rReq.setAttribute("writeRoleSet", writeRoleSet);
+ rReq.setAttribute("writeUserSet", writeUserSet);
+ rReq.setAttribute("manageRoleSet", manageRoleSet);
+ rReq.setAttribute("manageUserSet", manageUserSet);
+
//operation to return from the security console
- rReq.setAttribute("returnOp",returnOp);
+ rReq.setAttribute("returnOp", returnOp);
if (sConfirm != null)
{
@@ -522,33 +515,33 @@
public void processAction(final JBossActionRequest aReq, final JBossActionResponse
aRes) throws PortletException
{
- //now if the security console is being launched...make sure proper access is
fulfilled
- String op = aReq.getParameter("op");
- if(op!=null && CMSAdminConstants.OP_SECURE.equals(op))
- {
- if(!this.isSecurityConsoleAccessible(aReq))
- {
- aRes.setRenderParameter("op",
CMSAdminConstants.OP_CONFIRMSECURE);
- aRes.setRenderParameter("path",
aReq.getParameter("path"));
- aRes.setRenderParameter("confirm", "Access to the Security
Console was Denied");
- return;
- }
- }
-
+ //now if the security console is being launched...make sure proper access is
fulfilled
+ String op = aReq.getParameter("op");
+ if (op != null && CMSAdminConstants.OP_SECURE.equals(op))
+ {
+ if (!this.isSecurityConsoleAccessible(aReq))
+ {
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_CONFIRMSECURE);
+ aRes.setRenderParameter("path",
aReq.getParameter("path"));
+ aRes.setRenderParameter("confirm", "Access to the Security
Console was Denied");
+ return;
+ }
+ }
+
try
{
internalProcessAction(aReq, aRes);
}
catch (CMSException e)
{
- if(e.toString().indexOf("Access to this resource is denied")!=-1)
- {
- aRes.setRenderParameter("accessDenied","true");
- }
- else
- {
- throw new PortletException(e);
- }
+ if (e.toString().indexOf("Access to this resource is denied") != -1)
+ {
+ aRes.setRenderParameter("accessDenied", "true");
+ }
+ else
+ {
+ throw new PortletException(e);
+ }
}
}
@@ -1031,27 +1024,59 @@
}
else if (CMSAdminConstants.OP_SECURE.equals(op))
{
- boolean success = false;
- try
- {
- this.storePermissions(aReq);
- success = true;
- }
- catch(Exception e)
- {
- aRes.setRenderParameter("confirm", "An error occurred
while setting the permissions.("+e.toString()+")");
- success = false;
- }
-
- if(success)
- {
- aRes.setRenderParameter("confirm", "Security settings
updated successfully.");
- }
-
- aRes.setRenderParameter("op",
CMSAdminConstants.OP_CONFIRMSECURE);
- aRes.setRenderParameter("path",
aReq.getParameter("path"));
- aRes.setRenderParameter("returnOp",
aReq.getParameter("returnOp"));
+ boolean success = false;
+ try
+ {
+ this.storePermissions(aReq);
+ success = true;
+ }
+ catch (Exception e)
+ {
+ aRes.setRenderParameter("confirm", "An error occurred while
setting the permissions.(" + e.toString() + ")");
+ success = false;
+ }
+
+ if (success)
+ {
+ aRes.setRenderParameter("confirm", "Security settings
updated successfully.");
+ }
+
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_CONFIRMSECURE);
+ aRes.setRenderParameter("path",
aReq.getParameter("path"));
+ aRes.setRenderParameter("returnOp",
aReq.getParameter("returnOp"));
}
+ else if (CMSAdminConstants.OP_APPROVE.equals(op))
+ {
+ String sManager = aReq.getParameter("manager"); // TODO: fix with
identity module integration
+ String sPID = aReq.getParameter("pid");
+
+ try
+ {
+ this.approvePublish.processManagerResponse(Long.parseLong(sPID), sManager,
true);
+ }
+ catch (Exception e)
+ {
+ // TODO: fix me.
+ }
+ aRes.setRenderParameter("path",
aReq.getParameter("path"));
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWFILE);
+ }
+ else if (CMSAdminConstants.OP_DENY.equals(op))
+ {
+ String sManager = aReq.getParameter("manager"); // TODO: fix with
identity module integration
+ String sPID = aReq.getParameter("pid");
+
+ try
+ {
+ this.approvePublish.processManagerResponse(Long.parseLong(sPID), sManager,
false);
+ }
+ catch (Exception e)
+ {
+ // TODO: fix me.
+ }
+ aRes.setRenderParameter("path",
aReq.getParameter("path"));
+ aRes.setRenderParameter("op", CMSAdminConstants.OP_VIEWFILE);
+ }
}
else
{
@@ -1089,242 +1114,231 @@
ControllerContext cc = req.getControllerContext();
return cc.renderURL(cmd, NON_SECURE_NON_AUTH_URL_CONTEXT,
RELATIVE_SERVLET_ENCODED_URL_FORMAT);
}
-
+
static final URLContext NON_SECURE_NON_AUTH_URL_CONTEXT =
URLContext.newInstance(false, false);
static final URLFormat RELATIVE_SERVLET_ENCODED_URL_FORMAT =
URLFormat.newInstance(true, true);
-
+
//fine-grained access related ui control
logic-------------------------------------------------------------------------------------------------
- /**
- *
- * @param aReq
- */
+ /** @param aReq */
private void storePermissions(JBossActionRequest aReq) throws Exception
{
- String path = aReq.getParameter("path");
- String[] readRoles = aReq.getParameterValues("secureroles:read");
- String[] readUsers = aReq.getParameterValues("secureusers:read");
- String[] writeRoles = aReq.getParameterValues("secureroles:write");
- String[] writeUsers = aReq.getParameterValues("secureusers:write");
- String[] manageRoles = aReq.getParameterValues("secureroles:manage");
- String[] manageUsers = aReq.getParameterValues("secureusers:manage");
-
-
- if(
- (readRoles==null || readRoles.length==0) &&
- (readUsers==null || readUsers.length==0) &&
- (writeRoles==null || writeRoles.length==0) &&
- (writeUsers==null || writeUsers.length==0) &&
- (manageRoles==null || manageRoles.length==0) &&
- (manageUsers==null || manageUsers.length==0)
- )
- {
- //remove all direct permissions on this node
- Collection oldPermissions =
PermissionManager.getInstance().findPermissionsByCriteria(new
Criteria("path",path));
- PermissionManager.getInstance().remove(oldPermissions);
- return;
- }
-
- //cleanup the old permissions on this node, before new ones are created
- Collection oldPermissions =
PermissionManager.getInstance().findPermissionsByCriteria(new
Criteria("path",path));
- PermissionManager.getInstance().remove(oldPermissions);
-
- //setup the read permission on this node
- this.storePermission("read",path,readRoles,readUsers);
-
- //setup the write permission on this node
- this.storePermission("write",path,writeRoles,writeUsers);
-
- //setup the manage permission on this node
- this.storePermission("manage",path,manageRoles,manageUsers);
+ String path = aReq.getParameter("path");
+ String[] readRoles = aReq.getParameterValues("secureroles:read");
+ String[] readUsers = aReq.getParameterValues("secureusers:read");
+ String[] writeRoles = aReq.getParameterValues("secureroles:write");
+ String[] writeUsers = aReq.getParameterValues("secureusers:write");
+ String[] manageRoles = aReq.getParameterValues("secureroles:manage");
+ String[] manageUsers = aReq.getParameterValues("secureusers:manage");
+
+
+ if (
+ (readRoles == null || readRoles.length == 0) &&
+ (readUsers == null || readUsers.length == 0) &&
+ (writeRoles == null || writeRoles.length == 0) &&
+ (writeUsers == null || writeUsers.length == 0) &&
+ (manageRoles == null || manageRoles.length == 0) &&
+ (manageUsers == null || manageUsers.length == 0)
+ )
+ {
+ //remove all direct permissions on this node
+ Collection oldPermissions =
PermissionManager.getInstance().findPermissionsByCriteria(new Criteria("path",
path));
+ PermissionManager.getInstance().remove(oldPermissions);
+ return;
+ }
+
+ //cleanup the old permissions on this node, before new ones are created
+ Collection oldPermissions =
PermissionManager.getInstance().findPermissionsByCriteria(new Criteria("path",
path));
+ PermissionManager.getInstance().remove(oldPermissions);
+
+ //setup the read permission on this node
+ this.storePermission("read", path, readRoles, readUsers);
+
+ //setup the write permission on this node
+ this.storePermission("write", path, writeRoles, writeUsers);
+
+ //setup the manage permission on this node
+ this.storePermission("manage", path, manageRoles, manageUsers);
}
-
+
/**
- *
* @param permission
* @param action
* @param criteria
* @param roles
* @param users
*/
- private void storePermission(String action,String path,String[] roles,String[] users)
throws Exception
- {
- Permission permission = new Permission("cms",action);
- permission.addCriteria(new Criteria("path",path));
-
- Set rolesSet = null;
- if(roles!=null && roles.length>0)
- {
- rolesSet = new HashSet();
- for(int i=0;i<roles.length;i++)
- {
- int roleId = Integer.parseInt(roles[i]);
- Role role = null;
- if(roleId>0)
- {
- role = this.roleModule.findRoleById(roles[i]);
- }
- else
- {
- role = new AnnonymousRole();
- }
- rolesSet.add(role);
- }
- }
-
- Set usersSet = null;
- if(users!=null && users.length>0)
- {
- usersSet = new HashSet();
- for(int i=0;i<users.length;i++)
- {
- User user = this.userModule.findUserById(users[i]);
- usersSet.add(user);
- }
- }
-
- PermissionManager.getInstance().store(permission,rolesSet,usersSet);
+ private void storePermission(String action, String path, String[] roles, String[]
users) throws Exception
+ {
+ Permission permission = new Permission("cms", action);
+ permission.addCriteria(new Criteria("path", path));
+
+ Set rolesSet = null;
+ if (roles != null && roles.length > 0)
+ {
+ rolesSet = new HashSet();
+ for (int i = 0; i < roles.length; i++)
+ {
+ int roleId = Integer.parseInt(roles[i]);
+ Role role = null;
+ if (roleId > 0)
+ {
+ role = this.roleModule.findRoleById(roles[i]);
+ }
+ else
+ {
+ role = new AnnonymousRole();
+ }
+ rolesSet.add(role);
+ }
+ }
+
+ Set usersSet = null;
+ if (users != null && users.length > 0)
+ {
+ usersSet = new HashSet();
+ for (int i = 0; i < users.length; i++)
+ {
+ User user = this.userModule.findUserById(users[i]);
+ usersSet.add(user);
+ }
+ }
+
+ PermissionManager.getInstance().store(permission, rolesSet, usersSet);
}
-
+
/**
- *
* @param permissions
* @param action
* @return
*/
- private Set processRolePermissions(Collection permissions,String action)
+ private Set processRolePermissions(Collection permissions, String action)
{
- Set rolePermissions = new HashSet();
-
- if(permissions!=null)
- {
- for(Iterator itr=permissions.iterator();itr.hasNext();)
- {
- Permission permission = (Permission)itr.next();
- if(permission.getService().equals("cms") &&
permission.getAction().equals(action))
- {
- rolePermissions.addAll(permission.getRoleAssocIds());
- }
- }
- }
-
- return rolePermissions;
+ Set rolePermissions = new HashSet();
+
+ if (permissions != null)
+ {
+ for (Iterator itr = permissions.iterator(); itr.hasNext();)
+ {
+ Permission permission = (Permission)itr.next();
+ if (permission.getService().equals("cms") &&
permission.getAction().equals(action))
+ {
+ rolePermissions.addAll(permission.getRoleAssocIds());
+ }
+ }
+ }
+
+ return rolePermissions;
}
-
+
/**
- *
* @param permissions
* @param action
* @return
*/
- private Set processUserPermissions(Collection permissions,String action)
+ private Set processUserPermissions(Collection permissions, String action)
{
- Set userPermissions = new HashSet();
-
- if(permissions!=null)
- {
- for(Iterator itr=permissions.iterator();itr.hasNext();)
- {
- Permission permission = (Permission)itr.next();
- if(permission.getService().equals("cms") &&
permission.getAction().equals(action))
- {
- userPermissions.addAll(permission.getUserAssocIds());
- }
- }
- }
-
- return userPermissions;
- }
-
+ Set userPermissions = new HashSet();
+
+ if (permissions != null)
+ {
+ for (Iterator itr = permissions.iterator(); itr.hasNext();)
+ {
+ Permission permission = (Permission)itr.next();
+ if (permission.getService().equals("cms") &&
permission.getAction().equals(action))
+ {
+ userPermissions.addAll(permission.getUserAssocIds());
+ }
+ }
+ }
+
+ return userPermissions;
+ }
+
/**
- *
* @param aReq
* @return
*/
private boolean isPortletAccessible(PortletRequest portletRequest)
{
- try
- {
- boolean isPortletAccessible = false;
-
- if(portletRequest.getUserPrincipal()!=null)
- {
- User user =
this.userModule.findUserByUserName(portletRequest.getUserPrincipal().getName());
- Collection permissions =
PermissionManager.getInstance().findPermissionsByUser(((Long)user.getId()).longValue());
- if(permissions != null)
+ try
+ {
+ boolean isPortletAccessible = false;
+
+ if (portletRequest.getUserPrincipal() != null)
+ {
+ User user =
this.userModule.findUserByUserName(portletRequest.getUserPrincipal().getName());
+ Collection permissions =
PermissionManager.getInstance().findPermissionsByUser(((Long)user.getId()).longValue());
+ if (permissions != null)
+ {
+ for (Iterator itr = permissions.iterator(); itr.hasNext();)
{
- for(Iterator itr=permissions.iterator();itr.hasNext();)
- {
- Permission permission = (Permission)itr.next();
- if( (permission.getService().equals("cms")) &&
- (permission.getAction().equals("write") ||
permission.getAction().equals("manage"))
- )
- {
- isPortletAccessible = true;
- }
- }
+ Permission permission = (Permission)itr.next();
+ if ((permission.getService().equals("cms")) &&
+ (permission.getAction().equals("write") ||
permission.getAction().equals("manage"))
+ )
+ {
+ isPortletAccessible = true;
+ }
}
- }
-
- return isPortletAccessible;
- }
- catch(Exception e)
- {
- return false;
- }
+ }
+ }
+
+ return isPortletAccessible;
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
}
-
+
/**
- *
* @param aReq
* @return
*/
private boolean isSecurityConsoleAccessible(PortletRequest portletRequest)
{
- try
- {
- boolean isAccessible = false;
-
- if(portletRequest.getUserPrincipal()!=null)
- {
- User user =
this.userModule.findUserByUserName(portletRequest.getUserPrincipal().getName());
- Set roles = this.membershipModule.getRoles(user);
- if(roles!=null)
+ try
+ {
+ boolean isAccessible = false;
+
+ if (portletRequest.getUserPrincipal() != null)
+ {
+ User user =
this.userModule.findUserByUserName(portletRequest.getUserPrincipal().getName());
+ Set roles = this.membershipModule.getRoles(user);
+ if (roles != null)
+ {
+ for (Iterator itr = roles.iterator(); itr.hasNext();)
{
- for(Iterator itr=roles.iterator();itr.hasNext();)
- {
- Role role = (Role)itr.next();
- if(role.getName().equalsIgnoreCase("admin"))
- {
- isAccessible = true;
- break;
- }
- }
+ Role role = (Role)itr.next();
+ if (role.getName().equalsIgnoreCase("admin"))
+ {
+ isAccessible = true;
+ break;
+ }
}
- }
-
- return isAccessible;
- }
- catch(Exception e)
- {
- return false;
- }
+ }
+ }
+
+ return isAccessible;
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
}
-
- /**
- *
- * @return
- */
+
+ /** @return */
private void initializeApprovePublishWorkflow()
{
- try
- {
- InitialContext context = new InitialContext();
- this.approvePublish =
(ApprovePublish)context.lookup("java:portal/ApprovePublishWorkflow");
- }
- catch(Exception e)
- {
- this.approvePublish = null;
- }
+ try
+ {
+ InitialContext context = new InitialContext();
+ this.approvePublish =
(ApprovePublish)context.lookup("java:portal/ApprovePublishWorkflow");
+ }
+ catch (Exception e)
+ {
+ this.approvePublish = null;
+ }
}
}
\ 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 2007-01-13
01:48:24 UTC (rev 6005)
+++
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource.properties 2007-01-15
21:17:40 UTC (rev 6006)
@@ -365,6 +365,11 @@
CMS_CONTENT_DIR_USE=Use the directory tree to navigate the portal folder structure.
CMS_MAIN_USE=Use the CMS Administration portlet to manage the content of your portal.
+CMS_CREATED_BY=Created By
+CMS_APPROVE=Approve
+CMS_DENY=Deny
+CMS_APPROVAL=Pending Items
+
VALIDATIONEMAIL_1=A user with this email address has registered on our site.
VALIDATIONEMAIL_2=Please keep this email for your records. Your account information is as
follows
VALIDATIONEMAIL_3=Your account is currently inactive. You cannot use it until you visit
the following link
Modified:
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_pt_BR.properties
===================================================================
---
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_pt_BR.properties 2007-01-13
01:48:24 UTC (rev 6005)
+++
trunk/core/src/resources/portal-core-war/WEB-INF/classes/Resource_pt_BR.properties 2007-01-15
21:17:40 UTC (rev 6006)
@@ -339,6 +339,15 @@
CMS_LIVEVERSION=Vers�o \"Ativa\"
CMS_SIZE=Tamanho
+CMS_CONTENT_DIR=Content Directory
+CMS_CONTENT_DIR_USE=Use the directory tree to navigate the portal folder structure.
+CMS_MAIN_USE=Use the CMS Administration portlet to manage the content of your portal.
+
+CMS_CREATED_BY=Created By
+CMS_APPROVE=Approve
+CMS_DENY=Deny
+CMS_APPROVAL=Pending Items
+
VALIDATIONEMAIL_1=Um usu�rio com este endere�o de email j� existe em nosso sistema.
VALIDATIONEMAIL_2=Mantenha esse email salvo. As informa��es de sua conta est�o a seguir
VALIDATIONEMAIL_3=Sua conta esta atualmente inativa. Voc� n�o pode utiliz�-la at� visitar
o link
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 2007-01-13
01:48:24 UTC (rev 6005)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/cms/admin/viewfile.jsp 2007-01-15
21:17:40 UTC (rev 6006)
@@ -8,11 +8,11 @@
<%@ page import="org.jboss.portal.core.portlet.cms.admin.CMSAdminConstants"
%>
<%@ page import="java.text.Format" %>
<%@ page import="java.text.SimpleDateFormat" %>
+<%@ page import="java.util.Collection" %>
+<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.StringTokenizer" %>
<%@ page import="java.util.Vector" %>
-<%@ page import="java.util.Collection" %>
-<%@ page import="java.util.Iterator" %>
<portlet:defineObjects/>
@@ -20,7 +20,7 @@
String sCurrPath = (String)request.getAttribute("currpath");
Vector vContents = (Vector)request.getAttribute("contents");
Collection pendingQueue = (Collection)request.getAttribute("pendingQueue");
-
+
String sType = "";
if (vContents.size() > 0)
{
@@ -36,7 +36,7 @@
String createDate = "";
String modifiedDate = "";
- String rowClass = "portlet-section-body";
+ String rowClass = "portlet-section-body";
%>
<br>
@@ -124,6 +124,11 @@
<portlet:param name="path" value="<%= sCurrPath %>"/>
<portlet:param name="returnOp" value="<%=
CMSAdminConstants.OP_VIEWFILE %>"/>
</portlet:renderURL>">${n:i18n("CMS_SECURE")}</a></li>
+ <li><a href="<portlet:renderURL>
+ <portlet:param name="op" value="<%=
CMSAdminConstants.OP_CONFIRMSECURE %>"/>
+ <portlet:param name="path" value="<%= sCurrPath %>"/>
+ <portlet:param name="returnOp" value="<%=
CMSAdminConstants.OP_VIEWFILE %>"/>
+
</portlet:renderURL>">${n:i18n("CMS_APPROVAL")}</a></li>
</ul>
</li>
</ul>
@@ -186,13 +191,13 @@
<%
for (int i = 0; i < contentList.size(); i++) // cycle thru list of version nodes
{
- Content version = (Content)contentList.get(i);
-
- if(version.isWaitingForPublishApproval())
+ Content version = (Content)contentList.get(i);
+
+ if (version.isWaitingForPublishApproval())
{
- continue;
- }
-
+ continue;
+ }
+
if (i % 2 == 0)
{
rowClass = "portlet-section-body";
@@ -240,7 +245,7 @@
%>
<a target="_blank"
href="<%= request.getContextPath() %>/cmspreview?v=<%=
version.getVersionNumber() %>&l=<%= content.getLocale().getLanguage()
%>&p=<%= sCurrPath %>"><%=
- version.getVersionNumber() %>
+ version.getVersionNumber() %>
</a>
<%
}
@@ -287,45 +292,71 @@
</table>
<!-- the approval queue, content waiting for managers to signoff on -->
-<%if(pendingQueue!=null && !pendingQueue.isEmpty()){%>
+<%
+ if (pendingQueue != null && !pendingQueue.isEmpty())
+ {
+%>
<br/><br/>
-<span class="portlet-table-text">Pending Approval Queue:</span>
+<div align="center"><font
class="portlet-font-dim"><b>Pending Approval
Queue</b></font></div>
<br/>
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
-<tr>
- <td
class="portlet-table-text"><b>${n:i18n("CMS_TYPE")}</b></td>
- <td
class="portlet-table-text"><b>${n:i18n("CMS_SIZE")}</b></td>
- <td
class="portlet-table-text"><b>${n:i18n("CMS_CREATED")}</b></td>
- <td class="portlet-table-text"><b>User</b></td>
-</tr>
-<%int i=0;%>
-<%for(Iterator itr=pendingQueue.iterator();itr.hasNext();){%>
- <%
- org.jboss.portal.workflow.cms.Content cour =
(org.jboss.portal.workflow.cms.Content)itr.next();
- if (i % 2 == 0)
- {
- rowClass = "portlet-section-body";
- }
- else
- {
- rowClass = "portlet-section-alternate";
- }
- i++;
+ <tr>
+ <td
class="portlet-table-text"><b>${n:i18n("CMS_TYPE")}</b></td>
+ <td
class="portlet-table-text"><b>${n:i18n("CMS_SIZE")}</b></td>
+ <td
class="portlet-table-text"><b>${n:i18n("CMS_CREATED")}</b></td>
+ <td
class="portlet-table-text"><b>${n:i18n("CMS_CREATED_BY")}</b></td>
+ <td
class="portlet-table-text"><b>${n:i18n("CMS_ACTION")}</b></td>
+ </tr>
+ <%int i = 0;%>
+ <%
+ for (Iterator itr = pendingQueue.iterator(); itr.hasNext();)
+ {
%>
-<tr onmouseover="this.className='portlet-section-selected';"
onmouseout="this.className='<%= rowClass %>';"
-class="<%= rowClass %>">
- <!-- Mime Type -->
- <td><%= cour.getMimeType() %></td>
- <!-- Size -->
- <td><%= cour.getSizeStr() %></td>
- <!-- Creation Date -->
- <td>
- <%= cour.getCreationDateStr() %>
- </td>
- <!-- User who requested approval -->
- <td><%= cour.getUserName() %></td>
-</tr>
-<%}%>
+ <%
+ // TODO: need accessor for approvalpid in Content, for param in links below.
+ // TODO: need security access to get current manager as param for links below.
+ org.jboss.portal.workflow.cms.Content cour =
(org.jboss.portal.workflow.cms.Content)itr.next();
+ if (i % 2 == 0)
+ {
+ rowClass = "portlet-section-body";
+ }
+ else
+ {
+ rowClass = "portlet-section-alternate";
+ }
+ i++;
+ %>
+ <tr class="<%= rowClass %>">
+ <!-- Mime Type -->
+ <td><%= cour.getMimeType() %>
+ </td>
+ <!-- Size -->
+ <td><%= cour.getSizeStr() %>
+ </td>
+ <!-- Creation Date -->
+ <td>
+ <%= cour.getCreationDateStr() %>
+ </td>
+ <!-- User who requested approval -->
+ <td><%= cour.getUserName() %>
+ </td>
+ <td>
+ <a href="<portlet:actionURL>
+ <portlet:param name="op" value="<%=
CMSAdminConstants.OP_APPROVE %>"/>
+ <portlet:param name="pid" value="TODO"/>
+ <portlet:param name="manager" value="TODO"/>
+ <portlet:param name="path" value="<%= sCurrPath
%>"/>
+
</portlet:actionURL>">${n:i18n("CMS_APPROVE")}</a>
+
+ <a href="<portlet:actionURL>
+ <portlet:param name="op" value="<%=
CMSAdminConstants.OP_DENY %>"/>
+ <portlet:param name="pid" value="TODO"/>
+ <portlet:param name="manager" value="TODO"/>
+ <portlet:param name="path" value="<%= sCurrPath
%>"/>
+ </portlet:actionURL>">${n:i18n("CMS_DENY")}</a>
+ </td>
+ </tr>
+ <%}%>
</table>
<%}%>