0

I try to make a RBAC with this guide I made it work without errors so far, but i got stuck now for a few hours, cause the rules in my model just wont work. I try to test the reader role with this code:

<?php if(Yii::app()->user->checkAccess('reader')): ?>
<h1> Grats u are a reader </h1>

<?php endif; ?>

So after i log in this litle message should appear but somehow it wont. And for example when i log in and try to go to my models index, so i can see the registered users it is telling me that i dont have the permission, even thought i did this:

         array('allow',  // allow all users to perform 'index' and 'view' actions
            'actions'=>array('view','index'),
            'roles'=>array('reader')

        ),

Any idea is welcome, and tell me if i have to show some more code. Ok back to thinking.

Stephan Muller
  • 27,018
  • 16
  • 85
  • 126
Barta Tamás
  • 889
  • 4
  • 15
  • 36
  • Check that the tables are created in the database and there exists at least one entry with the userid you're logged in, and the role 'reader' assigned. – sucotronic Jun 02 '12 at 15:50
  • yes it is assigned. Now the problem is, with the reader role i can do anything i want, but with the same actions on the admin role, i cant do anything. – Barta Tamás Jun 02 '12 at 17:26

1 Answers1

0

Fixed it. Just had to give straight accessRules. Like the reader can go to index , and view page, but cant do to update , and admin, and the inverse of this for the admin role.

Barta Tamás
  • 889
  • 4
  • 15
  • 36