portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r413134 - in /portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout: ajax-xml/add.vm impl/AddPortletAction.java impl/Constants.java impl/SecurityPermissionAction.java
Date Fri, 09 Jun 2006 19:34:03 GMT
Author: taylor
Date: Fri Jun  9 12:34:02 2006
New Revision: 413134

URL: http://svn.apache.org/viewvc?rev=413134&view=rev
Log:
portlet selector implementation from Steve Milek

Added:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/SecurityPermissionAction.java
Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/ajax-xml/add.vm
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/AddPortletAction.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/Constants.java

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/ajax-xml/add.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/ajax-xml/add.vm?rev=413134&r1=413133&r2=413134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/ajax-xml/add.vm
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/ajax-xml/add.vm
Fri Jun  9 12:34:02 2006
@@ -2,5 +2,6 @@
     <status>$status</status>
     <action>$action</action>
     <id>$id</id> 
+    <entity>$entity</entity>
     <new_position><col>$newcol</col><row>$newrow</row></new_position>
-</js>
\ No newline at end of file
+</js>

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/AddPortletAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/AddPortletAction.java?rev=413134&r1=413133&r2=413134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/AddPortletAction.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/AddPortletAction.java
Fri Jun  9 12:34:02 2006
@@ -130,7 +130,8 @@
             resultMap.put(NEWCOL, String.valueOf(coordinate
                     .getNewCol()));
             resultMap.put(NEWROW, String.valueOf(coordinate
-                    .getNewRow()));            
+                    .getNewRow()));
+            resultMap.put(PORTLETENTITY, fragment.getId());
         } 
         catch (Exception e)
         {

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/Constants.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/Constants.java?rev=413134&r1=413133&r2=413134&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/Constants.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/Constants.java
Fri Jun  9 12:34:02 2006
@@ -28,6 +28,7 @@
 	public static final String ACTION = "action";
     public static final String REASON = "reason";
 	public static final String PORTLETID = "id";
+    public static final String PORTLETENTITY = "entity";
     public static final String WINDOW_STATE = "state";
     public static final String PORTLET_MODE = "mode";
     public static final String OLD_WINDOW_STATE = "oldState";

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/SecurityPermissionAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/SecurityPermissionAction.java?rev=413134&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/SecurityPermissionAction.java
(added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/SecurityPermissionAction.java
Fri Jun  9 12:34:02 2006
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.layout.impl;
+
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.JetspeedActions;
+import org.apache.jetspeed.ajax.AJAXException;
+import org.apache.jetspeed.ajax.AjaxAction;
+import org.apache.jetspeed.ajax.AjaxBuilder;
+import org.apache.jetspeed.layout.Coordinate;
+import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
+import org.apache.jetspeed.layout.PortletPlacementContext;
+import org.apache.jetspeed.om.page.Fragment;
+import org.apache.jetspeed.om.page.Page;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.PermissionManager;
+
+/**
+ * Security Permission action
+ * 
+ * AJAX Parameters: 
+ *    action = permission
+ *    sub = add | remove | grant | revoke 
+ *    page = (implied in the URL)
+ *    resource = name of the resource to modify
+ *    actions = comma-separated actions
+ *    type = portlet | page | folder
+ * Parameters for grant | revoke:  
+ *    role = name of  role to grant or revoke
+ *    
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
+ * @version $Id: $
+ */
+public class SecurityPermissionAction 
+    extends BasePortletAction 
+    implements AjaxAction, AjaxBuilder, Constants
+{
+    protected Log log = LogFactory.getLog(SecurityPermissionAction.class);
+    protected PermissionManager pm = null;
+
+    public SecurityPermissionAction(String template, 
+                            String errorTemplate, 
+                            PermissionManager pm,
+                            PortletActionSecurityBehavior securityBehavior)
+    {
+        super(template, errorTemplate, securityBehavior); 
+        this.pm = pm;
+    }
+    
+    public boolean run(RequestContext requestContext, Map resultMap)
+            throws AJAXException
+    {
+        boolean success = true;
+        String status = "success";
+        try
+        {
+            resultMap.put(ACTION, "permissions");
+            // Get the necessary parameters off of the request
+            String sub = requestContext.getRequestParameter("sub");
+            if (sub == null) 
+            { 
+                throw new RuntimeException("Sub Action not provided"); 
+            }            
+            resultMap.put("sub", sub);
+            if (false == checkAccess(requestContext, JetspeedActions.EDIT))
+            {
+                if (!createNewPageOnEdit(requestContext))
+                {
+                    success = false;
+                    resultMap.put(REASON, "Insufficient access to edit page");          
     
+                    return success;
+                }
+                status = "refresh";
+            }           
+            resultMap.put(STATUS, status);
+        } 
+        catch (Exception e)
+        {
+            // Log the exception
+            log.error("exception while adding a portlet", e);
+            resultMap.put(REASON, e.toString());
+
+            // Return a failure indicator
+            success = false;
+        }
+
+        return success;
+    }
+    
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message