ورود

View Full Version : استفاده از $this توی rbac



desatir7316
شنبه 26 مهر 1393, 21:24 عصر
دوستان جرا توی این کد از $this استفاده نشده


$createPost = $auth->createPermission('createPost');
$createPost->description = 'Create a post';
$auth->add($createPost);



لینک (http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#building-authorization-data)


ولی یه کم پایینتر توی همون صفحه که اومده کد رو کامل تر کنه از $this استفاده کرده
فرقی داره؟




$updateOwnPost = $this->auth->createPermission('updateOwnPost');
$updateOwnPost->description = 'Update own post';
$updateOwnPost->ruleName = $rule->name;
$auth->add($updateOwnPost);



لینک (http://www.yiiframework.com/doc-2.0/guide-security-authorization.html#using-rules)

desatir7316
یک شنبه 27 مهر 1393, 07:58 صبح
قرار شد توي نسخه yii 2.0.1 اصلاح شه:
http://www.yiiframework.com/forum/index.php/topic/58365-when-use-this-in-rbac/page__p__263622__fromsearch__1#entry263622