Yii Framework Forum: Role based access clarification needed - Yii Framework Forum

Jump to content

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

Role based access clarification needed Rate Topic: -----

#1 User is offline   Arvind 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 03-October 09
  • Location:Calgary, AB, Canada

Posted 16 February 2010 - 03:47 AM

Hello,

Can somebody post an example with explanation for RBAC.

i got the following line from here (http://tinyurl.com/yej3yla)
$bizRule='return Yii::app()->user->id==$params["post"]->authID;';

Can somebody please explain the meaning of this line ?

thanks
Arvind
0

#2 User is offline   bettor 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 751
  • Joined: 02-February 09

Posted 16 February 2010 - 08:37 AM

View PostArvind, on 16 February 2010 - 03:47 AM, said:

Hello,

Can somebody post an example with explanation for RBAC.

i got the following line from here (http://tinyurl.com/yej3yla)
$bizRule='return Yii::app()->user->id==$params["post"]->authID;';

Can somebody please explain the meaning of this line ?

thanks
Arvind


$bizRule is your business rule which tells Yii if this business rule is true than allow access[or whatever] if it is false deny access. In this case if Yii::app()->user->id==$params["post"]->authID [Yii::app()->user->id equals to $params["post"]->authID] return true...therefore allow the user to do something that is associated with the above bizRule. Thats how much I can help given the length of code you have provided

hope this helps

bettor
0

#3 User is offline   DerekC 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 44
  • Joined: 09-December 09
  • Location:Europe

Posted 16 February 2010 - 11:49 AM

View PostArvind, on 16 February 2010 - 03:47 AM, said:

Hello,

Can somebody post an example with explanation for RBAC.

i got the following line from here (http://tinyurl.com/yej3yla)
$bizRule='return Yii::app()->user->id==$params["post"]->authID;';

Can somebody please explain the meaning of this line ?

thanks
Arvind


It confused me too, so I clarified the RBAC with a 'top-down' explanation here: http://www.yiiframew...pics.auth#c1113

Just to answer your question: this bizRule checks that the 'current user id' equals the author id of the post.
0

#4 User is offline   Arvind 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 03-October 09
  • Location:Calgary, AB, Canada

Posted 16 February 2010 - 02:34 PM

yeah, the top down approach was great.

what i was not clear is this statement
$params["post"]->authID

what is this exactly ? with respect to what .....
what exactly is $params["post"] ?

thanks
Arvind
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