Yii Framework Forum: accessRules - Expression - Yii Framework Forum

Jump to content

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

accessRules - Expression

#1 User is offline   alper 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 12-November 10

Posted 16 March 2011 - 09:54 AM

Admin function kısmına expression dan geçenler girmesini istiyorum.
'expression' => 'Yii::app()->user->id == Yii::app()->session[\'cont\']',
Ama hiçbir zaman girmiyor. Yanlışım nerede ?
return array(
			array('allow',  // allow all users to perform 'index' and 'view' actions
				'actions'=>array('index','view', 'logout' , 'login'),
				'users'=>array('*'),
			),
			array('allow', 
				'actions'=>array('create','update','delete'),
				'users'=>array('@'),
				'expression' => '(Yii::app()->session[\'ddg\'] == (1) || )',
			),
			array('allow', 
				'actions'=>array('update'),
				'users'=>array('@'),
				'expression' => 'Yii::app()->user->id == $_GET["id"]',
			),
			array('allow',
				'actions'=>array('admin'),
				'users'=>array('@'),
                                'expression' => 'Yii::app()->user->id == Yii::app()->session[\'cont\']',
			),
			array('deny',  
				'users'=>array('*'),
			),
		);


Array
(
    [ddg] => 1
    [yetki] => 1|1|1|1|1
    [did] => 2
    [cont] => 3
    [e54a4a782064f8e4657f4ece3314e418__id] => 3
    [e54a4a782064f8e4657f4ece3314e418__name] => Deneme
    [e54a4a782064f8e4657f4ece3314e418__states] => Array
        (
        )

)

0

#2 User is offline   Umut Gundogdu 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 103
  • Joined: 27-November 08
  • Location:Ankara

Posted 17 March 2011 - 07:01 PM

Yanlis yok gibi. Bence sadece integer string karsilastirmasi oluyor ve expression hic bir zaman dogru olmuyor. dump yapip variable typlerina bi bak istersen
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