rbacmanager Command-line tool (extends CConsoleCommand) for managing rbac items and assignments.

  1. Installation
  2. Usage
  3. Resources

RbacManager is a command-line tool (extends CConsoleCommand) for managing rbac items and assignments.

It can be installed with composer: wapmorgan/rbacmanager.

Installation

Put this in your config/console.php

'commandMap' => array(
    'rbac' => array(
        'class' => 'ext.RbacManager.RbacCommand',
        'modelClass' => '\Users\models\User',
    ),
),

modelClass either can be class name under namespace like \Users\models\User or alias like application.modules.users.models.User.

Usage

Available actions:

  • Creating auth item ~~~ $ ../yiic rbac create role admin Created role admin $ ../yiic rbac create task editPost Created task editPost $ ../yiic rbac create operation operationOne Created operation operationOne ~~~

  • Deleting auth item ~~~ $ ../yiic rbac delete admin Removed admin ~~~

  • Granting a user ~~~ $ ../yiic rbac grantUser --username=wapmorgan admin editPost operationOne wapmorgan += admin wapmorgan += editPost wapmorgan += operationOne ~~~ or ~~~ $ ../yiic rbac grantUser --id=1 admin editPost operationOne wapmorgan += admin wapmorgan += editPost wapmorgan += operationOne ~~~

  • Taking grants back ~~~ $ ../yiic rbac clearUser --username=wapmorgan admin editPost Revoked admin Revoked editPost ~~~ or ~~~ $ ../yiic rbac clearUser --id=1 admin editPost Revoked admin Revoked editPost ~~~ Use '--all' option to delete all grants ~~~ $ ../yiic rbac clearUser --id=1 --all Revoked admin Revoked editPost Revoked operationOne ~~~

  • Taking a look at user's grants ~~~ $ ../yiic rbac describeUser --username=wapmorgan admin editPost operationOne ~~~

  • Showing all roles and users that have these roles ~~~ $ ../yiic rbac [admin] wapmorgan ~~~

Resources

1 0
1 follower
819 downloads
Yii Version: 1.1
License: (not set)
Category: Console
Developed by: wapmorgan
Created on: Dec 5, 2013
Last updated: 3 years ago

Downloads

show all

Related Extensions