This commit is contained in:
liyuchun
2021-10-18 09:07:11 +08:00
parent 88323d34da
commit e3291b0e2a
2 changed files with 16 additions and 2 deletions
+1 -1
View File
@@ -375,7 +375,7 @@ class groupModel extends model
$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);
foreach($needRemoveAcls as $objectID) $this->personnel->deleteWhitelist($users, $objectType, $objectID, $groupID);
}
+15 -1
View File
@@ -824,13 +824,27 @@ class personnelModel extends model
* @param array $users
* @param string $objectType
* @param int $objectID
* @param int $groupID
* @access public
* @return void
*/
public function deleteWhitelist($users = array(), $objectType = 'program', $objectID = 0)
public function deleteWhitelist($users = array(), $objectType = 'program', $objectID = 0, $groupID = 0)
{
$this->loadModel('group');
/* Determine whether to delete the whitelist. */
foreach($users as $account)
{
$groups = $this->group->getByAccount($account);
foreach($groups as $key => $group)
{
if($key == $groupID) continue;
$acl = json_decode($group->acl);
$keyName = $objectType . 's';
if(isset($acl->$keyName) and in_array($objectID, $acl->$keyName)) return false;
}
if($objectType == 'program') $this->deleteProgramWhitelist($objectID, $account);
if($objectType == 'project') $this->deleteProjectWhitelist($objectID, $account);
if($objectType == 'product') $this->deleteProductWhitelist($objectID, $account);