Changes
Title
unchanged
Console Based CAuthManager Helper
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
rbac, auth, CDbAuthManager, console, command
Content
changed
[...]
./yiic foo rbac --c="assign sometask admin"
#test if the user admin has access to the operation
./yiic foo rbac --c="check someopr admin"
~~~
How to create a Batch file for better usability:
-----------------------------------------------
As i mention before the original yii-based command line usage is not appropiated for this kind of task:
~~~
./yiic foo rbac --c="list operation"
~~~
In order to help you when using the command line, i suggest you to write a batch file:
~~~
$yourshell cd /yourapp/protected
$yourshell touch rbac #create a empty file.
$yourshell chmod +x rbac #assign execution privilegies
$yourshell echo "./yiic foo rbac --c=\"$1 $2 $3 $4\"" >> rbac
~~~
As result, you can do it in this way:
~~~
$yourshell cd /yourapp/protected
$yourshell ./rbac list operation
$yourshell ./rbac query somerole
$yourshell ./rbac create operation someoper
...
~~~
How to Setup
------------
The following steps will enable you to have basic console including a behavior designed to command your currently installed rbac feature. [Read more about install a CAuthManager based authentication manager](http://www.yiiframework.com/doc/guide/1.1/en/topics.auth#configuring-authorization-manager).
### Step1: Configure a CConsoleCommand[...]