Solution for PHPCMS2008 column subclass to inherit parent class according to permissions_PHP Tutorial

WBOY
Release: 2016-07-13 10:32:24
Original
928 people have browsed it

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);

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/755784.htmlTechArticleIn PHPCMS2008, each column can be assigned different permissions to different roles, starting from the column. This is different from our general starting point of character, so it is not implemented...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template