示例#1
0
{
    public function __construct()
    {
        parent::__construct();
        RulesUrl::addRules('public', array('sections', 'page'));
    }
    public function getPageData($route)
    {
        return $this->model->getModel(ROUTE);
    }
}
$controller = new IndexController();
$controller->setModel('Index');
$model = $controller->model;
$index = isset($_GET['page']) ? $_GET['page'] : 'index';
$pagesData = $model->getPageData($index);
Bufer::set(array('pagesData' => $pagesData));
/**
 *  Страницы имеют права доступа, как и посетители.
 *  Необходимо сверить, чтобы уровень доступа посетителя совпадал
 *  Эту проверку сделает класс ACCESS и вызов Access::validate(); 
 *  в в контроллере страниц /app/controllers/index.php
 *  необходимо вложить в Session pid и acid страницы 
 */
$_SESSION['fw']['pageAccess'] = array('pid' => $pagesData['pid'], 'acid' => $pagesData['acid']);
if (!Access::validate()) {
    exit(MESSAGE_ACCESS_DENIED);
}
$controller->view(TPLS_DIR . '/header.tpl');
$controller->view(TPLS_DIR . '/index.tpl');
$controller->view(TPLS_DIR . '/footer.tpl');
     *
     * @see https://github.com/laracasts/PHP-Vars-To-Js-Transformer
     */
    JavaScript::put(['app_path' => URL::to('/') . '/', 'roles' => Role::get(['id', 'friendly_name']), 'services' => Service::get(['id', 'friendly_name'])]);
});
App::after(function ($request, $response) {
    //
});
/*
|--------------------------------------------------------------------------
| Access Filter
|--------------------------------------------------------------------------
|
*/
Route::filter('access', function () {
    if (!Access::validate(Request::segment(1))) {
        return App::abort(403, 'You do not have the required access for this page');
    }
});
/*
|--------------------------------------------------------------------------
| Permissions Filter
|--------------------------------------------------------------------------
|
*/
Route::filter('permissions', function ($route, $request, $value) {
    if (!Permissions::validate($value)) {
        return App::abort(403, 'Insufficient permissions');
    }
});
/*