PHPCMS2008 the solution of inheriting the parent class of the sub-class of permission
In PHPCMS2008, each column can be assigned to different roles of different permissions, is based on the column as the starting point, and our general situation from the role of the starting point is not right, so it does not go to achieve the function of the column permissions inheritance. But in the actual creation of a lot of columns and then you will find that the decentralization work is very troublesome problem, because the sub-column can not inherit the parent column, need one of the allocation.
To this point, we also think of a relative strategy, that is, in judging whether it has the authority, if it does not have the authority to judge all of his superiors, if the superiors are not, then there is no, if there is a superior has it.
The specific changes are as follows:
Admin directory of the content.inc.php file, about 31 lines, look for 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 ');
---------above is the original code----------------------------------------------------------------
if (! $allow _manage) {
$pcatid =get_brand_catid ($catid);//This is the function that gets the parent ID. You can write a recursive by yourself.
$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 ');
}
----------------above is the added code----------------------------------------------------
$attachment = new Attachment ($mod, $catid);