Yii2 Ace Admin Background extension

Progress Latest Stable Version Total Downloads Latest Unstable Version GitHub issues GitHub forks GitHub stars GitHub license

Extensions developed for yii2, ace admin for background templates. For general background development, it is more convenient; CURL operations for data tables are encapsulated, and all operations have permission control

切换中文 Documentation

Features

Installation requirements

Installation

The preferred way to install this extension is through composer.

Either run

composer require jinxing/yii2-admin

Version update instructions

Version update instructions

Basic Configuration

Once the extension is installed, simply modify your application configuration as follows:

return [
    'modules' => [
        'admin' => [
            'class' => 'jinxing\admin\Module',
            
            // Make use of that kind of user
            'user' => 'admin',
            
            // Do not verify permissions
            'verifyAuthority' => false,
            ...
        ],
        ...
    ],
    ...
    'components' => [
        // Front desk user
        'user' => [
            'identityClass'   => 'app\models\User',
            'enableAutoLogin' => true,
        ],
        
        // Background user
        'admin' => [
            'class' => '\yii\web\User',
            'identityClass' => 'jinxing\admin\models\Admin',
            'enableAutoLogin' => true,
            'loginUrl' => ['/admin/default/login'],
            'idParam' => '_adminId',
            'identityCookie' => ['name' => '_admin','httpOnly' => true],
        ],
        
        // This step is not necessary, but you use it outside the module. The controller, view in the module must be added!
        'i18n' => [
            'translations' => [
                'admin' => [
                    'class'          => 'yii\i18n\PhpMessageSource',
                    'sourceLanguage' => 'en',
                    'basePath'       => '@jinxing/admin/messages'
                ],
            ],
        ],
                
    ]
];

There are also some param configuration, not mandatory, with default values

// Need to configure params.php
return [
    // Background prefix, used to import data, the prefix of the permission name; currently there is no good solution, all use this configuration item
    'admin_rule_prefix' => 'admin', 
    
     // Login navigation menu cache time
    'cacheTime'         => 86400,    
    
    // Universal status                       
    'status'            => ['停用', '启用'],
    
    // Show other information
    'project_open_other' => false,
               
    'projectName'       => 'Yii2 后台管理系统',              
    'projectTitle'      => 'Yii2 后台管理系统',
    'companyName'       => '<span class="blue bolder"> Liujinxing </span> Yii2 Admin 项目 &copy; 2016-2018',  
];

About the configuration of permissions

return [
    'components' => [
        'modules' => [
            'admin' => [
                'class' => 'jinxing\admin\Module',
                
                // Make use of that kind of user
                'user' => 'admin',
                ...
            ],
            ...
        ],
        // authority management
        'authManager'  => [
            'class' => 'yii\rbac\DbManager',
        ],
        ...
    ],
];

Import permission information table structure

php yii migrate --migrationPath=@yii/rbac/migrations

Importing data information such as table structure and permission configuration required in the background

php yii migrate --migrationPath=@jinxing/admin/migrations

Now you can preview your background

Default super administrator: super

Default super administrator password: admin123

Default administrator: admin Default administrator password: admin888

// Login address
http://localhost/path/to?index.php?r=admin/default/login

Documentation

Please refer to our extensive Module configuration description for more information.

Routing permission control description

Basic operation permissions (take administrators as an example):

Each request corresponds to a permission, the request path is the name of the permission, and the permission validation is verified in the beforeAction method in the Module

Preview

  1. Login Page 登录页
  2. Data Display 数据显示
  3. Data Edit 数据显示
  4. Rights Allocation 权限分配
  5. Code Generation 模块生成