2017 © Pedro Peláez
 

yii2-extension yii2-rbac-console

This is common controller to Yii2 Rbac module

image

michnaadam33/yii2-rbac-console

This is common controller to Yii2 Rbac module

  • Tuesday, March 14, 2017
  • by michnaadam33
  • Repository
  • 2 Watchers
  • 0 Stars
  • 58 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

Rbac console

============, (*1)

This is common controller to Yii2 Rbac module

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)


php composer.phar require --prefer-dist michnaadam33/yii2-rbac-console "*"

or add, (*4)


"michnaadam33/yii2-rbac-console": "*"

to the require section of your composer.json file., (*5)

Read about RBAC

http://www.yiiframework.com/doc-2.0/guide-security-authorization.html, (*6)

Create init action

You can config a default role on yii2 config:, (*7)

'components' => [
        'rbac-console' => [
            'class' => 'michnaadam33\rbacConsole\Collection',
            'rule_hierarchy' => [
                'common\rbac\AuthorPostRule'
            ],
           'permission_hierarchy' => [
                'createPost',
                'deletePost',
                [
                    'name' =>'deleteOwnPost',
                    'rule' => 'RULE_AUTHOR_POST',
                    'children' => ['deletePost']
                ],
           ],
           'role_hierarchy' => [
                'ROLE_GUEST',
                'ROLE_CHILD',
                'ROLE_USER',
                [
                     'name' =>'ROLE_ADMIN',
                     'children' =>['ROLE_USER'],
                     'permissions' => [
                          'createTravel',
                               'createPost',
                               'deletePost',
                     ]
                ],
           ],
        ...
]

When you run yii rbac/init will be five roles:, (*8)

  • ROLE_GUEST
  • ROLE_CHILD
  • ROLE_USER
  • ROLE_ADMIN
  • ROLE_SUPER_ADMIN

Posible action:

Reset password., (*9)

yii rbac/reset-password <username> <password>

Assign user., (*10)

yii rbac/assign <rolename> <username>

Revoke user., (*11)

yii rbac/revoke <rolename> <username>

Show all permissions, (*12)

yii rbac/show-all-permissions

Show all roles, (*13)

yii rbac/show-all-roles

Show all roles of user., (*14)

yii rbac/show-role <username>

Show all permission from user or role., (*15)

yii rbac/show-permission <name> [--by=role]

Remove permission child from user or role., (*16)

yii rbac/remove-child-permission <parentName> <childName>[--by=role]

Remove role child from role., (*17)

yii rbac/remove-child-role <parentName> childName>

Add child role to role., (*18)

yii rbac/add-child-role <parentName> <childName>

Add child premission to user or role., (*19)

yii rbac/add-child-permission <parentName> <childName> [--by=role]

Create role., (*20)

yii rbac/create-role <name>

Create permission, (*21)

yii rbac/create-permission <name>

Remove role., (*22)

yii rbac/remove-role <name>

Remove permission., (*23)

yii rbac/remove-permission <name>

License

And of course:, (*24)

MIT: LICENSE, (*25)

====, (*26)

Adam Michna http://symetrland.com, (*27)

The Versions

14/03 2017

dev-master

9999999-dev

This is common controller to Yii2 Rbac module

  Sources   Download

MIT

The Requires

 

by Adam Michna

extension yii2 rbac console

24/09 2015

1.1

1.1.0.0

This is common controller to Yii2 Rbac module

  Sources   Download

MIT

The Requires

 

by Adam Michna

extension yii2 rbac console