public abstract class AdminPage extends Protected implements IMessageProperty
{
public void pageValidate(PageEvent event)
{
IRequestCycle cycle = event.getRequestCycle();
Visit visit = (Visit) getEngine().getVisit();
if (visit == null || !visit.isUserLoggedIn())
{
Login login = (Login) cycle.getPage("Login");
login.setCallback(new PageCallback(this));
throw new PageRedirectException(login);
}
if (!visit.getUser(cycle).isAdmin())
{
VirtualLibraryEngine vengine = (VirtualLibraryEngine) getEngine();
vengine.presentError("That function is restricted to adminstrators.", cycle);
throw new PageRedirectException(cycle.getPage());
}
}