org.apache.lenya.cms.ac.cocoon
Class PolicyHelper

java.lang.Object
  extended by org.apache.lenya.cms.ac.cocoon.PolicyHelper

public class PolicyHelper
extends java.lang.Object

Helper class for the policy GUI.


Field Summary
static java.lang.String ADD
           
static java.lang.String DELETE
           
 
Constructor Summary
PolicyHelper()
          Ctor.
 
Method Summary
 CredentialWrapper[] getCredentials(boolean urlOnly)
          Returns the credentials of the policy of the selected URL.
 CredentialWrapper[] getParentCredentials()
          Returns the credential wrappers for the parent URI of the URL belonging to the request of this object model.
protected  DefaultPolicy[] getPolicies(boolean onlyUrl)
          Returns the policies for a certain URL.
 CredentialWrapper[] getURICredentials()
          Returns the URI credential wrappers for the request of this object model.
 java.lang.String getUrl()
          Returns the URL.
 User[] getUsersWithRole(java.lang.String roleId)
          Returns the users with a certain role on the current URL.
 boolean isAncestorSSLProtected()
          Returns if one of the ancestors of this URL is SSL protected.
 boolean isUrlSSLProtected()
          Returns if this URL is SSL protected.
 void manipulateCredential(Item item, Role role, java.lang.String operation)
          Changes a credential by adding or deleting an item for a role.
 void setup(java.util.Map objectModel, org.apache.avalon.framework.component.ComponentManager manager, java.lang.String area)
          Initializes this helper.
 void setUrlSSLProtected(boolean ssl)
          Sets if this URL is SSL protected.
 void tearDown()
          Releases all obtained components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADD

public static final java.lang.String ADD
See Also:
Constant Field Values

DELETE

public static final java.lang.String DELETE
See Also:
Constant Field Values
Constructor Detail

PolicyHelper

public PolicyHelper()
Ctor.

Method Detail

setup

public void setup(java.util.Map objectModel,
                  org.apache.avalon.framework.component.ComponentManager manager,
                  java.lang.String area)
           throws org.apache.cocoon.ProcessingException
Initializes this helper.

Parameters:
objectModel - The Cocoon object model.
manager - The component manager.
area - The selected area.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

tearDown

public void tearDown()
Releases all obtained components.


getURICredentials

public CredentialWrapper[] getURICredentials()
                                      throws org.apache.cocoon.ProcessingException
Returns the URI credential wrappers for the request of this object model.

Returns:
An array of CredentialWrappers.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

getParentCredentials

public CredentialWrapper[] getParentCredentials()
                                         throws org.apache.cocoon.ProcessingException
Returns the credential wrappers for the parent URI of the URL belonging to the request of this object model.

Returns:
An array of CredentialWrappers.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

getCredentials

public CredentialWrapper[] getCredentials(boolean urlOnly)
                                   throws org.apache.cocoon.ProcessingException
Returns the credentials of the policy of the selected URL.

Parameters:
urlOnly - If true, the URL policy credentials are returned. If false, the credentials of all ancestor policies are returned.
Returns:
An array of CredentialWrappers.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

getPolicies

protected DefaultPolicy[] getPolicies(boolean onlyUrl)
                               throws org.apache.cocoon.ProcessingException
Returns the policies for a certain URL.

Parameters:
onlyUrl - If true, only the URL policies are returned. Otherwise, all ancestor policies are returned.
Returns:
An array of DefaultPolicy objects.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

manipulateCredential

public void manipulateCredential(Item item,
                                 Role role,
                                 java.lang.String operation)
                          throws org.apache.cocoon.ProcessingException
Changes a credential by adding or deleting an item for a role.

Parameters:
item - The item to add or delete.
role - The role.
operation - The operation, either ADD or DELETE.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

isAncestorSSLProtected

public boolean isAncestorSSLProtected()
                               throws org.apache.cocoon.ProcessingException
Returns if one of the ancestors of this URL is SSL protected.

Returns:
A boolean value.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

isUrlSSLProtected

public boolean isUrlSSLProtected()
                          throws org.apache.cocoon.ProcessingException
Returns if this URL is SSL protected.

Returns:
A boolean value.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

setUrlSSLProtected

public void setUrlSSLProtected(boolean ssl)
                        throws org.apache.cocoon.ProcessingException
Sets if this URL is SSL protected.

Parameters:
ssl - A boolean value.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

getUsersWithRole

public User[] getUsersWithRole(java.lang.String roleId)
                        throws org.apache.cocoon.ProcessingException
Returns the users with a certain role on the current URL.

Parameters:
roleId - The role ID.
Returns:
An array of users.
Throws:
org.apache.cocoon.ProcessingException - when something went wrong.

getUrl

public java.lang.String getUrl()
Returns the URL.

Returns:
A string.


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.