[pal-cvs 2622] [354] access control.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 7月 23日 (月) 16:09:55 JST


Revision: 354
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=354
Author:   shinsuke
Date:     2007-07-23 16:09:55 +0900 (Mon, 23 Jul 2007)

Log Message:
-----------
access control. redirect to a correct page. 

Modified Paths:
--------------
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/logic/SiteEditorLogic.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/service/SiteEditorService.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/util/PALAdminUtil.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/AbstractSiteEditorPage.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderAddFolderAndPageEditorPage.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderInfoEditorPage.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderSecurityEditorPage.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutAddPortletEditorPage.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutInfoEditorPage.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PageInfoEditorPage.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PageSecurityEditorPage.java
    pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PortletInfoEditorPage.java
    pal-admin/trunk/src/main/resources/appMessages.properties


-------------- next part --------------
Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/logic/SiteEditorLogic.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/logic/SiteEditorLogic.java	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/logic/SiteEditorLogic.java	2007-07-23 07:09:55 UTC (rev 354)
@@ -30,10 +30,12 @@
 import jp.sf.pal.admin.util.PortalComponentUtil;
 import jp.sf.pal.common.CommonException;
 
+import org.apache.jetspeed.JetspeedActions;
 import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.jetspeed.components.portletregistry.PortletRegistry;
 import org.apache.jetspeed.decoration.DecorationFactory;
 import org.apache.jetspeed.decoration.LayoutInfo;
+import org.apache.jetspeed.om.common.SecuredResource;
 import org.apache.jetspeed.om.common.SecurityConstraint;
 import org.apache.jetspeed.om.common.SecurityConstraints;
 import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
