Doc bugs


(system) #1

in guide/topics.auth:



            array('deny',


                'actions'=>array('delete'),


                'roles'=>array('*'),


            ),


There is no [tt]roles[/tt] in CAccessRule. Anyway roles filter (from authManager) in CAccesRule would be nice feature.

in api/CLogRouter:



                    'level'=>'trace, info',


                    'category'=>'system.*',


should be [tt]levels[/tt] and [tt]categories[/tt]

Great work :)


(Qiang Xue) #2

Thanks. They are fixed.

Roles is not supported CAccessRule anymore because CWebUser no longer exposes such a property. Instead, you should consider using RBAC feature.


(system) #3
  1. As I correctly understand when using RBAC i have to explicitly check access by calling e.g.

[tt]Yii::app()->user->checkAccess('createPost'))[/tt] in each action. I just wonder if this operation couldn't be performed by CWebUser when 'roles' are set:



array('allow',


  'actions'=>array('create'),


  'roles'=>array('createPost'),


),


  1. I was also wonder about CLinkPager. How to internalize labels first, last etc. ?

  2. And the last my idea about CLinkPager:



	protected function getPageRange()


	{


		$currentPage=$this->getCurrentPage();


		$pageCount=$this->getPageCount();


		$buttonCount=$this->maxButtonCount > $pageCount ? $pageCount : $this->maxButtonCount;





		$beginPage = max(array(0, (int) ($currentPage-(($this->maxButtonCount-2)/2))));


		if(($endPage = $beginPage + $this->maxButtonCount-1) >= $pageCount)


			$endPage = $pageCount-1;


		


		return array($beginPage,$endPage);


	}


Maybe i couldn’t get the point of original pager, but IMO it is better to navigate when active page is somewere in the middle of pager. Of course I know that i can create extension which will override [tt]getPageRange()[/tt] :)

Cheers!


(Qiang Xue) #4

Thank you for your suggestions!

1). Good suggestion. I will try to implement this. Should be easy.

2). CLinkPager has several properties that allow you to customize the display labels. Please check the API doc.

3). Thanks. Will adopt your suggestion.


(system) #5
  1. I know, that there are properties. But my only idea to internalize is:


class XLinkPager extends CLinkPager 


{


	public function run() {


		$this->prevPageLabel = Yii::t('pager','< Previous');


		...


		parent::run();


	}


}	


is this correct ? maybe is there another way to internalize without creating extension?


(Qiang Xue) #6

Why don't you customize the properties in the view?



$this->widget('CLinkPager',array(


    'prevPageLabel'=>Yii::t('pager','< Previous'),


));



(system) #7

Of course, it's easier way. Thank you very much.


(system) #8

Great work with roles.

I have one more idea about this.

in CWebUser we have two function which can be used in views to decide whether to display some links or not:

[tt]CWebUser->getIsGuest()[/tt] and

[tt]CWebUser->checkAccess($operation,$params=array())[/tt]

maybe we can use accessRules defined in controler to check actionAccess, by method like this:

[tt]CWebUser->checkActionAccess($action)[/tt]

or maybe better in CControler:

[tt]CControler->checkActionAccess($action)[/tt]

with such a method we could check real access in view to decide whether to display link for this action or not.

Or maybe it can be done with something which I haven't found.


(Qiang Xue) #9

I think checkActionAccess() is a subset of checkAccess() because you can essentially define roles (or auth items) to be actions.

For simpler scenarios where you don't want to use RBAC, you can easily define some controller methods, such as 'canUpdatePost()', and call this method in the views to turn on/off specific data.


(Ft07) #10

Hi,

I'm new to this kind of framework but I find Yii very impressing.

There's a minor problem viewing "The Definitive Guide to Yii" in IE6. The text starts beneath all of the menu. It doesn't help to adjust the browser window.

With IE7 everything looks fine.