<?php
include_once("Application.php");

class UserRestrictedApplication extends Application {
	protected function LoadPage($page, $action, $params) {
		$user=Session::GetLoggedInUser();
		if ($action=="")
			$action="index";
		if ($user->HasAccess($page.'/'.$action))
			parent::LoadPage($page, $action, $params);
		else {
			if (parent::FindControllerPath($page)){
				parent::LoadPage("member", "index", array("permission_error"=>true)/*Serialise URL, or something*/);
				http_response_code(403);
			} else
				parent::LoadPage($page, $action, $params);
		}
	}
	
	public function __construct($url) {
		parent::__construct($url);
	}
}
