com.arsdigita.toolbox.ui
Class SecurityContainer
java.lang.Object
com.arsdigita.bebop.Completable
com.arsdigita.bebop.SimpleComponent
com.arsdigita.bebop.TextStylable
com.arsdigita.bebop.BlockStylable
com.arsdigita.bebop.SimpleContainer
com.arsdigita.toolbox.ui.SecurityContainer
- All Implemented Interfaces:
- Cloneable, Component, Container, Lockable
- public abstract class SecurityContainer
- extends SimpleContainer
A SecurityContainer
adds an access check to a
Component
. The child component is made
invisible if the current user cannot access the it.
Warning: - A call to setVisible(state, true)
does
not necessarily mean that isVisible(state)
will return
true, since the isVisible
also takes security checks
into account.
General usage of the SecurityContainer
is as follows:
MyComponent c = new MyComponent();
SecurityContainer sc = new SecurityContainer(c) {
protected boolean canAccess(User user, PageState state) {
return ( user != null );
}
};
add(sc);
- Version:
- $Revision: #9 $ $DateTime: 2004/04/07 16:07:11 $
- Author:
- Michael Pih
Fields inherited from class com.arsdigita.bebop.BlockStylable |
ABSBOTTOM, ABSMIDDLE, BASELINE, BOTTOM, CENTER, FULL_WIDTH, INSERT, LEFT, MIDDLE, RIGHT, TEXTTOP, TOP |
Methods inherited from class com.arsdigita.bebop.SimpleContainer |
add, add, children, contains, generateChildrenXML, generateParent, get, getNamespace, getTag, indexOf, isEmpty, setNamespace, setTag, size |
Methods inherited from class com.arsdigita.bebop.SimpleComponent |
clone, exportAttributes, getAttribute, getClassAttr, getIdAttr, getKey, getMetaDataAttribute, getStyleAttr, hasAttributes, isLocked, lock, register, register, respond, setAttribute, setClassAttr, setIdAttr, setKey, setMetaDataAttribute, setStyleAttr, setVisible |
Methods inherited from interface com.arsdigita.bebop.Component |
getClassAttr, getIdAttr, getKey, getStyleAttr, register, register, respond, setClassAttr, setIdAttr, setKey, setStyleAttr, setVisible |
versionId
public static final String versionId
- See Also:
- Constant Field Values
SecurityContainer
public SecurityContainer()
- This default constructor should be followed by calls to
add
.
SecurityContainer
public SecurityContainer(Component c)
- Create a
SecurityContainer
around a child component.
- Parameters:
c
- The child component
isVisible
public boolean isVisible(PageState state)
- Is the component visible?
- Specified by:
isVisible
in interface Component
- Overrides:
isVisible
in class SimpleComponent
- Parameters:
state
- The page state
- Returns:
- true if the component is visible, false otherwise
canAccess
protected abstract boolean canAccess(Party party,
PageState state)
- Returns true if the current user can access the child component.
- Parameters:
party
- The partystate
- The page state
- Returns:
- true if the access checks pass, false otherwise
generateXML
public void generateXML(PageState state,
Element parent)
- Generates the XML for the child component if this
component is visible.
- Specified by:
generateXML
in interface Component
- Overrides:
generateXML
in class SimpleContainer
- Parameters:
state
- The page stateparent
- The parent DOM element- See Also:
SimpleContainer.setTag(String)
,
SimpleContainer.setNamespace(String)
Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC