Yii Framework Forum: Role Based Authentication - Yii Framework Forum

Jump to content

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

Role Based Authentication Rate Topic: -----

#1 User is offline   GvWP 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 16-April 09
  • Location:Netherlands

Posted 25 January 2010 - 06:27 PM

I use role based authentication in my website. After updating to the newest version of Yii I do get following problem. I did not have this in the older version.

PHP Error
Omschrijving
call_user_func_array() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: First argument is expected to be a valid callback, '1' was given
Bronbestand
C:\Program Files\EasyPHP\www\YiiRoot\framework\base\CComponent.php(592)
00580: * @since 1.1.0
00581: */
00582: public function evaluateExpression($_expression_,$_data_=array())
00583: {
00584: if(is_string($_expression_))
00585: {
00586: extract($_data_);
00587: return @eval('return '.$_expression_.';');
00588: }
00589: else
00590: {
00591: $_data_[]=$this;
00592: return call_user_func_array($_expression_, $_data_);
00593: }
00594: }
00595: }
00596:
00597:
00598: /**
00599: * CEvent is the base class for all event classes.
00600: *
00601: * It encapsulates the parameters associated with an event.
00602: * The {@link sender} property describes who raises the event.
00603: * And the {@link handled} property indicates if the event is handled.
00604: * If an event handler sets {@link handled} to true, those handlers

Stack Trace
#0 C:\Program Files\EasyPHP\www\YiiRoot\framework\base\CComponent.php(592): call_user_func_array()
#1 C:\Program Files\EasyPHP\www\YiiRoot\framework\web\auth\CAccessControlFilter.php(301): CAccessRule->evaluateExpression()
#2 C:\Program Files\EasyPHP\www\YiiRoot\framework\web\auth\CAccessControlFilter.php(204): CAccessRule->isExpressionMatched()
#3 C:\Program Files\EasyPHP\www\YiiRoot\framework\web\auth\CAccessControlFilter.php(100): CAccessRule->isUserAllowed()
#4 C:\Program Files\EasyPHP\www\YiiRoot\framework\web\filters\CFilter.php(39): CAccessControlFilter->preFilter()
#5 C:\Program Files\EasyPHP\www\YiiRoot\framework\web\CController.php(983): CAccessControlFilter->filter()
#6 C:\Program Files\EasyPHP\www\YiiRoot\framework\web\filters\CInlineFilter.php(59): FunctiesController->filterAccessControl()
#7 C:\Program Files\EasyPHP\www\YiiRoot\framework\web\filters\CFilterChain.php(126): CInlineFilter->filter()
#8 C:\Program Files\EasyPHP\www\YiiRoot\framework\web\CController.php(283): CFilterChain->run()
#9 C:\Program Files\EasyPHP\www\YiiRoot\framework\web\CController.php(257): FunctiesController->runActionWithFilters()
#10 C:\Program Files\EasyPHP\www\YiiRoot\framework\web\CWebApplication.php(320): FunctiesController->run()
#11 C:\Program Files\EasyPHP\www\YiiRoot\framework\web\CWebApplication.php(120): CWebApplication->runController()
#12 C:\Program Files\EasyPHP\www\YiiRoot\framework\base\CApplication.php(135): CWebApplication->processRequest()
#13 C:\Program Files\EasyPHP\www\WebRoot\vrijwilligers\index.php(11): CWebApplication->run()
0

#2 User is offline   gallego123 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 535
  • Joined: 11-August 09
  • Location:Argentina

Posted 15 February 2010 - 10:32 AM

me too

my code in controller
	public function accessRules()
	{
		return array(

                        array('allow',  // allow all users to perform 'list' and 'show' actions
				'actions'=>array('admin','update','lovPersonas'),
                                'expression'=>Seguridad::tieneRol('PER_CONSULTA') 
                                ,

			),
			array('allow', // allow authenticated user to perform 'create' and 'update' actions
				'actions'=>array('grabado_ok','delete','create','AutoCompleteLookup'),
				'expression'=>Seguridad::tieneRol('PER_INGRESO'),
			),

			array('deny',  // deny all users
				'users'=>array('*'),
			),
		);
	}


KISS - Keep It Simple Stupid
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
0

#3 User is offline   gallego123 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 535
  • Joined: 11-August 09
  • Location:Argentina

Posted 15 February 2010 - 10:45 AM

in v1.0.x work fine. why not in 1.1 ?????

put this and work
change
'expression'=>Seguridad::tieneRol('PER_CONSULTA')
by
'expression'=>"Seguridad::tieneRol('PER_CONSULTA')==1"
...
   'expression'=>"Seguridad::tieneRol('PER_CONSULTA')==1"
....


why??
thanks
KISS - Keep It Simple Stupid
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
0

#4 User is offline   gallego123 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 535
  • Joined: 11-August 09
  • Location:Argentina

Posted 15 February 2010 - 02:59 PM

@master (qiang ;) ):
is posible change class CComponent? adding "or is_numeric($_expression_)"

       public function evaluateExpression($_expression_,$_data_=array())
        {
                if(is_string($_expression_) or is_numeric($_expression_))
                {
                        extract($_data_);
                        return @eval('return '.$_expression_.';');
                }
                else
                {
                        $_data_[]=$this;
                        return call_user_func_array($_expression_, $_data_);
                }
        }

KISS - Keep It Simple Stupid
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
0

#5 User is offline   gallego123 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 535
  • Joined: 11-August 09
  • Location:Argentina

Posted 16 February 2010 - 06:46 AM

i change
'expression'=>Seguridad::tieneRol('PER_CONSULTA')
by
'expression'=>"Seguridad::tieneRol('PER_CONSULTA')"

and work


I only have to change each controller, no problem :(
KISS - Keep It Simple Stupid
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
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