Permalink
Browse files

Slight changes to API for CWebUser.

  • Loading branch information...
KahWee Teng
KahWee Teng committed Mar 22, 2012
1 parent f351128 commit 98f5e427f984b3588d5a6acf5d83be5ba2596a15
Showing with 9 additions and 8 deletions.
  1. +2 −2 README.md
  2. +1 −0 protected/config/main.php
  3. +6 −6 protected/modules/backstage/BackstageModule.php
View
@@ -37,15 +37,15 @@ return array(
'backstage' => array(
'class' => 'application.modules.backstage.BackstageModule',
#'autoloadModels' => false,
- #'login_url' => '/site/login', // with support of CWebUser
+ #'login_required' => true, // with support of CWebUser
'name' => 'Backstage',
'copyright_name' => 'Backstage, Inc.'
'models' => array(
'Tag' => array(
'id' => array(
'control' => 'datetime',
'visible' => true,
- 'format'=>'M j, Y g:i A',
+ 'format' => 'M j, Y g:i A',
),
),
'User' => false,
@@ -30,6 +30,7 @@
'class' => 'application.modules.backstage.BackstageModule',
#'autoloadModels' => false,
'name' => 'Backstage 2',
+ 'login_required' => true, // with support of CWebUser
'copyright_name' => 'Backstage, Inc.',
'models' => array(
'Tag' => array(
@@ -5,7 +5,7 @@ class BackstageModule extends CWebModule {
public $models = array();
public $name = null;
public $copyright_name = null;
- public $login_url = false;
+ public $login_required = false;
/**
* @var models that are present in the ./protected/models directory
@@ -15,12 +15,12 @@ class BackstageModule extends CWebModule {
var $autoloadModels = true;
public function init() {
-
- # if login url isset
- if( $this->login_url && Yii::app()->user->isGuest ){
- Yii::app()->request->redirect($login_url);
+
+ # if login url isset
+ if($this->login_required && Yii::app()->user->isGuest) {
+ Yii::app()->user->loginRequired();
}
-
+
Yii::setPathOfAlias('backstage', $this->getBasePath());
$this->setImport(array(
'application.models.*',

0 comments on commit 98f5e42

Please sign in to comment.