PHPackages                             xihrni/yii2-behavior-rbac - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. xihrni/yii2-behavior-rbac

ActiveYii2-extension[Authentication &amp; Authorization](/categories/authentication)

xihrni/yii2-behavior-rbac
=========================

Used for rbac-based authentication of permissions.

0.0.2(6y ago)1031BSD-3-ClausePHP

Since May 6Pushed 6y ago2 watchersCompare

[ Source](https://github.com/xihrni/yii2-behavior-rbac)[ Packagist](https://packagist.org/packages/xihrni/yii2-behavior-rbac)[ RSS](/packages/xihrni-yii2-behavior-rbac/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Yii2 RBAC权限认证行为
===============

[](#yii2-rbac权限认证行为)

Introduction
------------

[](#introduction)

用于基于 RBAC 的权限认证

Install
-------

[](#install)

```
$ composer require xihrni/yii2-behavior-rbac

```

Usage
-----

[](#usage)

### Database

[](#database)

使用 Yii2 的迁移来生成数据库中的相关表

```
yii migrate --migrationPath=@vendor/xihrni/yii2-behavior-rbac/migrations
```

### Model

[](#model)

复制已准备好的模型到项目中，目录为：`@vendor/xihrni/yii2-behavior-rbac/models`，需要注意 `admin` 管理员模型需要实现 `AdminInterface` 接口方法

```
interface AdminInterface
{
    public static function getPermissions($id);
}
```

### Controller

[](#controller)

```
