phpcms cannot delete the column because the site administrator does not have the permission to delete the column. The solution: first find and open the "admin.class.php" file; then add the site administrator's permission to delete the column; finally modify "category.php" file is enough.
phpcms cannot delete columns? PHPCMS site administrator does not have the permission to delete columns
phpcms V9 except super administrator , other administrators do not have the permission to delete or modify columns. This may be a bug in the system.
Analysis:
PHPCMS v9 only determines the permissions recorded in the admin_role_priv table when judging permissions. That is, the "permission settings" we make when setting up roles, regardless of the "column permissions" we set. It can be seen from admin:check_priv() that this method does not take any consideration of column permissions. So when we log in using non-super management, if we modify a column or delete a column, we will be prompted with "You do not have permission to operate this item."
Location: phpcms/modules/admin/classes/admin.class.php
Recommended: "phpcms tutorial"
Solution:
1. Find /phpcms/modules/admin/classes/admin.class.php, find
$r =$privdb->get_one(array('m'=>ROUTE_M,'c'=>ROUTE_C,'a'=>$action,'roleid'=>$_SESSION['roleid'],'siteid'=>$siteid));
in it, probably on line 177, and then add below the sentence:
//添加站点管理员的删除栏目权限 by:醒木 if(ROUTE_C == 'category'){ $catid = $_GET['catid'] ? $_GET['catid'] : $_POST['catid']; //获取角色当前权限设置 pc_base::load_app_class('role_cat', '', 0); $priv = role_cat::get_roleid($_SESSION['roleid'], $siteid); if($priv[$catid][$action]) $r = true; }
2. Find
foreach ($arrchildid_arr as $arr_v) { $this->update_priv($arr_v, $_POST['priv_groupid'], 0); }
in /phpcms/modules/admin/category.php and change it to:
foreach ($arrchildid_arr as $arr_v) { $this->update_priv($arr_v, $_POST['priv_roleid']); //添加站点管理员的删除栏目权限 by:醒木 $this->update_priv($arr_v, $_POST['priv_groupid'], 0); }
Tips:
Remember to check the corresponding permission to delete goods when adding the goods modification column.
The above is the detailed content of What should I do if phpcms cannot delete a column?. For more information, please follow other related articles on the PHP Chinese website!