Rights is a extension module in yii framework which can be used to have a interface for role based access control..
Using rights its very easy to manage various roles and permission in the application, and can be used as a standard for all projects..
Some Codes that people often need but are not documented..
1) To determine if the logged user is superuser
2) Get all superusers in the application
3) Get all roles assigned to the logged-in user
|1 2 3||
4) Get all users of a particular role (Lets say there is a DataEntry as a role whose job is to enter data in the system)
|1 2 3 4||
5) Assign a user a role in the system when he signs-up..
|1 2 3 4 5 6 7||
Case: When superuser is creating the user he has a drop-down List of all roles in the system and he can select a role for the new user..but if a person normally signs-up he doesn’t has that choice, he must be give User role..
Where $model->id is the id of new created user..
6) Generate drop-down of all available roles in the application for a superuser so that he can select a role while user creation..
|1 2 3 4 5 6 7 8 9 10 11 12 13 14||