Yii Framework Forum: Check Multi Access In Yii With Execute Just Single Query Db - Yii Framework Forum

Jump to content

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

Check Multi Access In Yii With Execute Just Single Query Db Rate Topic: -----

#1 User is offline   Nabi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 22-February 12
  • Location:Ahwaz

Posted 19 February 2014 - 04:04 AM

Hi,

I'm using Yii framework, and CDbAuthManager class for authorization users. For check one access can use this code:

Yii::app()->user->checkAccess('post');


This code execute a db query, It's here in background:

SELECT * FROM `auth_item` WHERE name='post'


Now If I check other access, then execute another db query:

Yii::app()->user->checkAccess('comment');
SELECT * FROM `auth_item` WHERE name='comment'


Now if I need to check many of access, so execute many db query. Now, how can I check multi access, So that just execute single query db. For example I wish have a code be like this:

Yii::app()->user->checkAccess(array('post', 'comment'));


And maybe execute be like this query for that:

SELECT * FROM `auth_item` WHERE name IN ('post', 'comment');


Any idea?!

وقتی پیغام میذارید، بی زحمت متنتون رو انتخاب کنید و این دو تا کار ناقابل رو هم انجام بدید:
1. از اون بالا RTL رو انتخاب کنید.
2. فونت رو هم Tahoma بگذارید.
که چشمون در نیاد.
دمت گرم!

www.IranPHP.ir
0

#2 User is offline   Nabi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 22-February 12
  • Location:Ahwaz

Posted 22 February 2014 - 03:26 PM

I find a solution and write a component for it here: http://www.yiiframew...auth-component/


وقتی پیغام میذارید، بی زحمت متنتون رو انتخاب کنید و این دو تا کار ناقابل رو هم انجام بدید:
1. از اون بالا RTL رو انتخاب کنید.
2. فونت رو هم Tahoma بگذارید.
که چشمون در نیاد.
دمت گرم!

www.IranPHP.ir
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