承接 rmrevin/yii2-rbac-command 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rmrevin/yii2-rbac-command

最新稳定版本:1.6.1

Composer 安装命令:

composer require rmrevin/yii2-rbac-command

包简介

Extension for RBAC rules update for Yii2

README 文档

README

This extension provides a console command to update the RBAC rules, roles and permissions for Yii framework 2.0 applications.

Installation

composer require "rmrevin/yii2-rbac-command:~1.6"

Configuration

Create new console command extends \rmrevin\yii\rbac\Command (example)

<?php

namespace app\commands;

class RbacCommand extends \rmrevin\yii\rbac\Command
{

    protected function rules()
    {
        // ...
    }

    protected function roles()
    {
        // ...
    }

    protected function permissions()
    {
        // ...
    }

    protected function inheritanceRoles()
    {
        // ...
    }

    protected function inheritancePermissions()
    {
        // ...
    }
}

In console application config (example: /protected/config/console.php)

<?
return [
  // ...
	'controllerMap' => [
		// ...
		'rbac' => [
			'class' => 'app\commands\RbacCommand',
			'batchSize' => 1000,
			'forceAssign' => ['user'], // force assign user role for all users
			'assignmentsMap' => [
			    'frontend.old' => 'frontend.new', // after next update all `frontend.old` will be replaced by `frontend.new`
			],
			'useTransaction' => true,
			'useCache' => true,
		],
	],
	// ...
];

Usage

Execute command in command line

yii rbac/update

统计信息

  • 总下载量: 20.22k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-22