'Import' => array (
'Application.models. *',
'Application.components. *',
'Application.modules.rights. *', / / Define the rights modules into our application
'Application.modules.rights.components. *', / / Define the rights modules into our application components
),
'Modules' => array (
'Rights' => array (
'SuperuserName' => 'Admin',
'UserIdColumn' => 'id', / / sets the name of a user id colom
'UserNameColumn' => 'username', set to be the name of the colom user username
'Install' => true, / / if you want to install, if already installed just removed this line
),
),
'Components' => array (
'User' => array (
'AllowAutoLogin' => true,
'Class' => 'RWebUser',
),
'AuthManager' => array (
'Class' => 'RDbAuthManager',
),
),
Previously you should know that the rights extension will access a model called "User" to check a user. If indeed you are giving your model name with another name eg "member", "tabel_anggota", and others you have to do the settings again on the above configuration. How its configuration? please read the documentation available from the rights extensions .. If you've done the above configuration, rights to install extension in your application please access the url "http://localhost/yourweb/index.php?r=rights" on your browser .. If successful, then you will be on the database there are 4 new table is generated extension of Rights. Remember after we installed the extension user rights that are allowed to access it is the user who did the installation was. Example: You I login with the username "admin", automatically the "admin" is the one who is allowed to access rights, if another user then can not .. But after that the "admin" can give the same rights to other users in accordance with what he wants .. Having already installed, please go back to above url .. then you will see something like this: Okay, on the menu there are 5 pieces of the menu .. Let us discuss one by one the menu:
1. Assignment: This is a menu that is used to memberikak permissions to a user. Access rights can be granted by giving rank (level) to a user or a user gives permission directly access a "task" (controller) or more detail a operastion (action in the controller). So I can give you "test" the rank admin, I could also allow "test" access controller "PegawaiController" or I also determine whether the "test" to access "actionCreate" in the controller employees .. Interesting is not it??
2. Permissions: Here is where we determine the level of access allowed anyone. Suppose we have a level of "test1" we allow him access actionCreate, actionDelete, and actionUpdate .. we simply set the value of "assign" (allow) or "REVOKE" (not allowed) in the mod level. And of course this can be done at all levels of the configuration. Note: admin is super user level, he is permitted to access any rights including menu extension.
3. Roles: a place where we can determine the levels that exist in our system. Suppose we want in our system there are levels of "test1", "content-writer", "secretary", etc. .. this is the place ..
4. Tasks: tasks we can determine what is in our system. Usually used to give full rights to a controller at all the action ..
5. Operations: used for setting user access levels on an action that is in the controller.
Okeh, I lay out already .. If it is still difficult to understand a good idea to try out or read the documentation rights .. because I also was not too deep to understand this extension .. :) Well, if you've managed to try to give permissions to a user either by "task", "operastion", or "role" it .. If it is, there is one more thing that needs to be configured .. ie the file "protected / components / Controller.php" adjust as classnya extend the original like this:
class Controller extends CController
Be like this:
class Controller extends RController
It was intended to permit the extension right in its filters applied on each controller that is in our application .. Then do not forget in our controller in each code set as follows:
public function filters ()
{
return array (
'Rights',
);
}
This was done to ensure the filter is run on the controller is derived from the filter extension Rights .. Done .. you can explore the use of rights extension with the look dokumentassi, forums, blogs rights sample extensions Yii website on the internet and ... Good luck .. Hope it helps ... :)

0 comments:
Post a Comment