I have set an action that has a parameter(e.g actionIndex($p)) to alwaysallowed in srbac system. And it’s saved in allowed.php in srbac system. When I try to access the page, I’ve got this message :
Error:403 ‘You are not authorized for this action’
Error while trying to access /page/index.
When I try to remove the parameter inside the allowed.php file.It works, I can access those action. What happen actually? is that a bug? or something that I miss???
thanks in advance…
P.S: I’ve already delete actionRules inside my controller, and I still found those message.
jayant
(Codesutras)
May 5, 2011, 5:48am
2
can you share your code of controller file so and also a url formate which you use to pass an argument.
then me by i can show you the exact problem…its not an bug…its just a syntex mistake you are doing here…
so just share your code here.so i can show you the error…
jayant:
can you share your code of controller file so and also a url formate which you use to pass an argument.
then me by i can show you the exact problem…its not an bug…its just a syntex mistake you are doing here…
so just share your code here.so i can show you the error…
this the url : http://localhost/page/index/p/home
the url manager in main.php
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
'page/<p:\d+>'=>'page/list',
),
),
This the action
//controller's properties
public $layout='//layouts/column2';
public function actionIndex($p){
//the other code in this action only to take care about the models
$this->render('index',array('model'=>$model,
'modelComment'=>$modelComment,
'modelCommentListing'=>$modelCommentListing,
'breadCrumbs'=>$this->generateBreadcrumb($model->page_id),
'isListing'=>$isListing,
'countedComment'=>($countedComment > 0) ? $countedComment: '0'));
}
is that enough?
jayant
(Codesutras)
May 5, 2011, 6:18am
4
this the url : http://localhost/page/index/p/home
the url manager in main.php
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
'page/<p:\d+>'=>'page/list',
),
),
This the action
//controller's properties
public $layout='//layouts/column2';
public function actionIndex($p){
//the other code in this action only to take care about the models
$this->render('index',array('model'=>$model,
'modelComment'=>$modelComment,
'modelCommentListing'=>$modelCommentListing,
'breadCrumbs'=>$this->generateBreadcrumb($model->page_id),
'isListing'=>$isListing,
'countedComment'=>($countedComment > 0) ? $countedComment: '0'));
}
is that enough?
yeah that is fine but could you show me that how could you define you url link in a view file…so i would be more clear to me…
Well, actually those error appear right after I access http://localhost . From there, it will try to reach /site/index, then from actionIndex in site controller it will be redirected to homeUrl(/page/index/p/home).
In my main.php I’ve declared the homeUrl to /page/index/p/home.
The view file of actionIndex in PageController it self just shows based on the given parameters.
And this is how I construct the links to that page:
if($items[0]['items'] != "0"){
$items = array_merge(array('items'=>array('label'=>'Home', 'url'=>array('/page/index/p/home'))),
$items,
array(array('label'=>'Contact', 'url'=>array('/site/contact'))));
}
$this->widget('zii.widgets.CMenu',array(
'items'=>$items,
));
?>
jayant
(Codesutras)
May 5, 2011, 11:00am
6
Well, actually those error appear right after I access http://localhost . From there, it will try to reach /site/index, then from actionIndex in site controller it will be redirected to homeUrl(/page/index/p/home).
In my main.php I’ve declared the homeUrl to /page/index/p/home.
The view file of actionIndex in PageController it self just shows based on the given parameters.
And this is how I construct the links to that page:
if($items[0]['items'] != "0"){
$items = array_merge(array('items'=>array('label'=>'Home', 'url'=>array('/page/index/p/home'))),
$items,
array(array('label'=>'Contact', 'url'=>array('/site/contact'))));
}
$this->widget('zii.widgets.CMenu',array(
'items'=>$items,
));
?>
this is a part where you are doing some mistake.
1.remove the homw url from main config file.
2.defile array url of item properly.like ‘url’=>array(’/page/index’,‘paramid’=>param)
3.and also try to after commenting a url rules for a once.
try this things and let me know…!!
jayant:
this is a part where you are doing some mistake.
1.remove the homw url from main config file.
2.defile array url of item properly.like ‘url’=>array(’/page/index’,‘paramid’=>param)
3.and also try to after commenting a url rules for a once.
try this things and let me know…!!
Well, found it!!!!
this is what I’ve done
$keys=array_keys($this->actionParams);
foreach($keys as $key){
$query=$query.','.'$'.$key;
}
$query=substr_replace($query, '',0,1);
$access=$access.$query;
I’ve added those code to SBaseController.php inside beforeAction method to handle an action with parameter.
Spyros
(Spyros)
May 6, 2011, 6:34am
8
Which version of srbac do you use?
I could not reproduce this with the latest srbac 1.2v
The "$param" part is not saved in the actions name and in the allowed.php file
Spyros:
Which version of srbac do you use?
I could not reproduce this with the latest srbac 1.2v
The "$param" part is not saved in the actions name and in the allowed.php file
I’m using 1.1v actually…
I’ve checked the latest version(1.2v) and my problem fixed with these version…