Yii Framework Forum: Doc bugs - Yii Framework Forum

Jump to content

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

Doc bugs Rate Topic: -----

#1 User is offline   robak 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 25-November 08

Posted 25 November 2008 - 10:27 AM

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 :)
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,880
  • Joined: 04-October 08
  • Location:DC, USA

Posted 25 November 2008 - 10:46 AM

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.
0

#3 User is offline   robak 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 25-November 08

Posted 25 November 2008 - 01:07 PM

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'),
),


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

3) 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!
0

#4 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,880
  • Joined: 04-October 08
  • Location:DC, USA

Posted 25 November 2008 - 01:18 PM

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.
0

#5 User is offline   robak 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 25-November 08

Posted 25 November 2008 - 02:08 PM

2) 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?
0

#6 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,880
  • Joined: 04-October 08
  • Location:DC, USA

Posted 25 November 2008 - 02:20 PM

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

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

0

#7 User is offline   robak 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 25-November 08

Posted 25 November 2008 - 02:30 PM

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

#8 User is offline   robak 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 25-November 08

Posted 25 November 2008 - 03:13 PM

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.
0

#9 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,880
  • Joined: 04-October 08
  • Location:DC, USA

Posted 25 November 2008 - 03:23 PM

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.
0

#10 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 25 November 2008 - 09:58 PM

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.

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