在PHPCMS2008中,可对每个栏目分配给不同角色的不同权限,是以栏目为出发点,这一点与我们一般情况从角色为出发点不对,因此其没有去实现栏目权限继承的功能。但在实际中创建了很多栏目后再分权时你就会发现分权工作很麻烦的问题,原因是子栏目不能继承父栏目,需要一个一个的分配。
针对这一点,我们也想到一个相对之策,即在判断其是否有权限的同时,如果其本身没有权限那就判断他的所有上级,如果上级都没有,那就没有,如果有一个上级有那它就有。
具体修改如下:
admin目录下的content.inc.php文件,大概在31行,找下这段代码
$allow_manage = $priv_role->check('catid', $catid, 'manage');
$allow_add = $allow_manage ? true : $priv_role->check('catid', $catid, 'add');
$allow_check = $allow_manage ? true : $priv_role->check('catid', $catid, 'check');
$allow_view = $allow_manage ? true : $priv_role->check('catid', $catid, 'view');
---------以上是原代码----------------------------------------------------------------
if(!$allow_manage){
$pcatid=get_brand_catid($catid);//此处为获取父级ID的函数。可以自己写一个递归。
$pcatid=$CATEGORY[$pcatid]['parentid'];
$allow_manage = $priv_role->check('catid', $pcatid, 'manage');
$allow_add = $allow_manage ? true : $priv_role->check('catid', $pcatid, 'add');
$allow_check = $allow_manage ? true : $priv_role->check('catid', $pcatid, 'check');
$allow_view = $allow_manage ? true : $priv_role->check('catid', $pcatid, 'view');
}
----------------以上是增加的代码----------------------------------------------------
$attachment = new attachment($mod, $catid);

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)