PHPCMS2008 the solution of inheriting the parent class of the sub-class of permission

Source: Internet
Author: User
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);

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.