This commit is contained in:
tianshujie
2022-04-13 09:51:40 +08:00
parent 1ef7a9f6b0
commit 2e5b43979e
-30
View File
@@ -396,23 +396,6 @@ class groupModel extends model
}
$actions['actions'] = $dynamic;
/* Update whitelist. */
$this->loadModel('personnel');
$users = $this->getUserPairs($groupID);
$users = array_keys($users);
$objectTypes = array_reverse($this->config->group->acl->objectTypes); //Adjust the order of object types, because execution is subordinate to the whitelist of projects, as well as products to programs.
foreach($objectTypes as $key => $objectType)
{
$oldAcls = isset($oldGroup->acl[$key]) ? $oldGroup->acl[$key] : array();
$newAcls = isset($actions[$key]) ? $actions[$key] : array();
$needRemoveAcls = array_diff($oldAcls, $newAcls);
$needAddAcls = array_diff($newAcls, $oldAcls);
foreach($needAddAcls as $objectID) $this->personnel->updateWhitelist($users, $objectType, $objectID, 'whitelist', 'sync', 'increase');
foreach($needRemoveAcls as $objectID) $this->personnel->deleteWhitelist($users, $objectType, $objectID, $groupID);
}
$actions = empty($actions) ? '' : json_encode($actions);
$this->dao->update(TABLE_GROUP)->set('acl')->eq($actions)->where('id')->eq($groupID)->exec();
return dao::isError() ? false : true;
@@ -473,19 +456,6 @@ class groupModel extends model
$acl = $this->dao->select('acl')->from(TABLE_GROUP)->where('id')->eq($groupID)->fetch('acl');
$acl = json_decode($acl);
$this->loadModel('personnel');
$objectTypes = array_reverse($this->config->group->acl->objectTypes); //Adjust the order of object types, because execution is subordinate to the whitelist of projects, as well as products to programs.
foreach($objectTypes as $key => $objectType)
{
if(!isset($acl->{$key})) continue;
foreach($acl->{$key} as $objectID)
{
$this->personnel->updateWhitelist($newUsers, $objectType, $objectID, 'whitelist', 'sync', 'increase');
$this->personnel->deleteWhitelist($delUsers, $objectType, $objectID, $groupID);
}
}
/* Adjust user view. */
$changedUsers = array_merge($newUsers, $delUsers);
if(!empty($changedUsers))