Yii Framework Forum: Chttpexception No Style - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Chttpexception No Style Rate Topic: -----

#1 User is offline   abedi98 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 89
  • Joined: 29-August 11

Posted 10 October 2012 - 07:08 AM

hi freinds
look at please :

this is MainController :

public function filters()
{
     return array(
         'accessControl' 
     );
}
	
public function accessRules()
{
	return array(
			
		array('deny',
			'users'=>array('demo','abedi98'),
		),
	);
}

when use it this code :
array('deny',
	'users'=>array('demo','abedi98'),
),


run this url : http://localhost/yii...hp?r=main/index

Quote

CHttpException

You are not authorized to perform this action. (D:\xampp\htdocs\yiiframework\framework\web\auth\CAccessControlFilter.php:157)

#0 D:\xampp\htdocs\yiiframework\framework\web\auth\CAccessControlFilter.php(120): CAccessControlFilter->accessDenied(Object(WebUser), 'You are not aut...')
#1 D:\xampp\htdocs\yiiframework\framework\web\filters\CFilter.php(39): CAccessControlFilter->preFilter(Object(CFilterChain))
#2 D:\xampp\htdocs\yiiframework\framework\web\CController.php(1146): CFilter->filter(Object(CFilterChain))
#3 D:\xampp\htdocs\yiiframework\framework\web\filters\CInlineFilter.php(59): CController->filterAccessControl(Object(CFilterChain))
#4 D:\xampp\htdocs\yiiframework\framework\web\filters\CFilterChain.php(131): CInlineFilter->filter(Object(CFilterChain))
#5 D:\xampp\htdocs\yiiframework\framework\web\CController.php(292): CFilterChain->run()
#6 D:\xampp\htdocs\yiiframework\framework\web\CController.php(266): CController->runActionWithFilters(Object(CInlineAction), Array)
#7 D:\xampp\htdocs\yiiframework\framework\web\CWebApplication.php(276): CController->run('error')
#8 D:\xampp\htdocs\yiiframework\framework\base\CErrorHandler.php(310): CWebApplication->runController('main/error')
#9 D:\xampp\htdocs\yiiframework\framework\base\CErrorHandler.php(183): CErrorHandler->render('error', Array)
#10 D:\xampp\htdocs\yiiframework\framework\base\CErrorHandler.php(108): CErrorHandler->handleException(Object(CHttpException))
#11 D:\xampp\htdocs\yiiframework\framework\base\CApplication.php(713): CErrorHandler->handle(Object(CExceptionEvent))
#12 [internal function]: CApplication->handleException(Object(CHttpException))
#13 {main}

Attached File(s)


0

#2 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 10 October 2012 - 07:41 AM

Have you set error action? Does error action works properly?
0

#3 User is offline   abedi98 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 89
  • Joined: 29-August 11

Posted 10 October 2012 - 09:40 AM

YES.
public function actionError()
	{
	    if($error=Yii::app()->errorHandler->error)
	    {
	    	if(Yii::app()->request->isAjaxRequest)
	    		echo $error['message'];
	    	else
	        	$this->render('back/error', $error);
	    }
	}

0

#4 User is offline   abedi98 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 89
  • Joined: 29-August 11

Posted 10 October 2012 - 09:45 AM

if set actions value in array

array('deny',
    'actions'=>array('index'),
    'users'=>array('demo','abedi98'),
),


Right and wrong does not, But I do not want use 'actions'
0

#5 User is offline   mickey85 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 05-October 11

Posted 09 March 2013 - 08:50 AM

add the error action to accessRules

public function accessRules()
        {
            return array(
                array(
                    'allow',
                    'actions' => array('login', 'logout', 'error'),
                    'users' => array('*'),
                ),
            );
        }

11Betting - a free sports betting game
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users