权限验证中间件

你可以在 config/authload/auth.php 进行相关的权限配置

默认配置如下:

declare(strict_types=1);

/**
 * 自定义权限验证
 */
return [
    'no_check_uri' => [ // 不需要授权就能访问的页面
        '/public/login', '/public/loginOut', '/index/index', '/admin/updatePassword'
    ],
    'must_login_uri' => [ // 有些页面可能不需要权限,但必须是登录状态才能访问
        '/public/loginOut', '/index/index', '/admin/updatePassword'
    ],
    'super_admin_id' => [ // 超级管理员,不会出现在员工列表,可以绕过权限验证
        1
    ],
    'session_time_out' => 3600 * 24, // 登录token有效时间
];

数据库统一在 txf-server 中操作,redis两边都可以操作,所以有些配置在 txf-server 中,有些两边都进行配置

txf-server 中关于 txf-admin 的配置都在 config/authload/admin.php

declare(strict_types=1);

/**
 * admin系统对应的配置
 */
return [
    'session_time_out' => 3600 * 24,
    'login_error_times' => 5, // 不连续登录错误次数,达到N次后不能登录,可使用超管账号在员工管理中修改登录错误次数来恢复使用
    'super_admin_id' => [
        1
    ],
    'super_permission_id' => [ // 超级权限,不允许删除,否则超管虽然能绕过权限验证,但是看不到菜单了
        1,2,3,4
    ],
];

权限验证流程

TODO

results matching ""

    No results matching ""