* Fix bug #15541.
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user