* code for task #70541.

This commit is contained in:
wangyidong
2022-09-29 09:50:11 +08:00
parent 54526092d4
commit 1e928ed625
13 changed files with 82 additions and 65 deletions
+13 -21
View File
@@ -402,6 +402,7 @@ class groupModel extends model
*/
public function updatePrivByGroup($groupID, $menu, $version)
{
/* Delete old. */
/* Set priv when have version. */
if($version)
{
@@ -416,27 +417,19 @@ class groupModel extends model
$this->dao->delete()->from(TABLE_GROUPPRIV)->where('`group`')->eq($groupID)->andWhere('module')->eq($module)->andWhere('method')->eq($method)->exec();
}
}
/* Replace new. */
if($this->post->actions)
{
foreach($this->post->actions as $moduleName => $moduleActions)
{
foreach($moduleActions as $actionName)
{
$data = new stdclass();
$data->group = $groupID;
$data->module = $moduleName;
$data->method = $actionName;
$this->dao->replace(TABLE_GROUPPRIV)->data($data)->exec();
}
}
}
return true;
}
/* Delete old. */
$this->dao->delete()->from(TABLE_GROUPPRIV)->where('`group`')->eq($groupID)->andWhere('module')->in($this->getMenuModules($menu))->exec();
else
{
foreach($this->getMenuModules($menu) as $moduleName)
{
$methodList = (array)zget($this->lang->resource, $moduleName, array());
$methodList = array_keys($methodList);
$this->dao->delete()->from(TABLE_GROUPPRIV)->where('`group`')->eq($groupID)
->andWhere('module')->eq($moduleName)
->beginIF($methodList)->andWhere('method')->in($methodList)->fi()
->exec();
}
}
/* Insert new. */
if($this->post->actions)
@@ -453,7 +446,6 @@ class groupModel extends model
}
}
}
return true;
}