| @@ -1,8 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace FluentSupport\App\Models; |
| 4 | 4 | |
| 5 | +use FluentSupport\App\Services\Tickets\AgentTicketAccess; | |
| 6 | + | |
| 5 | 7 | class AgentGroup extends Tag |
| 6 | 8 | { |
| 7 | 9 | protected static $type = 'agent_group'; |
| 8 | 10 | |
| @@ -66,13 +68,14 @@ | ||
| 66 | 68 | } |
| 67 | 69 | |
| 68 | 70 | $selectedAgent = null; |
| 69 | 71 | $minCount = PHP_INT_MAX; |
| 72 | + $ticketAccess = new AgentTicketAccess(); | |
| 70 | 73 | |
| 71 | 74 | foreach ($agents as $agent) { |
| 72 | 75 | if ($mailboxId) { |
| 73 | - $restrictions = $agent->getMeta('agent_restrictions', []); | |
| 74 | - if (!empty($restrictions['restrictedBusinessBoxes']) && in_array($mailboxId, $restrictions['restrictedBusinessBoxes'])) { | |
| 76 | + $restrictedBoxes = $ticketAccess->getRestrictedMailboxIds($agent); | |
| 77 | + if (in_array((int) $mailboxId, $restrictedBoxes, true)) { | |
| 75 | 78 | continue; |
| 76 | 79 | } |
| 77 | 80 | } |
| 78 | 81 | |