Enforce user-specific data access for all users
Refactored controllers and models to always filter data by user ID, removing admin bypass logic. This ensures all statistics, groups, domains, and tags are user-specific regardless of isolation mode, improving data isolation and security.
This commit is contained in:
@@ -27,27 +27,17 @@ class DashboardController extends Controller
|
||||
$settingModel = new \App\Models\Setting();
|
||||
$isolationMode = $settingModel->getValue('user_isolation_mode', 'shared');
|
||||
|
||||
// Get user-specific or global statistics
|
||||
if ($isolationMode === 'isolated') {
|
||||
$stats = $this->domainModel->getStatistics($userId);
|
||||
$recentDomains = $this->domainModel->getRecent(5, $userId);
|
||||
$groups = $this->groupModel->getAllWithChannelCount($userId);
|
||||
} else {
|
||||
$stats = $this->domainModel->getStatistics();
|
||||
$recentDomains = $this->domainModel->getRecent(5);
|
||||
$groups = $this->groupModel->getAllWithChannelCount();
|
||||
}
|
||||
// Get user-specific statistics (always user-specific)
|
||||
$stats = $this->domainModel->getStatistics($userId);
|
||||
$recentDomains = $this->domainModel->getRecent(5, $userId);
|
||||
$groups = $this->groupModel->getAllWithChannelCount($userId);
|
||||
|
||||
// Get expiring threshold from settings
|
||||
$notificationDays = $settingModel->getNotificationDays();
|
||||
$expiringThreshold = !empty($notificationDays) ? max($notificationDays) : 30;
|
||||
|
||||
// Get expiring domains limited to top 5
|
||||
if ($isolationMode === 'isolated') {
|
||||
$allExpiringDomains = $this->domainModel->getExpiringDomains($expiringThreshold, $userId);
|
||||
} else {
|
||||
$allExpiringDomains = $this->domainModel->getExpiringDomains($expiringThreshold);
|
||||
}
|
||||
$allExpiringDomains = $this->domainModel->getExpiringDomains($expiringThreshold, $userId);
|
||||
$expiringThisMonth = array_slice($allExpiringDomains, 0, 5);
|
||||
|
||||
$recentLogs = $this->logModel->getRecent(10);
|
||||
|
||||
Reference in New Issue
Block a user