In PHPCMS2008, each column can be assigned different permissions to different roles. The column is used as the starting point. This is different from our general starting point of role, so it does not implement the function of column permission inheritance. But in practice, when you create many columns and then decentralize them, you will find that the decentralization work is very troublesome. The reason is that the sub-columns cannot inherit the parent columns and need to be allocated one by one.
In view of this, we also thought of a countermeasure, that is, while judging whether he has authority, if he himself does not have authority, then judge all his superiors. If there are no superiors, then there is none. If there is one If the superiors have it, then it will have it.
The specific modifications are as follows:
The content.inc.php file in the admin directory is about line 31. Find this code
$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');
---------The above is the original code---------------------------------- ----------------------------------
if(!$allow_manage){
$pcatid=get_brand_catid($catid);//This is the function to get the parent ID. You can write your own recursion.
$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');
}
----------------The above is the added code-------------------------- --------------------------
$attachment = new attachment($mod, $catid);