public class TemplateSecurityCheck extends Object
TemplateSecurityCheck secCheck = new TemplateSecurityCheck( data );
secCheck.setMessage( "Sorry, you do not have permission to " +
"access this area." );
secCheck.setFailTemplate("login.wm");
if ( !secCheck.hasRole("ADMIN") )
return;
Constructor and Description |
---|
TemplateSecurityCheck(RunData data)
Generic Constructor.
|
TemplateSecurityCheck(RunData data,
String message)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkLogin()
Check that the user has logged in.
|
String |
getFailScreen()
Get the value of failScreen.
|
String |
getFailTemplate()
Get the value of failTemplate.
|
String |
getMessage()
Get the message that should be displayed.
|
boolean |
hasPermission(org.apache.fulcrum.security.entity.Permission permission)
Does the User have this permission?
|
boolean |
hasRole(org.apache.fulcrum.security.entity.Role role)
Does the User have this role?
|
void |
setFailScreen(String v)
Set the value of failScreen.
|
void |
setFailTemplate(String v)
Set the value of failTemplate.
|
void |
setMessage(String v)
Set the message that should be displayed.
|
public TemplateSecurityCheck(RunData data, String message)
data
- A Turbine RunData object.message
- A String with the message to display upon
failure.public TemplateSecurityCheck(RunData data)
data
- A Turbine RunData object.public boolean hasRole(org.apache.fulcrum.security.entity.Role role) throws Exception
role
- The role to be checked.Exception
- Trouble validating.public boolean hasPermission(org.apache.fulcrum.security.entity.Permission permission) throws Exception
permission
- The permission to be checked.Exception
- Trouble validating.public boolean checkLogin() throws Exception
Exception,
- a generic exception.Exception
public void setMessage(String v)
v
- A String with the message that should be displayed.public String getMessage()
public String getFailScreen()
public void setFailScreen(String v)
v
- A String with the value of failScreen.public String getFailTemplate()
public void setFailTemplate(String v)
v
- A String with the value of failTemplate.Copyright © 2000-2015 The Apache Software Foundation. All Rights Reserved.