com.arsdigita.cms.ui
Class SecurityPropertyEditor

java.lang.Object
  extended bycom.arsdigita.bebop.Completable
      extended bycom.arsdigita.bebop.SimpleComponent
          extended bycom.arsdigita.bebop.TextStylable
              extended bycom.arsdigita.bebop.BlockStylable
                  extended bycom.arsdigita.bebop.SimpleContainer
                      extended bycom.arsdigita.bebop.PropertyEditor
                          extended bycom.arsdigita.cms.ui.SecurityPropertyEditor
All Implemented Interfaces:
Cloneable, com.arsdigita.bebop.Component, com.arsdigita.bebop.Container, com.arsdigita.util.Lockable
Direct Known Subclasses:
ItemTemplates, PageEditDynamic, SimpleEditStep, TextAssetBody

public class SecurityPropertyEditor
extends com.arsdigita.bebop.PropertyEditor

Extends PropertyEditor to provide access control features. Each link may be associated with a ComponentAccess object; if the current does not have sufficient privileges, the link will be hidden.

The simple use pattern for this component is as follows:


 SecurityPropertyEditor editor = new SecurityPropertyEditor();
 editor.setDisplayComponent(new FooComponent());
 NameEditForm n = new NameEditForm();
 ComponentAccess ca1 = new ComponentAccess(n);
 ca1.addAccessCheck(WORKFLOW_ADMIN);
 ca1.addAccessCheck(CATEGORY_ADMIN);
 editor.add("name", "Edit Name", ca, n.getCancelButton());
 AddressEditForm a = new AddressEditForm();
 ComponentAccess ca2 = new ComponentAccess(a);
 editor.add("address", "Edit Address", ca2, a.getCancelButton());
 

Version:
$Revision: #9 $ $DateTime: 2004/04/07 16:07:11 $
Author:
Michael Pih (pihman@arsdigita.com), Stanislav Freidin (sfreidin@arsdigita.com)

Nested Class Summary
protected static class SecurityPropertyEditor.AccessListModel
          Performs access checks for each property; skips the properties that the user is not allowed to access
protected static class SecurityPropertyEditor.AccessListModelBuilder
          Returns an SecurityPropertyEditor.AccessListModel during each request
 
Nested classes inherited from class com.arsdigita.bebop.PropertyEditor
com.arsdigita.bebop.PropertyEditor.DefaultModel, com.arsdigita.bebop.PropertyEditor.DefaultModelBuilder, com.arsdigita.bebop.PropertyEditor.IdentityCellRenderer
 
Field Summary
static String versionId
           
 
Fields inherited from class com.arsdigita.bebop.BlockStylable
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CENTER, FULL_WIDTH, INSERT, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP
 
Fields inherited from class com.arsdigita.bebop.SimpleComponent
m_attr
 
Fields inherited from interface com.arsdigita.bebop.Component
BEBOP_XML_NS, CLASS, ID, ON_CLICK, STYLE
 
Constructor Summary
SecurityPropertyEditor()
          Construct a new, empty PropertyEditor.
SecurityPropertyEditor(com.arsdigita.bebop.Component display)
          Construct a new, PropertyEditor with the given display component
 
Method Summary
 void add(String key, String label, com.arsdigita.toolbox.ui.ComponentAccess ca)
          Add a form to the set of forms which could be used to edit the properties.
 void add(String key, String label, com.arsdigita.toolbox.ui.ComponentAccess ca, com.arsdigita.bebop.form.Submit cancelButton)
          Add a form to the set of forms which could be used to edit the properties
 void addComponent(String key, com.arsdigita.toolbox.ui.ComponentAccess ca)
          Add a component to the property editor.
 void addComponent(String key, String label, com.arsdigita.toolbox.ui.ComponentAccess ca)
          Add a component to the list of links.
 void addListeners(com.arsdigita.bebop.FormSection form, com.arsdigita.bebop.form.Submit cancelButton)
          Add all required listeners to the form to ensure that if the form is submitted successfully or cancelled, the display pane will be shown.
 void addSecurityListener(com.arsdigita.bebop.FormSection form)
          Add a submission listener to the form that will hide all components and show the display pane.
protected  Map getAccessMap()
          Return the map of keys to access checks
 void setComponentAccess(String key, com.arsdigita.toolbox.ui.ComponentAccess access)
          Specify a new ComponentAccess for a component which has already been added to the SecurityPropertyEditor.
 
