Yii 1.1: auth-init-command


This extension provides a yiic shell command that can be used to initialize RBAC DB tables, especially during development. Configuration is provided by an authinit file, that allows Tasks, Operations, and Roles to be defined as array values. I found the SRBAC configuration screens to not sufficiently take advantage of Yii's ability to fully nest RBAC items, and also wanted a way to define configs independent of database tables during development, so that auth config information isn't lost (or needing to be archived) between database resets.


  • This command is lightly tested - I use it in my daily development, but there may be issues that arise so YMMV, I'll post updates as I make them.
  • Currently this command removes all RBAC information prior to running, including user assignments. Because of this, it's currently only appropriate for development work, or for small sites that can statically define all user assignments in the AuthInitCommand config file.
  • This command is only compatible with CDbAuthManager

Future Features

  • provide option to preserve authassignments, for updating RBAC configuration on production systems




  • Yii 1.0 or above
  • CDbAuthManager for RBAC


  1. Extract the release file
  2. Place AuthInitCommand.php in your application's command directory
  3. place authinit.php in your application's config directory, and configure according to the examples provided in authinit.php comments
  4. To run, use your applications yiic.php script with the "authinit" command argument. Example: /pathto/yiic.php auth
  5. To specify an alternate config file location, use: /pathto/yiic.php auth /absoluate/pathto/alternateconfig.php


Default config file (config/authinit.php):

/pathto/application/bin/yiic.php auth

Custom config file location:

/pathto/application/bin/yiic.php auth /absolute/path/to/custom_authinit.php

Change Log

March 17, 2010

  • Initial release.

March 18, 2010

  • v0.2a
  • fixed a massive bug when creating tasks

Total 3 comments

#584 report it
juniorplenty at 2010/04/17 03:40pm
Uploaded Zip version

Uploaded a zip version which uncompresses correctly...

#654 report it
juniorplenty at 2010/03/27 06:01pm
re: Download Failed

Hmm - I just noticed the same thing. I've verified that the archive untars for me locally, but after uploading then downloading the file, it shows up as corrupted. I'll have to play around with it when I have more time, but it seems like it's an issue with yiiframework.com storing and delivering the archive...

#670 report it
Asgaroth at 2010/03/23 10:22pm
Download Failed

I dont know if it is me but when I download the file it allways tell me it is corrupt.

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: Other Open Source License
  • Developed by: juniorplenty
  • Category: Auth
  • Votes: +3
  • Downloaded: 858 times
  • Created on: Mar 17, 2010
  • Last updated: Mar 18, 2010