public class LinkSecurityCheck extends ComponentSecurityCheck
Link
s. This check has 2 modes for the Render
action. In the regular mode the check behaves as a ClassSecurityCheck
meaning the user
must have render rights for the target class of the link, If not the link will not be rendered.
In the alternative mode the check behaves as a ComponentSecurityCheck
(render action
only) allowing the link to be visible but disabled. Note that for all other actions this check
behaves as a ClassSecurityCheck (with option to check the model). Although the check was designed
to work on pages it now also works on any class. So Panel
and the like may be used as
clickTargetConstructor and Description |
---|
LinkSecurityCheck(org.apache.wicket.markup.html.link.AbstractLink component,
Class<?> clickTarget,
boolean checkSecureModelIfExists)
Constructs a new check, the check uses the regular mode.
|
LinkSecurityCheck(org.apache.wicket.Component component,
Class<?> clickTarget)
Constructs a new check, the check uses the regular mode.
|
Modifier and Type | Method and Description |
---|---|
Class<?> |
getClickTarget()
Returns the target page of the link.
|
boolean |
isActionAuthorized(WaspAction action)
Checks if the user is authorized for this component.
|
boolean |
isUseAlternativeRenderCheck()
Flags which mode is active.
|
LinkSecurityCheck |
setUseAlternativeRenderCheck(boolean useAlternativeRenderCheck)
Sets which mode to use.
|
checkSecureModel, getComponent, isAuthenticated
getActionFactory, getLoginPage, getStrategy, isActionAuthorized
public LinkSecurityCheck(org.apache.wicket.Component component, Class<?> clickTarget)
component
- the link, although any component may be used this should typically be a subclass
of AbstractLink
clickTarget
- the Class
redirected to when clicking on the link. This could be a
Page
or a Panel
or something completely different.IllegalArgumentException
- if clickTarget is nullpublic LinkSecurityCheck(org.apache.wicket.markup.html.link.AbstractLink component, Class<?> clickTarget, boolean checkSecureModelIfExists)
component
- the linkclickTarget
- the Class
redirected to when clicking on the link. This could be a
Page
or a Panel
or something completely different.checkSecureModelIfExists
- forces the model to be checked after this check is firedIllegalArgumentException
- if clickTarget is nullpublic final Class<?> getClickTarget()
public boolean isActionAuthorized(WaspAction action)
ComponentSecurityCheck
isActionAuthorized
in interface ISecurityCheck
isActionAuthorized
in class ComponentSecurityCheck
action
- the action(s) like render or enable.ComponentSecurityCheck.isActionAuthorized(org.wicketstuff.security.actions.WaspAction)
public final boolean isUseAlternativeRenderCheck()
public final LinkSecurityCheck setUseAlternativeRenderCheck(boolean useAlternativeRenderCheck)
ClassSecurityCheck
,
using the same check for render and enabled. In alternative mode this check behaves as a
ComponentSecurityCheck
for render actions and as a ClassSecurityCheck
for
enabled actions.useAlternativeRenderCheck
- true, if you want to use the alternative mode.Copyright © 2015. All rights reserved.