@@ -189,15 +191,19 @@
     public List<NodeInfo> getTreeNode(String path, String returnPath)
             throws CommonException {
         List<NodeInfo> treeList = new ArrayList<NodeInfo>();
-        treeList.add(new NodeInfo(NodeInfo.FOLDER, "/", "/", returnPath, 0,
-                true, true/*"/".equals(getFolderOrPagePath(path))*/));
 
         try {
             Folder rootFolder = getPageManager().getFolder("/");
-            List<NodeInfo> childTreeList = constructTreeNode(rootFolder, path,
-                    returnPath, 1);
-            if (childTreeList != null) {
-                treeList.addAll(childTreeList);
+            if (PALAdminUtil.checkAccess(rootFolder, JetspeedActions.VIEW)) {
+                treeList
+                        .add(new NodeInfo(NodeInfo.FOLDER, "/", "/",
+                                returnPath, 0, true, true/*"/".equals(getFolderOrPagePath(path))*/));
+
+                List<NodeInfo> childTreeList = constructTreeNode(rootFolder,
+                        path, returnPath, 1);
+                if (childTreeList != null) {
+                    treeList.addAll(childTreeList);
+                }
             }
             return treeList;
         } catch (FolderNotFoundException e) {
@@ -241,13 +247,16 @@
                 for (Iterator<Folder> ite = parent.getFolders().iterator(); ite
                         .hasNext();) {
                     Folder child = ite.next();
-                    treeList.add(new NodeInfo(NodeInfo.FOLDER, child.getName(),
-                            child.getPath(), returnPath, depth, false, false));
-                    if (targetPathName.equals(child.getName())) {
-                        List<NodeInfo> childTreeList = constructTreeNode(child,
-                                path, returnPath, depth + 1);
-                        if (childTreeList != null) {
-                            treeList.addAll(childTreeList);
+                    if (PALAdminUtil.checkAccess(child, JetspeedActions.VIEW)) {
+                        treeList.add(new NodeInfo(NodeInfo.FOLDER, child
+                                .getName(), child.getPath(), returnPath, depth,
+                                false, false));
+                        if (targetPathName.equals(child.getName())) {
+                            List<NodeInfo> childTreeList = constructTreeNode(
+                                    child, path, returnPath, depth + 1);
+                            if (childTreeList != null) {
+                                treeList.addAll(childTreeList);
+                            }
                         }
                     }
                 }
@@ -260,25 +269,33 @@
                 for (Iterator<Page> ite = parent.getPages().iterator(); ite
                         .hasNext();) {
                     Page child = ite.next();
-                    if (targetPathName.equals(child.getName())) {
-                        treeList.add(new NodeInfo(NodeInfo.PAGE, child
-                                .getName(), child.getPath(), returnPath, depth,
-                                true, true));
-                        // layout and portlet
-                        Fragment rootFragment = child.getRootFragment();
-                        if (rootFragment != null) {
-                            treeList.add(new NodeInfo(NodeInfo.LAYOUT,
-                                    getLayoutOrPortletName(rootFragment
-                                            .getName()), createPath(child
-                                            .getPath(), rootFragment.getId()),
-                                    returnPath, depth + 1, true, true));
-                            treeList.addAll(constructTreeNode(rootFragment,
-                                    path, returnPath, depth + 2));
+                    if (PALAdminUtil.checkAccess(child, JetspeedActions.VIEW)) {
+                        if (targetPathName.equals(child.getName())) {
+                            treeList.add(new NodeInfo(NodeInfo.PAGE, child
+                                    .getName(), child.getPath(), returnPath,
+                                    depth, true, true));
+                            // layout and portlet
+                            Fragment rootFragment = child.getRootFragment();
+                            if (rootFragment != null) {
+                                String fragmentId = getFragmentId(path);
+                                boolean selected = true;
+                                if (fragmentId == null || fragmentId.equals("")) {
+                                    selected = false;
+                                }
+                                treeList.add(new NodeInfo(NodeInfo.LAYOUT,
+                                        getLayoutOrPortletName(rootFragment
+                                                .getName()), createPath(child
+                                                .getPath(), rootFragment
+                                                .getId()), returnPath,
+                                        depth + 1, true, selected));
+                                treeList.addAll(constructTreeNode(rootFragment,
+                                        path, returnPath, depth + 2));
+                            }
+                        } else {
+                            treeList.add(new NodeInfo(NodeInfo.PAGE, child
+                                    .getName(), child.getPath(), returnPath,
+                                    depth, false, false));
                         }
-                    } else {
-                        treeList.add(new NodeInfo(NodeInfo.PAGE, child
-                                .getName(), child.getPath(), returnPath, depth,
-                                false, false));
                     }
                 }
             } catch (NodeException e) {
@@ -294,23 +311,25 @@
                 for (Iterator<Folder> ite = parent.getFolders().iterator(); ite
                         .hasNext();) {
                     Folder child = ite.next();
-                    if (targetPathName.equals(child.getName())) {
-                        List<NodeInfo> childTreeList = constructTreeNode(child,
-                                path, returnPath, depth + 1);
-                        if (childTreeList != null) {
-                            treeList.add(new NodeInfo(NodeInfo.FOLDER, child
-                                    .getName(), child.getPath(), returnPath,
-                                    depth, true, true));
-                            treeList.addAll(childTreeList);
+                    if (PALAdminUtil.checkAccess(child, JetspeedActions.VIEW)) {
+                        if (targetPathName.equals(child.getName())) {
+                            List<NodeInfo> childTreeList = constructTreeNode(
+                                    child, path, returnPath, depth + 1);
+                            if (childTreeList != null) {
+                                treeList.add(new NodeInfo(NodeInfo.FOLDER,
+                                        child.getName(), child.getPath(),
+                                        returnPath, depth, true, true));
+                                treeList.addAll(childTreeList);
+                            } else {
+                                treeList.add(new NodeInfo(NodeInfo.FOLDER,
+                                        child.getName(), child.getPath(),
+                                        returnPath, depth, true, true));
+                            }
                         } else {
                             treeList.add(new NodeInfo(NodeInfo.FOLDER, child
                                     .getName(), child.getPath(), returnPath,
-                                    depth, true, true));
+                                    depth, false, false));
                         }
-                    } else {
-                        treeList.add(new NodeInfo(NodeInfo.FOLDER, child
-                                .getName(), child.getPath(), returnPath, depth,
-                                false, false));
                     }
                 }
             } catch (DocumentException e) {
@@ -322,8 +341,11 @@
                 for (Iterator<Page> ite = parent.getPages().iterator(); ite
                         .hasNext();) {
                     Page child = ite.next();
-                    treeList.add(new NodeInfo(NodeInfo.PAGE, child.getName(),
-                            child.getPath(), returnPath, depth, false, false));
+                    if (PALAdminUtil.checkAccess(child, JetspeedActions.VIEW)) {
+                        treeList.add(new NodeInfo(NodeInfo.PAGE, child
+                                .getName(), child.getPath(), returnPath, depth,
+                                false, false));
+                    }
                 }
             } catch (NodeException e) {
                 logger.warn("Could not get pages: " + path, e);
@@ -531,16 +553,20 @@
 
         map = new HashMap<String, String>();
         map.put("label", "View");
-        map.put("value", "view");
+        map.put("value", JetspeedActions.VIEW);
         list.add(map);
         map = new HashMap<String, String>();
         map.put("label", "Edit");
-        map.put("value", "edit");
+        map.put("value", JetspeedActions.EDIT);
         list.add(map);
         map = new HashMap<String, String>();
         map.put("label", "Help");
-        map.put("value", "help");
+        map.put("value", JetspeedActions.HELP);
         list.add(map);
+        //        map = new HashMap<String, String>();
+        //        map.put("label", "Print");
+        //        map.put("value", JetspeedActions.PRINT);
+        //        list.add(map);
 
         return list;
     }
@@ -622,6 +648,7 @@
         page.setHidden(pageHidden);
         try {
             getPageManager().updatePage(page);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.update.page",
                     "Could not update a page: " + path, e);
@@ -645,6 +672,7 @@
 
         try {
             getPageManager().removePage(page);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.delete.page",
                     "Could not delete a page: " + path, e);
@@ -682,6 +710,7 @@
         childPage.setHidden(pageHidden);
         try {
             getPageManager().updatePage(childPage);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.add.page",
                     "Could not add a page: " + path, e);
@@ -698,6 +727,7 @@
                 folder.setDocumentOrder(orderList);
                 try {
                     getPageManager().updateFolder(folder);
+                    getPageManager().reset();
                 } catch (FolderNotUpdatedException e) {
                     throw new CommonException("could.not.change.page.order",
                             "Could not change a page order: " + path, e);
@@ -788,6 +818,7 @@
         folder.setHidden(pageHidden);
         try {
             getPageManager().updateFolder(folder);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.update.folder",
                     "Could not update a folder: " + path, e);
@@ -815,6 +846,7 @@
 
         try {
             getPageManager().removeFolder(folder);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.delete.folder",
                     "Could not update a folder: " + path, e);
@@ -851,6 +883,7 @@
         child.setHidden(folderHidden);
         try {
             getPageManager().updateFolder(child);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.add.folder",
                     "Could not add a folder: " + path, e);
@@ -868,6 +901,7 @@
                 folder.setDocumentOrder(orderList);
                 try {
                     getPageManager().updateFolder(folder);
+                    getPageManager().reset();
                 } catch (FolderNotUpdatedException e) {
                     throw new CommonException("could.not.change.folder.order",
                             "Could not change a folder order: " + path, e);
@@ -895,6 +929,7 @@
         childPage.setHidden(folderHidden);
         try {
             getPageManager().updatePage(childPage);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.add.default.page",
                     "Could not add a default page: " + path, e);
@@ -911,6 +946,7 @@
                 child.setDocumentOrder(orderList);
                 try {
                     getPageManager().updateFolder(child);
+                    getPageManager().reset();
                 } catch (FolderNotUpdatedException e) {
                     throw new CommonException(
                             "could.not.change.default.page.order",
@@ -965,6 +1001,7 @@
         fragment.setSkin(desktopTheme);
         try {
             getPageManager().updatePage(page);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.update.layout",
                     "Could not update a layout: " + path, e);
@@ -998,6 +1035,7 @@
 
         try {
             getPageManager().updatePage(page);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.delete.layout",
                     "Could not delete a layout: " + path, e);
@@ -1042,6 +1080,7 @@
         fragment.setSkin(desktopTheme);
         try {
             getPageManager().updatePage(page);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.update.portlet",
                     "Could not update a page: " + path, e);
@@ -1069,6 +1108,7 @@
 
         try {
             getPageManager().updatePage(page);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.delete.portlet",
                     "Could not delete a portlet: " + path, e);
@@ -1099,6 +1139,7 @@
 
         try {
             getPageManager().updatePage(page);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.add.layout",
                     "Could not update a page: " + path, e);
@@ -1128,6 +1169,7 @@
 
         try {
             getPageManager().updatePage(page);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.add.portlet",
                     "Could not update a page: " + path, e);
@@ -1294,6 +1336,7 @@
 
         try {
             getPageManager().updatePage(page);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.update.page",
                     "Could not update a page: " + page.getPath(), e);
@@ -1313,6 +1356,7 @@
 
         try {
             getPageManager().updateFolder(folder);
+            getPageManager().reset();
         } catch (FolderNotUpdatedException e) {
             throw new CommonException("could.not.update.folder",
                     "Could not update a folder: " + folder.getPath(), e);
@@ -1360,6 +1404,7 @@
 
         try {
             getPageManager().updatePage(page);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.update.page",
                     "Could not update a page: " + page.getPath(), e);
@@ -1381,6 +1426,7 @@
 
         try {
             getPageManager().updateFolder(folder);
+            getPageManager().reset();
         } catch (FolderNotUpdatedException e) {
             throw new CommonException("could.not.update.folder",
                     "Could not update a folder: " + folder.getPath(), e);
@@ -1428,6 +1474,7 @@
 
         try {
             getPageManager().updatePage(page);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.update.page",
                     "Could not update a page: " + page.getPath(), e);
@@ -1449,6 +1496,7 @@
 
         try {
             getPageManager().updateFolder(folder);
+            getPageManager().reset();
         } catch (FolderNotUpdatedException e) {
             throw new CommonException("could.not.update.folder",
                     "Could not update a folder: " + folder.getPath(), e);
@@ -1495,6 +1543,7 @@
 
         try {
             getPageManager().updatePage(page);
+            getPageManager().reset();
         } catch (PageNotUpdatedException e) {
             throw new CommonException("could.not.update.page",
                     "Could not update a page: " + page.getPath(), e);
@@ -1515,6 +1564,7 @@
 
         try {
             getPageManager().updateFolder(folder);
+            getPageManager().reset();
         } catch (FolderNotUpdatedException e) {
             throw new CommonException("could.not.update.folder",
                     "Could not update a folder: " + folder.getPath(), e);
@@ -1523,4 +1573,31 @@
                     "Could not update a folder: " + folder.getPath(), e);
         }
     }
+
+    public boolean checkFolderOrPageAccess(String path) throws CommonException {
+        String folderOrPagePath = getFolderOrPagePath(path);
+        if (folderOrPagePath.endsWith(".psml")) {
+            // page
+            Page page = getPage(folderOrPagePath);
+            return PALAdminUtil.checkAccess(page, JetspeedActions.VIEW);
+        } else {
+            //folder
+            Folder folder = getFolder(folderOrPagePath);
+            return PALAdminUtil.checkAccess(folder, JetspeedActions.VIEW);
+        }
+    }
+
+    public int getNodeInfoType(String path) {
+        String fragmentId = getFragmentId(path);
+        if (fragmentId == null || fragmentId.equals("")) {
+            String folderOrPage = getFolderOrPagePath(path);
+            if (folderOrPage.endsWith(".psml")) {
+                return NodeInfo.PAGE;
+            } else {
+                return NodeInfo.FOLDER;
+            }
+        }
+        // TODO layout or portlet
+        return NodeInfo.LAYOUT;
+    }
 }

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/service/SiteEditorService.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/service/SiteEditorService.java	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/service/SiteEditorService.java	2007-07-23 07:09:55 UTC (rev 354)
@@ -67,6 +67,11 @@
     }
 
     public void loadPage(PageInfoEditorPage page) throws CommonException {
+        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+            throw new CommonException("could.not.access.path",
+                    "Could not access a path: " + page.getPath());
+        }
+
         loadTree(page);
 
         page.setPageDecoratorItems(getSiteEditorLogic()
@@ -81,6 +86,11 @@
     }
 
     public void loadPage(PageSecurityEditorPage page) throws CommonException {
+        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+            throw new CommonException("could.not.access.path",
+                    "Could not access a path: " + page.getPath());
+        }
+
         loadTree(page);
         loadSecurityConstraints(page);
 
@@ -90,6 +100,11 @@
     }
 
     public void loadPage(FolderInfoEditorPage page) throws CommonException {
+        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+            throw new CommonException("could.not.access.path",
+                    "Could not access a path: " + page.getPath());
+        }
+
         loadTree(page);
 
         page.setPageDecoratorItems(getSiteEditorLogic()
@@ -105,6 +120,11 @@
 
     public void loadPage(FolderAddFolderAndPageEditorPage page)
             throws CommonException {
+        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+            throw new CommonException("could.not.access.path",
+                    "Could not access a path: " + page.getPath());
+        }
+
         loadTree(page);
 
         page.setLayoutNameItems(getSiteEditorLogic().createLayoutNamesList());
@@ -118,6 +138,11 @@
     }
 
     public void loadPage(FolderSecurityEditorPage page) throws CommonException {
+        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+            throw new CommonException("could.not.access.path",
+                    "Could not access a path: " + page.getPath());
+        }
+
         loadTree(page);
         loadSecurityConstraints(page);
 
@@ -127,6 +152,11 @@
     }
 
     public void loadPage(LayoutInfoEditorPage page) throws CommonException {
+        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+            throw new CommonException("could.not.access.path",
+                    "Could not access a path: " + page.getPath());
+        }
+
         loadTree(page);
 
         page.setLayoutNameItems(getSiteEditorLogic().createLayoutNamesList());
@@ -141,6 +171,11 @@
 
     public void loadPage(LayoutAddPortletEditorPage page)
             throws CommonException {
+        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+            throw new CommonException("could.not.access.path",
+                    "Could not access a path: " + page.getPath());
+        }
+
         loadTree(page);
 
         page.setLayoutNameItems(getSiteEditorLogic().createLayoutNamesList());
@@ -149,6 +184,11 @@
     }
 
     public void loadPage(PortletInfoEditorPage page) throws CommonException {
+        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+            throw new CommonException("could.not.access.path",
+                    "Could not access a path: " + page.getPath());
+        }
+
         loadTree(page);
 
         page.setPortletNameItems(getSiteEditorLogic().createPortletNamesList());
@@ -405,11 +445,13 @@
         buf.append(request.getScheme()).append("://").append(
                 request.getServerName()).append(":").append(
                 request.getServerPort()).append(request.getContextPath());
-        
+
         if (!buf.toString().endsWith("/")) {
             buf.append("/");
         }
-        
+        // TODO portal or configuration
+        buf.append("portal/");
+
         if (returnPath != null && returnPath.startsWith("/")) {
             buf.append(returnPath.substring(1));
         } else {
@@ -418,4 +460,8 @@
 
         return buf.toString();
     }
+
+    public int getNodeInfoType(String path) {
+        return getSiteEditorLogic().getNodeInfoType(path);
+    }
 }

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/util/PALAdminUtil.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/util/PALAdminUtil.java	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/util/PALAdminUtil.java	2007-07-23 07:09:55 UTC (rev 354)
@@ -30,6 +30,8 @@
 import javax.portlet.PortletConfig;
 import javax.security.auth.Subject;
 
+import org.apache.jetspeed.om.common.SecuredResource;
+
 import jp.sf.pal.admin.PALAdminConstants;
 
 public class PALAdminUtil {
@@ -186,4 +188,13 @@
         return csvList;
     }
 
+    public static boolean checkAccess(SecuredResource securedResource,
+            String actions) {
+        try {
+            securedResource.checkAccess(actions);
+            return true;
+        } catch (SecurityException e) {
+            return false;
+        }
+    }
 }

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/AbstractSiteEditorPage.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/AbstractSiteEditorPage.java	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/AbstractSiteEditorPage.java	2007-07-23 07:09:55 UTC (rev 354)
@@ -16,6 +16,7 @@
 package jp.sf.pal.admin.web.site;
 
 import java.util.List;
+import java.util.Map;
 
 import javax.faces.context.FacesContext;
 
@@ -235,4 +236,21 @@
     public String getCurrentPath() {
         return path;
     }
+
+    public void parseRequestParameters() {
+        Map<?, ?> requestParameterMap = FacesContext.getCurrentInstance()
+                .getExternalContext().getRequestParameterMap();
+
+        // path
+        String path = (String) requestParameterMap.get("path");
+        if (path != null) {
+            setPath(path);
+        }
+
+        // returnPath
+        String returnPath = (String) requestParameterMap.get("returnPath");
+        if (returnPath != null) {
+            setReturnPath(returnPath);
+        }
+    }
 }
\ No newline at end of file

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderAddFolderAndPageEditorPage.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderAddFolderAndPageEditorPage.java	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderAddFolderAndPageEditorPage.java	2007-07-23 07:09:55 UTC (rev 354)
@@ -19,6 +19,7 @@
 import java.util.List;
 import java.util.Map;
 
+import jp.sf.pal.admin.entity.NodeInfo;
 import jp.sf.pal.common.CommonException;
 import jp.sf.pal.common.util.FacesMessageUtil;
 
@@ -181,6 +182,9 @@
     }
 
     public Class<?> prerender() {
+        // parse request parameters
+        parseRequestParameters();
+
         if (getPath() == null) {
             setPath("/");
         }
@@ -189,6 +193,14 @@
             setReturnPath("/");
         }
 
+        // check node
+        int type = getSiteEditorService().getNodeInfoType(getPath());
+        if (type == NodeInfo.PAGE) {
+            return PageInfoEditorPage.class;
+        } else if (type == NodeInfo.LAYOUT) {
+            return LayoutInfoEditorPage.class;
+        }
+
         try {
             getSiteEditorService().loadPage(this);
         } catch (CommonException e) {

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderInfoEditorPage.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderInfoEditorPage.java	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderInfoEditorPage.java	2007-07-23 07:09:55 UTC (rev 354)
@@ -19,6 +19,7 @@
 import java.util.List;
 import java.util.Map;
 
+import jp.sf.pal.admin.entity.NodeInfo;
 import jp.sf.pal.common.CommonException;
 import jp.sf.pal.common.util.FacesMessageUtil;
 
@@ -143,6 +144,9 @@
     }
 
     public Class<?> prerender() {
+        // parse request parameters
+        parseRequestParameters();
+
         if (getPath() == null) {
             setPath("/");
         }
@@ -151,6 +155,14 @@
             setReturnPath("/");
         }
 
+        // check node
+        int type = getSiteEditorService().getNodeInfoType(getPath());
+        if (type == NodeInfo.PAGE) {
+            return PageInfoEditorPage.class;
+        } else if (type == NodeInfo.LAYOUT) {
+            return LayoutInfoEditorPage.class;
+        }
+
         try {
             getSiteEditorService().loadPage(this);
         } catch (CommonException e) {

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderSecurityEditorPage.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderSecurityEditorPage.java	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/FolderSecurityEditorPage.java	2007-07-23 07:09:55 UTC (rev 354)
@@ -3,6 +3,7 @@
 import java.io.Serializable;
 
 import jp.sf.pal.admin.PALAdminConstants;
+import jp.sf.pal.admin.entity.NodeInfo;
 import jp.sf.pal.common.CommonException;
 import jp.sf.pal.common.util.FacesMessageUtil;
 
@@ -29,6 +30,9 @@
     }
 
     public Class<?> prerender() {
+        // parse request parameters
+        parseRequestParameters();
+
         if (getPath() == null) {
             setPath("/");
             return FolderInfoEditorPage.class;
@@ -38,6 +42,14 @@
             setReturnPath("/");
         }
 
+        // check node
+        int type = getSiteEditorService().getNodeInfoType(getPath());
+        if (type == NodeInfo.PAGE) {
+            return PageInfoEditorPage.class;
+        } else if (type == NodeInfo.LAYOUT) {
+            return LayoutInfoEditorPage.class;
+        }
+
         if (getApplyOrder() != null && getSecurityConstraintType() != null
                 && "delete".equals(getAction())) {
             // delete

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutAddPortletEditorPage.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutAddPortletEditorPage.java	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutAddPortletEditorPage.java	2007-07-23 07:09:55 UTC (rev 354)
@@ -19,6 +19,7 @@
 import java.util.List;
 import java.util.Map;
 
+import jp.sf.pal.admin.entity.NodeInfo;
 import jp.sf.pal.common.CommonException;
 import jp.sf.pal.common.util.FacesMessageUtil;
 
@@ -85,6 +86,9 @@
     }
 
     public Class<?> prerender() {
+        // parse request parameters
+        parseRequestParameters();
+
         if (getPath() == null) {
             setPath("/");
             return FolderInfoEditorPage.class;
@@ -94,6 +98,14 @@
             setReturnPath("/");
         }
 
+        // check node
+        int type = getSiteEditorService().getNodeInfoType(getPath());
+        if (type == NodeInfo.FOLDER) {
+            return FolderInfoEditorPage.class;
+        } else if (type == NodeInfo.PAGE) {
+            return PageInfoEditorPage.class;
+        }
+
         try {
             getSiteEditorService().loadPage(this);
         } catch (CommonException e) {

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutInfoEditorPage.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutInfoEditorPage.java	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/LayoutInfoEditorPage.java	2007-07-23 07:09:55 UTC (rev 354)
@@ -19,6 +19,7 @@
 import java.util.List;
 import java.util.Map;
 
+import jp.sf.pal.admin.entity.NodeInfo;
 import jp.sf.pal.common.CommonException;
 import jp.sf.pal.common.util.FacesMessageUtil;
 
@@ -115,6 +116,9 @@
     }
 
     public Class<?> prerender() {
+        // parse request parameters
+        parseRequestParameters();
+
         if (getPath() == null) {
             setPath("/");
             return FolderInfoEditorPage.class;
@@ -124,6 +128,14 @@
             setReturnPath("/");
         }
 
+        // check node
+        int type = getSiteEditorService().getNodeInfoType(getPath());
+        if (type == NodeInfo.FOLDER) {
+            return FolderInfoEditorPage.class;
+        } else if (type == NodeInfo.PAGE) {
+            return PageInfoEditorPage.class;
+        }
+
         try {
             getSiteEditorService().loadPage(this);
         } catch (CommonException e) {

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PageInfoEditorPage.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PageInfoEditorPage.java	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PageInfoEditorPage.java	2007-07-23 07:09:55 UTC (rev 354)
@@ -19,6 +19,7 @@
 import java.util.List;
 import java.util.Map;
 
+import jp.sf.pal.admin.entity.NodeInfo;
 import jp.sf.pal.common.CommonException;
 import jp.sf.pal.common.util.FacesMessageUtil;
 
@@ -191,6 +192,9 @@
     }
 
     public Class<?> prerender() {
+        // parse request parameters
+        parseRequestParameters();
+
         if (getPath() == null) {
             setPath("/default-page.psml");
         }
@@ -199,6 +203,14 @@
             setReturnPath("/");
         }
 
+        // check node
+        int type = getSiteEditorService().getNodeInfoType(getPath());
+        if (type == NodeInfo.FOLDER) {
+            return FolderInfoEditorPage.class;
+        } else if (type == NodeInfo.LAYOUT) {
+            return LayoutInfoEditorPage.class;
+        }
+
         try {
             getSiteEditorService().loadPage(this);
         } catch (CommonException e) {

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PageSecurityEditorPage.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PageSecurityEditorPage.java	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PageSecurityEditorPage.java	2007-07-23 07:09:55 UTC (rev 354)
@@ -18,6 +18,7 @@
 import java.io.Serializable;
 
 import jp.sf.pal.admin.PALAdminConstants;
+import jp.sf.pal.admin.entity.NodeInfo;
 import jp.sf.pal.common.CommonException;
 import jp.sf.pal.common.util.FacesMessageUtil;
 
@@ -44,6 +45,9 @@
     }
 
     public Class<?> prerender() {
+        // parse request parameters
+        parseRequestParameters();
+
         if (getPath() == null) {
             setPath("/default-page.psml");
             return PageInfoEditorPage.class;
@@ -53,6 +57,14 @@
             setReturnPath("/");
         }
 
+        // check node
+        int type = getSiteEditorService().getNodeInfoType(getPath());
+        if (type == NodeInfo.FOLDER) {
+            return FolderInfoEditorPage.class;
+        } else if (type == NodeInfo.LAYOUT) {
+            return LayoutInfoEditorPage.class;
+        }
+
         if (getApplyOrder() != null && getSecurityConstraintType() != null
                 && "delete".equals(getAction())) {
             // delete

Modified: pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PortletInfoEditorPage.java
===================================================================
--- pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PortletInfoEditorPage.java	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/PortletInfoEditorPage.java	2007-07-23 07:09:55 UTC (rev 354)
@@ -19,6 +19,7 @@
 import java.util.List;
 import java.util.Map;
 
+import jp.sf.pal.admin.entity.NodeInfo;
 import jp.sf.pal.common.CommonException;
 import jp.sf.pal.common.util.FacesMessageUtil;
 
@@ -115,6 +116,9 @@
     }
 
     public Class<?> prerender() {
+        // parse request parameters
+        parseRequestParameters();
+
         if (getPath() == null) {
             setPath("/");
             return FolderInfoEditorPage.class;
@@ -124,6 +128,18 @@
             setReturnPath("/");
         }
 
+        // check node
+        int type = getSiteEditorService().getNodeInfoType(getPath());
+        if (type == NodeInfo.FOLDER) {
+            return FolderInfoEditorPage.class;
+        } else if (type == NodeInfo.PAGE) {
+            return PageInfoEditorPage.class;
+        }
+        // TODO
+        /*else if (type == NodeInfo.LAYOUT) {
+                    return LayoutInfoEditorPage.class;
+                }*/
+
         try {
             getSiteEditorService().loadPage(this);
         } catch (CommonException e) {

Modified: pal-admin/trunk/src/main/resources/appMessages.properties
===================================================================
--- pal-admin/trunk/src/main/resources/appMessages.properties	2007-07-23 07:07:29 UTC (rev 353)
+++ pal-admin/trunk/src/main/resources/appMessages.properties	2007-07-23 07:09:55 UTC (rev 354)
@@ -166,3 +166,4 @@
 could.not.remove.folder.security=Could not remove a folder security. Please try again. If you see this error message again, please contact a site administrator.
 
 invalid.path=Invalid path. Please try again. If you see this error message again, please contact a site administrator.
+could.not.access.path=Could not access the path.


pal-cvs メーリングリストの案内
Back to archive index