This commit is contained in:
liyuchun
2021-10-18 10:21:08 +08:00
parent e3291b0e2a
commit c8fe1f5e14
2 changed files with 20 additions and 4 deletions
+16
View File
@@ -156,6 +156,22 @@ class groupModel extends model
->fetchAll('id');
}
/**
* Get groups by accounts.
*
* @param array $accounts
* @access public
* @return array
*/
public function getByAccounts($accounts)
{
return $this->dao->select('t1.account, t2.acl, t2.id')->from(TABLE_USERGROUP)->alias('t1')
->leftJoin(TABLE_GROUP)->alias('t2')
->on('t1.`group` = t2.id')
->where('t1.account')->in($accounts)
->fetchGroup('account');
}
/**
* Get the account number in the group.
*
+4 -4
View File
@@ -830,15 +830,15 @@ class personnelModel extends model
*/
public function deleteWhitelist($users = array(), $objectType = 'program', $objectID = 0, $groupID = 0)
{
$this->loadModel('group');
$groups = $this->loadModel('group')->getByAccounts($users);
/* Determine whether to delete the whitelist. */
foreach($users as $account)
{
$groups = $this->group->getByAccount($account);
foreach($groups as $key => $group)
$groups = zget($groups, $account, array());
foreach($groups as $group)
{
if($key == $groupID) continue;
if($group->id == $groupID) continue;
$acl = json_decode($group->acl);
$keyName = $objectType . 's';