Share the permissions of the Framework website system, especially for large projects and secondary development projects.

Source: Internet
Author: User
Share the permissions of the Framework website System. especially for large projects and secondary development projects, the user table is a user table. it does not matter if tens of thousands of users can be stored, the groupid behind is 1, which is the administrator permission. 2 is the method name of the model table storage framework for the visitor permission. The group behind it is the set type, which group has this permission ;? PhpclassIndexActio shares the permissions of the Framework website system, especially for large projects and secondary development projects.


The user table is the user table, and it does not matter if tens of thousands of users can be stored. the groupid below is 1, which is the administrator permission, and 2 is the tourist permission.



Name of each method in the model table storage framework. The group behind it is the set type, which indicates which group has this permission

Look at the sample code.

PHP code
  
  Find ("user", "string", "user = '". $ user. "'"); $ group_tmp = $ data ["groupid"]; $ this-> show ($ group_tmp);} public function show ($ group_tmp) {$ list = $ this-> find ("model", "string", "func = 'show '"); $ SQL = "select * from model where func = 'show 'and find_in_set (". $ group_tmp. ",". $ list ['group']. ")"; if (mysql_num_rows (mysql_query ($ SQL) {echo "permission passed"; // process the following content} else {echo "no permission ";}} public function showAll ($ group_tmp) {$ List = $ this-> find ("model", "string", "func = 'showall '"); $ SQL = "select * from model where func = 'wall' and find_in_set (". $ group_tmp. ",". $ list ['group']. ")"; if (mysql_num_rows (mysql_query ($ SQL) {echo "permission passed "; // process the following content} else {echo "no permission" ;}}}?>




For more information, see...

------ Solution --------------------
The model name must be added to the model table. otherwise, different models cannot be distinguished from methods with the same name.

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.