taylor      2005/01/30 21:24:21

  Modified:    portal/src/java/org/apache/jetspeed/velocity
                        JetspeedPowerTool.java
  Log:
  before adding the edit button on portlet decorators, check the access to edit 
and make sure the user has access
  
  Revision  Changes    Path
  1.40      +16 -3     
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerTool.java
  
  Index: JetspeedPowerTool.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerTool.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- JetspeedPowerTool.java    29 Jan 2005 21:42:08 -0000      1.39
  +++ JetspeedPowerTool.java    31 Jan 2005 05:24:20 -0000      1.40
  @@ -702,7 +702,7 @@
   
               if (mode.equals(PortletMode.VIEW.toString()))
               {
  -                if (content.supportsPortletMode(PortletMode.EDIT))
  +                if (content.supportsPortletMode(PortletMode.EDIT) && 
checkAccess(Page.EDIT_ACTION))
                   {
                       createAction(actions, JetspeedActions.INDEX_EDIT, 
portlet);
                   }
  @@ -723,7 +723,7 @@
               // help
               {
                   createAction(actions, JetspeedActions.INDEX_VIEW, portlet);
  -                if (content.supportsPortletMode(PortletMode.EDIT))
  +                if (content.supportsPortletMode(PortletMode.EDIT) && 
checkAccess(Page.EDIT_ACTION))
                   {
                       createAction(actions, JetspeedActions.INDEX_EDIT, 
portlet);
                   }
  @@ -737,6 +737,19 @@
           }
       }
   
  +    private boolean checkAccess(String action)
  +    {
  +        boolean access = true;
  +        try
  +        {
  +            getPage().checkAccess(action);
  +        }
  +        catch (SecurityException se)
  +        {
  +            access = false;
  +        }
  +        return access;
  +    }
       /**
        * Gets the list of decorator actions for a page. Each layout fragment 
on a
        * page has its own collection of actions associated with it. The 
creation
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to