auth-init-command AuthInitCommand

  1. Documentation
  2. Change Log

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
3 0
Yii Version: 1.1
License: (not set)
Category: Auth
Developed by: juniorplenty
Created on: Mar 17, 2010
Last updated: 8 years ago


show all