[pal-cvs 2624] [356] check if it's an editable resource.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 7月 23日 (月) 16:54:53 JST


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

Log Message:
-----------
check if it's an editable resource.

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/web/site/AbstractSiteEditorPage.java
    pal-admin/trunk/src/main/webapp/view/site/folderAddFolderAndPageEditor.html
    pal-admin/trunk/src/main/webapp/view/site/folderInfoEditor.html
    pal-admin/trunk/src/main/webapp/view/site/folderSecurityEditor.html
    pal-admin/trunk/src/main/webapp/view/site/layoutAddPortletEditor.html
    pal-admin/trunk/src/main/webapp/view/site/layoutInfoEditor.html
    pal-admin/trunk/src/main/webapp/view/site/pageInfoEditor.html
    pal-admin/trunk/src/main/webapp/view/site/pageSecurityEditor.html
    pal-admin/trunk/src/main/webapp/view/site/portletInfoEditor.html


-------------- 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:13:17 UTC (rev 355)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/logic/SiteEditorLogic.java	2007-07-23 07:54:52 UTC (rev 356)
@@ -1574,16 +1574,27 @@
         }
     }
 
-    public boolean checkFolderOrPageAccess(String path) throws CommonException {
+    public boolean checkFolderOrPageViewAccess(String path)
+            throws CommonException {
+        return checkFolderOrPageAccess(path, JetspeedActions.VIEW);
+    }
+
+    public boolean checkFolderOrPageEditAccess(String path)
+            throws CommonException {
+        return checkFolderOrPageAccess(path, JetspeedActions.EDIT);
+    }
+
+    public boolean checkFolderOrPageAccess(String path, String actions)
+            throws CommonException {
         String folderOrPagePath = getFolderOrPagePath(path);
         if (folderOrPagePath.endsWith(".psml")) {
             // page
             Page page = getPage(folderOrPagePath);
-            return PALAdminUtil.checkAccess(page, JetspeedActions.VIEW);
+            return PALAdminUtil.checkAccess(page, actions);
         } else {
             //folder
             Folder folder = getFolder(folderOrPagePath);
-            return PALAdminUtil.checkAccess(folder, JetspeedActions.VIEW);
+            return PALAdminUtil.checkAccess(folder, actions);
         }
     }
 

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:13:17 UTC (rev 355)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/service/SiteEditorService.java	2007-07-23 07:54:52 UTC (rev 356)
@@ -67,7 +67,7 @@
     }
 
     public void loadPage(PageInfoEditorPage page) throws CommonException {
-        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+        if (!getSiteEditorLogic().checkFolderOrPageViewAccess(page.getPath())) {
             throw new CommonException("could.not.access.path",
                     "Could not access a path: " + page.getPath());
         }
@@ -86,7 +86,7 @@
     }
 
     public void loadPage(PageSecurityEditorPage page) throws CommonException {
-        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+        if (!getSiteEditorLogic().checkFolderOrPageViewAccess(page.getPath())) {
             throw new CommonException("could.not.access.path",
                     "Could not access a path: " + page.getPath());
         }
@@ -100,7 +100,7 @@
     }
 
     public void loadPage(FolderInfoEditorPage page) throws CommonException {
-        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+        if (!getSiteEditorLogic().checkFolderOrPageViewAccess(page.getPath())) {
             throw new CommonException("could.not.access.path",
                     "Could not access a path: " + page.getPath());
         }
@@ -120,7 +120,7 @@
 
     public void loadPage(FolderAddFolderAndPageEditorPage page)
             throws CommonException {
-        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+        if (!getSiteEditorLogic().checkFolderOrPageViewAccess(page.getPath())) {
             throw new CommonException("could.not.access.path",
                     "Could not access a path: " + page.getPath());
         }
@@ -138,7 +138,7 @@
     }
 
     public void loadPage(FolderSecurityEditorPage page) throws CommonException {
-        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+        if (!getSiteEditorLogic().checkFolderOrPageViewAccess(page.getPath())) {
             throw new CommonException("could.not.access.path",
                     "Could not access a path: " + page.getPath());
         }
@@ -152,7 +152,7 @@
     }
 
     public void loadPage(LayoutInfoEditorPage page) throws CommonException {
-        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+        if (!getSiteEditorLogic().checkFolderOrPageViewAccess(page.getPath())) {
             throw new CommonException("could.not.access.path",
                     "Could not access a path: " + page.getPath());
         }
@@ -171,7 +171,7 @@
 
     public void loadPage(LayoutAddPortletEditorPage page)
             throws CommonException {
-        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+        if (!getSiteEditorLogic().checkFolderOrPageViewAccess(page.getPath())) {
             throw new CommonException("could.not.access.path",
                     "Could not access a path: " + page.getPath());
         }
@@ -184,7 +184,7 @@
     }
 
     public void loadPage(PortletInfoEditorPage page) throws CommonException {
-        if (!getSiteEditorLogic().checkFolderOrPageAccess(page.getPath())) {
+        if (!getSiteEditorLogic().checkFolderOrPageViewAccess(page.getPath())) {
             throw new CommonException("could.not.access.path",
                     "Could not access a path: " + page.getPath());
         }
@@ -464,4 +464,13 @@
     public int getNodeInfoType(String path) {
         return getSiteEditorLogic().getNodeInfoType(path);
     }
+
+    public Boolean isEditable(String path) {
+        try {
+            return new Boolean(getSiteEditorLogic()
+                    .checkFolderOrPageEditAccess(path));
+        } catch (CommonException e) {
+            return Boolean.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:13:17 UTC (rev 355)
+++ pal-admin/trunk/src/main/java/jp/sf/pal/admin/web/site/AbstractSiteEditorPage.java	2007-07-23 07:54:52 UTC (rev 356)
@@ -40,6 +40,8 @@
 
     private LabelHelper labelHelper;
 
+    private Boolean editable;
+
     /**
      * @return the labelHelper
      */
@@ -253,4 +255,11 @@
             setReturnPath(returnPath);
         }
     }
+
+    public boolean isEditable() {
+        if (editable == null) {
+            editable = getSiteEditorService().isEditable(getPath());
+        }
+        return editable.booleanValue();
+    }
 }
\ No newline at end of file

Modified: pal-admin/trunk/src/main/webapp/view/site/folderAddFolderAndPageEditor.html
===================================================================
--- pal-admin/trunk/src/main/webapp/view/site/folderAddFolderAndPageEditor.html	2007-07-23 07:13:17 UTC (rev 355)
+++ pal-admin/trunk/src/main/webapp/view/site/folderAddFolderAndPageEditor.html	2007-07-23 07:54:52 UTC (rev 356)
@@ -99,7 +99,7 @@
             <div style="width:120px;float: left;"><label id="folderOrPageHiddenLabel" for="folderOrPageHidden" style="width:100px;">Desktop Theme:</label></div>
             <input type="checkbox" id="folderOrPageHidden" />
           </div>
-          <div style="margin-top: 20px;text-align: center;">
+          <div id="isEditable-add" style="margin-top: 20px;text-align: center;">
             <input id="doAddFolder" type="button" value="Add Folder"/>
             <input id="doAddPage" type="button" value="Add Page"/>
           </div>

Modified: pal-admin/trunk/src/main/webapp/view/site/folderInfoEditor.html
===================================================================
--- pal-admin/trunk/src/main/webapp/view/site/folderInfoEditor.html	2007-07-23 07:13:17 UTC (rev 355)
+++ pal-admin/trunk/src/main/webapp/view/site/folderInfoEditor.html	2007-07-23 07:54:52 UTC (rev 356)
@@ -90,10 +90,10 @@
             <div style="width:120px;float: left;"><label id="folderHiddenLabel" for="folderHidden" style="width:100px;">Desktop Theme:</label></div>
             <input type="checkbox" id="folderHidden" />
           </div>
-          <div style="margin-top: 20px;text-align: center;">
+          <div id="isEditable-update" style="margin-top: 20px;text-align: center;">
             <input id="doUpdate" type="button" value="Update"/>
           </div>
-          <div style="margin-top: 5px;text-align: right;">
+          <div id="isEditable-delete" style="margin-top: 5px;text-align: right;">
             <input id="doDelete" type="button" value="Delete" onclick="if(confirm('Do you want to delete this folder?')){return true;}return false;"/>
           </div>
          </div>

Modified: pal-admin/trunk/src/main/webapp/view/site/folderSecurityEditor.html
===================================================================
--- pal-admin/trunk/src/main/webapp/view/site/folderSecurityEditor.html	2007-07-23 07:13:17 UTC (rev 355)
+++ pal-admin/trunk/src/main/webapp/view/site/folderSecurityEditor.html	2007-07-23 07:54:52 UTC (rev 356)
@@ -71,9 +71,11 @@
                 <td><span id="securityConstraintPermissionName">Permission</span></td>
                 <td><span id="securityConstraintTypeName">Type</span></td>
                 <td>
+                <div id="isEditable-delete">
                   <a id="goFolderSecurityEditor-delete" href="folderSecurityEditor.html?path=a&returnPath=b&applyOrder=c&securityConstraintType=d&fixed_action=delete">
                     <span id="deleteLabel">Delete</span>
                   </a>
+                </div>
                 </td>
               </tr>
             </tbody>
@@ -99,7 +101,7 @@
               <input type="checkbox" name="permissions" value="0" checked="checked"/>aaa
             </span>
           </div>
-          <div style="margin-top: 5px;text-align: center;">
+          <div id="isEditable-addConstraint" style="margin-top: 5px;text-align: center;">
             <input id="doAddConstraint" type="button" value="Add Constraint"/>
           </div>
           
@@ -111,7 +113,7 @@
               <option value="hoge">HOGE</option>
             </select>
           </div>
-          <div style="margin-top: 5px;text-align: center;">
+          <div id="isEditable-addConstraintRef" style="margin-top: 5px;text-align: center;">
             <input id="doAddConstraintRef" type="button" value="Add Constraint Ref"/>
           </div>
          </div>

Modified: pal-admin/trunk/src/main/webapp/view/site/layoutAddPortletEditor.html
===================================================================
--- pal-admin/trunk/src/main/webapp/view/site/layoutAddPortletEditor.html	2007-07-23 07:13:17 UTC (rev 355)
+++ pal-admin/trunk/src/main/webapp/view/site/layoutAddPortletEditor.html	2007-07-23 07:54:52 UTC (rev 356)
@@ -71,7 +71,7 @@
               <option value="hoge">HOGE</option>
             </select>
           </div>
-          <div style="margin-top: 5px;text-align: center;">
+          <div id="isEditable-addLayout" style="margin-top: 5px;text-align: center;">
             <input id="doAddLayout" type="button" value="Add Layout"/>
           </div>
         </div>
@@ -82,7 +82,7 @@
               <option value="hoge">HOGE</option>
             </select>
           </div>
-          <div style="margin-top: 5px;text-align: center;">
+          <div id="isEditable-addPortlet" style="margin-top: 5px;text-align: center;">
             <input id="doAddPortlet" type="button" value="Add Portlet"/>
           </div>
         </div>

Modified: pal-admin/trunk/src/main/webapp/view/site/layoutInfoEditor.html
===================================================================
--- pal-admin/trunk/src/main/webapp/view/site/layoutInfoEditor.html	2007-07-23 07:13:17 UTC (rev 355)
+++ pal-admin/trunk/src/main/webapp/view/site/layoutInfoEditor.html	2007-07-23 07:54:52 UTC (rev 356)
@@ -88,10 +88,10 @@
               <option value="hoge">HOGE</option>
             </select>
           </div>
-          <div style="margin-top: 20px;text-align: center;">
+          <div id="isEditable-update" style="margin-top: 20px;text-align: center;">
             <input id="doUpdate" type="button" value="Update"/>
           </div>
-          <div style="margin-top: 5px;text-align: right;">
+          <div id="isEditable-delete" style="margin-top: 5px;text-align: right;">
             <input id="doDelete" type="button" value="Delete" onclick="if(confirm('Do you want to delete this layout?')){return true;}return false;"/>
           </div>
          </div>

Modified: pal-admin/trunk/src/main/webapp/view/site/pageInfoEditor.html
===================================================================
--- pal-admin/trunk/src/main/webapp/view/site/pageInfoEditor.html	2007-07-23 07:13:17 UTC (rev 355)
+++ pal-admin/trunk/src/main/webapp/view/site/pageInfoEditor.html	2007-07-23 07:54:52 UTC (rev 356)
@@ -96,10 +96,10 @@
             <div style="width:120px;float: left;"><label id="pageHiddenLabel" for="pageHidden" style="width:100px;">Desktop Theme:</label></div>
             <input type="checkbox" id="pageHidden" />
           </div>
-          <div style="margin-top: 20px;text-align: center;">
+          <div id="isEditable-update" style="margin-top: 20px;text-align: center;">
             <input id="doUpdate" type="button" value="Update"/>
           </div>
-          <div style="margin-top: 5px;text-align: right;">
+          <div id="isEditable-delete" style="margin-top: 5px;text-align: right;">
             <input id="doDelete" type="button" value="Delete" onclick="if(confirm('Do you want to delete this page?')){return true;}return false;"/>
           </div>
          </div>

Modified: pal-admin/trunk/src/main/webapp/view/site/pageSecurityEditor.html
===================================================================
--- pal-admin/trunk/src/main/webapp/view/site/pageSecurityEditor.html	2007-07-23 07:13:17 UTC (rev 355)
+++ pal-admin/trunk/src/main/webapp/view/site/pageSecurityEditor.html	2007-07-23 07:54:52 UTC (rev 356)
@@ -80,9 +80,11 @@
                 <td><span id="securityConstraintPermissionName">Permission</span></td>
                 <td><span id="securityConstraintTypeName">Type</span></td>
                 <td>
+                <div id="isEditable-delete">
                   <a id="goPageSecurityEditor-delete" href="pageSecurityEditor.html?path=a&returnPath=b&applyOrder=c&securityConstraintType=d&fixed_action=delete">
                     <span id="deleteLabel">Delete</span>
                   </a>
+                </div>
                 </td>
               </tr>
             </tbody>
@@ -108,7 +110,7 @@
               <input type="checkbox" name="permissions" value="0" checked="checked"/>aaa
             </span>
           </div>
-          <div style="margin-top: 5px;text-align: center;">
+          <div id="isEditable-addConstraint" style="margin-top: 5px;text-align: center;">
             <input id="doAddConstraint" type="button" value="Add Constraint"/>
           </div>
           
@@ -120,7 +122,7 @@
               <option value="hoge">HOGE</option>
             </select>
           </div>
-          <div style="margin-top: 5px;text-align: center;">
+          <div id="isEditable-addConstraintRef" style="margin-top: 5px;text-align: center;">
             <input id="doAddConstraintRef" type="button" value="Add Constraint Ref"/>
           </div>
          </div>

Modified: pal-admin/trunk/src/main/webapp/view/site/portletInfoEditor.html
===================================================================
--- pal-admin/trunk/src/main/webapp/view/site/portletInfoEditor.html	2007-07-23 07:13:17 UTC (rev 355)
+++ pal-admin/trunk/src/main/webapp/view/site/portletInfoEditor.html	2007-07-23 07:54:52 UTC (rev 356)
@@ -88,10 +88,10 @@
               <option value="hoge">HOGE</option>
             </select>
           </div>
-          <div style="margin-top: 20px;text-align: center;">
+          <div id="isEditable-update" style="margin-top: 20px;text-align: center;">
             <input id="doUpdate" type="button" value="Update"/>
           </div>
-          <div style="margin-top: 5px;text-align: right;">
+          <div id="isEditable-delete" style="margin-top: 5px;text-align: right;">
             <input id="doDelete" type="button" value="Delete" onclick="if(confirm('Do you want to delete this portlet?')){return true;}return false;"/>
           </div>
          </div>


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