* Fix bug#47814.
This commit is contained in:
+19
-18
@@ -1408,10 +1408,12 @@ class upgradeModel extends model
|
||||
*
|
||||
* @param string $openVersion
|
||||
* @access public
|
||||
* @return void
|
||||
* @return bool
|
||||
*/
|
||||
public function addORPriv($openVersion = ''): void
|
||||
public function addORPriv($openVersion = ''): bool
|
||||
{
|
||||
if(version_compare($openVersion, '18_6', '>=')) return false;
|
||||
|
||||
/* Get admin users. */
|
||||
$admins = $this->dao->select('admins')->from(TABLE_COMPANY)->where('deleted')->eq(0)->fetchPairs();
|
||||
$admins = explode(',', implode(',', $admins));
|
||||
@@ -1428,25 +1430,24 @@ class upgradeModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
if(version_compare($openVersion, '18_6', '<'))
|
||||
include('priv.php');
|
||||
/* Add or groups. */
|
||||
foreach($orData as $role => $name)
|
||||
{
|
||||
include('priv.php');
|
||||
/* Add or groups. */
|
||||
foreach($orData as $role => $name)
|
||||
{
|
||||
$group = new stdclass();
|
||||
$group->vision = 'or';
|
||||
$group->name = $name;
|
||||
$group->role = $role;
|
||||
$group->desc = $name;
|
||||
$this->dao->insert(TABLE_GROUP)->data($group)->exec();
|
||||
if(dao::isError()) continue;
|
||||
$group = new stdclass();
|
||||
$group->vision = 'or';
|
||||
$group->name = $name;
|
||||
$group->role = $role;
|
||||
$group->desc = $name;
|
||||
$this->dao->insert(TABLE_GROUP)->data($group)->exec();
|
||||
if(dao::isError()) continue;
|
||||
|
||||
$groupID = (string)$this->dao->lastInsertID();
|
||||
$sql = 'REPLACE INTO' . TABLE_GROUPPRIV . '(`group`, `module`, `method`) VALUES ' . str_replace('GROUPID', $groupID, ${$role . 'Priv'});
|
||||
$this->dao->exec($sql);
|
||||
}
|
||||
$groupID = (string)$this->dao->lastInsertID();
|
||||
$sql = 'REPLACE INTO' . TABLE_GROUPPRIV . '(`group`, `module`, `method`) VALUES ' . str_replace('GROUPID', $groupID, ${$role . 'Priv'});
|
||||
$this->dao->exec($sql);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,7 @@ class upgradeZen extends upgrade
|
||||
|
||||
/* 如果是 ipd 版本,设置相关的配置。*/
|
||||
/* When the edition is ipd. */
|
||||
if($this->config->edition == 'ipd' && strpos($fromVersion, 'ipd') === false) $this->SetIpdItems();
|
||||
if($this->config->edition == 'ipd') $this->SetIpdItems($openVersion);
|
||||
|
||||
if($selectMode)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user