定制 prawee/yii2-auth-module 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

prawee/yii2-auth-module

Composer 安装命令:

composer require prawee/yii2-auth-module

包简介

Yii 2 User Authentication & Role Based Access Control (RBAC) Module

README 文档

README

Yii 2 User Authentication & Role Based Access Control (RBAC) Module

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist prawee/yii2-auth-module "*"

or add

"prawee/yii2-auth-module": "*"

above file

...
"repositories": [
        {
            "type": "git",
            "url": "https://bitbucket.org/prawee/yii2-auth-module.git"
        },
    ],
....

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

main.php
<?php
....
'modules'=>[
    'auth'=>[
        'class'=>'auth\Module',
        'tableMap'=>[
            'User'=>'user'
        ],
        'modal'=>true
    ],
],
'components'=>[
    'user'=>[
        //'identityClass' => 'auth\models\User',
        //'enableAutoLogin' => true,
        //'loginUrl'=>'auth/default/login',
        'class' => 'auth\components\User',
    ],
    'authManager' => [
        'class' => 'yii\rbac\DbManager',
    ],
],
....
?>
params.php
return [
    ...
    'icon-framework'=>'fa',
    ...
];
Login:              localhost/projectname/admin/auth/default/login
Logout:             localhost/projectname/admin/auth/default/logout
Signup:             localhost/projectname/admin/auth/default/signup
Reset Password:     localhost/projectname/admin/auth/resetpassword
Set Permission:     localhost/projectname/admin/auth/user
Manage Permission:  localhost/projectname/admin/auth/permission
Profile:            localhost/projectname/admin/auth/user/profile 

Rbac

in console config file main-local.php

.....
'components'=>[
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=127.0.0.1;dbname=teachdev',
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
        ],
        'authManager' => [
            'class' => 'yii\rbac\DbManager',
        ],
    ]
....

Migrate Database

Using command. ( Linux )

./yii migrate  --migrationPath=@vendor/yiisoft/yii2/rbac/migrations
./yii migrate  --migrationPath=@auth/migrations 
./yii migrate  --migrationPath=@auth/migrations/profile
./yii migrate  --migrationPath=@auth/migrations/api

Using command. (Windows)

yii migrate  --migrationPath=@vendor/yiisoft/yii2/rbac/migrations
yii migrate  --migrationPath=@auth/migrations 
yii migrate  --migrationPath=@auth/migrations/profile
yii migrate  --migrationPath=@auth/migrations/api

Initializing

1.Create all models

localhost/your-project/gii/model

Table Name
*

Click Preview Button
Click Generate Button

2.Create admin\app\models\User model extends by common\models\User

localhost/your-project/admin/gii/model

namespace admin\app\models;
use auth\models\User as CUser;
class User extends CUser{}

3.Create admin\app\models\UserSearch by localhost/your-project/admin/gii/crud

Model Class
admin\app\models\User

Search Model Class
admin\app\models\UserSearch

Controller Class
admin\app\controllers\UserController

Click Preview Button

Action Unselect all
Check UserSearch only

Click Generate Button

History

branch 1.0.tpt

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固