ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
>[danger]在COWCMS系统中,在线安装模块时,总是需要在总后台上添加对应的菜单和管理员或会员的权限,COWCMS给出了对应的接口。 > 在exec目录里创建auth.php -权限规则文件 >[info] auth.php,主要负责在权限规则列表中加入对应的规则,文件结构为 > ~~~php return [ 'auth_0'=>['title'=>'权限系统','type'=>'admin','order_num'=>0,'class'=>1], 'auth_0_0'=>['title'=>'权限列表','order_num'=>0,'parent_id'=>'auth_0','m'=>'auth','c'=>'auth','a'=>'auth_list'], 'auth_0_1'=>['title'=>'权限添加','order_num'=>0,'parent_id'=>'auth_0','m'=>'auth','c'=>'auth','a'=>'auth_add'], 'auth_0_2'=>['title'=>'权限编辑','order_num'=>0,'parent_id'=>'auth_0','m'=>'auth','c'=>'auth','a'=>'auth_edit'], 'auth_0_3'=>['title'=>'权限删除','order_num'=>0,'parent_id'=>'auth_0','m'=>'auth','c'=>'auth','a'=>'auth_del'], 'auth_0_4'=>['title'=>'分类列表','order_num'=>0,'parent_id'=>'auth_0','m'=>'auth','c'=>'auth','a'=>'auth_class_list'], 'auth_0_5'=>['title'=>'分类添加','order_num'=>0,'parent_id'=>'auth_0','m'=>'auth','c'=>'auth','a'=>'auth_class_add'], 'auth_0_6'=>['title'=>'分类编辑','order_num'=>0,'parent_id'=>'auth_0','m'=>'auth','c'=>'auth','a'=>'auth_class_edit'], 'auth_0_7'=>['title'=>'分类删除','order_num'=>0,'parent_id'=>'auth_0','m'=>'auth','c'=>'auth','a'=>'auth_class_del'], ]; ~~~ 'auth_0'=>['title'=>'权限系统','type'=>'admin','order_num'=>0,'class'=>1] * [ ] title:为权限分类名称 * [ ] type:为admin 表示为总后台的权限,如管理员或者管理员组处显示的权限 * [ ] order_num:权限分类显示的排序 * [ ] class:属性为1表示权限规则分类,没有class属性的表示为权限规则 'auth_0_0'=>['title'=>'权限列表','order_num'=>0,'parent_id'=>'auth_0','m'=>'auth','c'=>'auth','a'=>'auth_list'], * [ ] title:为权限分类名称 * [ ] order_num:权限分类显示的排序 * [ ] parent_id:属性为auth_0表示,这些权限规则是添加到auth_0产生的分类下 * [ ] m:规则的模块名,必须填写 * [ ] c:规则的控制名 * [ ] a:规则的方法名 * [ ] p:规则的参数 格式为 a=1&b=2 模块安装成功后效果如下: ![](https://box.kancloud.cn/4f90b2fc84c0599097a786a04616fa56_1500x782.jpg)![](https://box.kancloud.cn/e4d2a6d4d20feb328b88280066779250_1627x605.jpg)![](https://box.kancloud.cn/10b8814283a87208a3c030168c87b13c_1204x627.jpg)