During this time I always create your own furrow and code to perform user access levels to control user access rights on the system that I buat.Sebenarnya on existing Yii extension which provides features for setting user access levels so that we can make arrangements dynamically user access levels the applications we build. So far as I know the extension that has been popular for making user access levels are among yii Rights and SRBAC. And even though I have long solved this problem with the coding itself, finally last night raised my curiosity to taste usage extension in this case. I compare between Rights and Rights SRBAC finally I choose well, there is no scientific reason why I chose Rights than SRBAC, just based on the total "Like" his and her rights there examples of blogs that I can try immediately. Before going further, for those of you who have never tried to make the level of user access manually, I suggest do not use extension . It is better to first learn to make your own. at least help you to learn and understand in advance about the level of user access. First, please download it first extension rights here  And do not forget to download the documentation and examples of his blog .. At least this can be very helpful when you trouble.. Having already download it, please make your new application with Yii Framework. Rights before installing the extension on your application, make first so that your application can perform operations login, logout, register which is connected to the database. You've done that? if yes then we will be united extension rights. Unpack rights extension that you downloaded earlier and then move on your application exactly in the directory "protected / modules". Then do the settings in the file 'protected / config / main.php "be as follows :


'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

 
Top