Home  >  Article  >  CMS Tutorial  >  What should I do if phpcms cannot delete a column?

What should I do if phpcms cannot delete a column?

藏色散人
藏色散人Original
2020-07-21 09:22:022294browse

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.

What should I do if phpcms cannot delete a column?

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

What should I do if phpcms cannot delete a column?

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

What should I do if phpcms cannot delete a column?

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!

Statement:
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