Assignment of permission system in PHP and reading of permission profile

Source: Internet
Author: User

            //reading data from the qx.php            $data=require(__dir__. ' /.. /qx.php ');//read the fields in qx.php//qx.php under the Controller directory//The following is the test data           /*$result =array (' name ' = ' affairsapproval ', ' desc ' = ' transaction approval ', ' value ' = ' 0 '), Array (' name ' = ' leaveapplyapproval ', ' desc ' = ' leave approval ', ' value ' = ' 0 ');*/                        $newresult=Array(); /*foreach ($data as $key + $value) {/* $new =array (' key ' = = $key, ' value ' = = $value,                                 ' Check ' = ' 0 ');             $newresult =array_merge_recursive ($new, Array (' key ' = $key, ' value ' = = $value, ' check ' = ' 0 ')); } */              $i=0; $userid=$this->input->get (' userid '); $USERQX=$this->db->get_where (' QX ',Array(' userid ' =$userid)),Result_array (); if(Empty($USERQX[0])){                 foreach($data  as $key=$value) {                    $newarray[$i] =Array(                                    ' Value ' =$value, ' key ' =$key, ' checked ' =false                                ); $i++; }             }Else{                 foreach($USERQX[0] as $key=$val){                                      if($key! = ' act ' &&$key! = ' id ' &&$key! = ' UserID '){                                             $newarray[$i] =Array(                                           ' Value ' =$data[$key], ' key ' =$key, ' checked ' = ($val!=1)?false:true                                       ); $i++; }                 }             }                        $output->data=$newarray;

Privilege Profile:

$QX=Array();$QX[' Affairsapproval ']= ' Transaction approval ';$QX[' leaveapplyapproval '] = ' leave approval ';$QX[' customprocess ']= ' custom process ';$QX[' Addcustomprocess ']= ' new custom process '; $QX[' Systemadmin ']= ' system administrator '; $QX[' Systemsync ']= ' System Sync data '; $QX[' systemmanagement ']= ' System Management '; $QX[' Checkwork ']= ' administrative attendance '; $QX[' Requestapproval ']= ' Administrative application form '; $QX[' Notice ']= ' company notice ';$QX[' Houtai ']= ' backstage ';return $QX; 

Assignment of permission system in PHP and reading of permission profile

Related Article

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.