Respect user isolation mode when fetching groups
Updated DomainController to fetch groups using getAllWithChannelCount, passing the user ID when user isolation mode is set to 'isolated'. This ensures group listings are filtered per user when isolation is enabled, improving data separation and security.
This commit is contained in:
@@ -91,7 +91,16 @@ class DomainController extends Controller
|
||||
|
||||
public function create()
|
||||
{
|
||||
$groups = $this->groupModel->all();
|
||||
// Get groups based on isolation mode
|
||||
$userId = \Core\Auth::id();
|
||||
$settingModel = new \App\Models\Setting();
|
||||
$isolationMode = $settingModel->getValue('user_isolation_mode', 'shared');
|
||||
|
||||
if ($isolationMode === 'isolated') {
|
||||
$groups = $this->groupModel->getAllWithChannelCount($userId);
|
||||
} else {
|
||||
$groups = $this->groupModel->getAllWithChannelCount();
|
||||
}
|
||||
|
||||
$this->view('domains/create', [
|
||||
'groups' => $groups,
|
||||
@@ -192,7 +201,16 @@ class DomainController extends Controller
|
||||
return;
|
||||
}
|
||||
|
||||
$groups = $this->groupModel->all();
|
||||
// Get groups based on isolation mode
|
||||
$userId = \Core\Auth::id();
|
||||
$settingModel = new \App\Models\Setting();
|
||||
$isolationMode = $settingModel->getValue('user_isolation_mode', 'shared');
|
||||
|
||||
if ($isolationMode === 'isolated') {
|
||||
$groups = $this->groupModel->getAllWithChannelCount($userId);
|
||||
} else {
|
||||
$groups = $this->groupModel->getAllWithChannelCount();
|
||||
}
|
||||
|
||||
$this->view('domains/edit', [
|
||||
'domain' => $domain,
|
||||
@@ -393,7 +411,17 @@ class DomainController extends Controller
|
||||
public function bulkAdd()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$groups = $this->groupModel->all();
|
||||
// Get groups based on isolation mode
|
||||
$userId = \Core\Auth::id();
|
||||
$settingModel = new \App\Models\Setting();
|
||||
$isolationMode = $settingModel->getValue('user_isolation_mode', 'shared');
|
||||
|
||||
if ($isolationMode === 'isolated') {
|
||||
$groups = $this->groupModel->getAllWithChannelCount($userId);
|
||||
} else {
|
||||
$groups = $this->groupModel->getAllWithChannelCount();
|
||||
}
|
||||
|
||||
$this->view('domains/bulk-add', [
|
||||
'groups' => $groups,
|
||||
'title' => 'Bulk Add Domains'
|
||||
|
||||
Reference in New Issue
Block a user