Methods inherited from class com.arsdigita.bebop.PropertyEditor
add, add, add, add, addCancelListener, addComponent, addComponent, addProcessListener, addVisibilityListener, getComponent, getDisplayComponent, getDisplayPane, getLabelsMap, getList, getModel, getModelBuilder, getSelectedComponentKey, lock, register, setDisplayComponent, setModelBuilder, showComponent, showDisplayPane
 
Methods inherited from class com.arsdigita.bebop.SimpleContainer
add, add, children, contains, generateChildrenXML, generateParent, generateXML, get, getNamespace, getTag, indexOf, isEmpty, setNamespace, setTag, size
 
Methods inherited from class com.arsdigita.bebop.BlockStylable
setBorder, setBorder, setBorderColor, setHorizontalAlignment, setMargin, setMargin, setPadding, setPadding, setVerticalAlignment
 
Methods inherited from class com.arsdigita.bebop.TextStylable
setBackgroundColor, setColor
 
Methods inherited from class com.arsdigita.bebop.SimpleComponent
clone, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, isVisible, register, respond, setAttribute, setClassAttr, setIdAttr, setKey, setMetaDataAttribute, setStyleAttr, setVisible
 
Methods inherited from class com.arsdigita.bebop.Completable
addCompletionListener, fireCompletionEvent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.arsdigita.bebop.Component
getClassAttr, getIdAttr, getKey, getStyleAttr, isVisible, register, respond, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible
 
Methods inherited from interface com.arsdigita.util.Lockable
isLocked
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

SecurityPropertyEditor

public SecurityPropertyEditor()
Construct a new, empty PropertyEditor. The PropertyEditor.setDisplayComponent(Component) method must be called before this component is locked.


SecurityPropertyEditor

public SecurityPropertyEditor(com.arsdigita.bebop.Component display)
Construct a new, PropertyEditor with the given display component

Parameters:
display - The display component
Method Detail

addComponent

public void addComponent(String key,
                         com.arsdigita.toolbox.ui.ComponentAccess ca)
Add a component to the property editor. The component will be completely invisible; it is up to the user to call PropertyEditor.showComponent(PageState, String) to display the component, and to call PropertyEditor.showDisplayPane(PageState) when the component needs to be hidden.

Parameters:
key - The symbolic key for the component; must be unique for this PropertyEditor
ca - The ComponentAccess object which contains the child component, along with security restrictions

addComponent

public void addComponent(String key,
                         String label,
                         com.arsdigita.toolbox.ui.ComponentAccess ca)
Add a component to the list of links. It is up to the component to correctly call showDisplayPane when it's done.

Parameters:
key - The symbolic key for the component; must be unique for this PropertyEditor
label - The label for the link
ca - The component access

setComponentAccess

public void setComponentAccess(String key,
                               com.arsdigita.toolbox.ui.ComponentAccess access)
Specify a new ComponentAccess for a component which has already been added to the SecurityPropertyEditor.

Parameters:
key - the key under which the component was added
access - the ComponentAccess instance that will determine when the link for the specified component should be visible

add

public void add(String key,
                String label,
                com.arsdigita.toolbox.ui.ComponentAccess ca)
Add a form to the set of forms which could be used to edit the properties.

Parameters:
key - The symbolic key for the form; must be unique for this PropertyEditor
label - The label for the link
ca - The form ComponentAccess

add

public void add(String key,
                String label,
                com.arsdigita.toolbox.ui.ComponentAccess ca,
                com.arsdigita.bebop.form.Submit cancelButton)
Add a form to the set of forms which could be used to edit the properties

Parameters:
key - The symbolic key for the form; must be unique for this PropertyEditor
label - The label for the link
ca - The form ComponentAccess
cancelButton - The Cancel button on the form.

addSecurityListener

public void addSecurityListener(com.arsdigita.bebop.FormSection form)
Add a submission listener to the form that will hide all components and show the display pane. This method should be used to add submission listeners to forms which are buried deep inside some component, and are not members of this PropertyEditor.

Parameters:
form - The form

addListeners

public void addListeners(com.arsdigita.bebop.FormSection form,
                         com.arsdigita.bebop.form.Submit cancelButton)
Add all required listeners to the form to ensure that if the form is submitted successfully or cancelled, the display pane will be shown. This method should be used to add listeners to forms which are buried deep inside some component, and are not members of this PropertyEditor.

Parameters:
form - The form
cancelButton - the "Cancel" button on the form

getAccessMap

protected final Map getAccessMap()
Return the map of keys to access checks



Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2352 UTC