View file vkclone-0.0.1/protected/components/BackEndController.php

File size: 906B
<?php
/**
 * This is a controller for BackEnd (admin-panel)
 */
class BackEndController extends Controller {
	/**
	 * Default site backend layout
	 */
	public $layout = 'admin.views.layouts.main';

	/**
	 * Modules links
	 */
	public $moduleLinks = array();
	/**
	 * Settings links
	 */
	public $settingsLinks = array();

	/**
	 * Filters logged users
	 */
	public function filters() {
		return CMap::mergeArray(parent::filters(), array(
			'accessControl',
		));
	}

	/**
	 * Access rules.
	 * Denies access for non-administrators.
	 */
	public function accessRules() {
		return array(
			array('allow',
				'roles' => array('administrator'),
			),
			array('allow',
				'users' => array('?'),
				'controllers' => array('admin/default'),
				'actions' => array('login'),
			),
			array('deny', 'deniedCallback' => function() {Yii::app()->controller->redirect(array('/admin/default/login'));}),
		);
	}
}