Finish switching to constants for ACL and settings.
This commit is contained in:
parent
2a27fd160e
commit
40abdbcec4
|
@ -45,7 +45,7 @@ class IndexController
|
|||
$view->sidebar = null;
|
||||
|
||||
// Synchronization statuses
|
||||
if ($this->acl->userAllowed($user, 'administer all')) {
|
||||
if ($this->acl->userAllowed($user, Acl::GLOBAL_ALL)) {
|
||||
$view->sync_times = $this->sync->getSyncTimes();
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ class InternalController
|
|||
/** @var Entity\User $user */
|
||||
$user = $request->getAttribute(Request::ATTRIBUTE_USER);
|
||||
|
||||
if ($this->acl->userAllowed($user, 'view administration', $station->getId())) {
|
||||
if ($this->acl->userAllowed($user, Acl::GLOBAL_VIEW, $station->getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class AccountController
|
|||
|
||||
/** @var SettingsRepository $settings_repo */
|
||||
$settings_repo = $this->em->getRepository(Settings::class);
|
||||
if ($settings_repo->getSetting('setup_complete', 0) == 0) {
|
||||
if ($settings_repo->getSetting(Settings::SETUP_COMPLETE, 0) == 0) {
|
||||
$num_users = $this->em->createQuery('SELECT COUNT(u.id) FROM '.User::class.' u')->getSingleScalarResult();
|
||||
|
||||
if ($num_users == 0) {
|
||||
|
|
|
@ -79,7 +79,7 @@ class DashboardController
|
|||
$stations = array_filter($stations, function($station) use ($user) {
|
||||
/** @var Entity\Station $station */
|
||||
return $station->isEnabled() &&
|
||||
$this->acl->userAllowed($user, 'view station management', $station->getId());
|
||||
$this->acl->userAllowed($user, Acl::STATION_VIEW, $station->getId());
|
||||
});
|
||||
|
||||
if (empty($stations)) {
|
||||
|
@ -137,7 +137,7 @@ class DashboardController
|
|||
/** @var Entity\Repository\SettingsRepository $settings_repo */
|
||||
$settings_repo = $this->em->getRepository(Entity\Settings::class);
|
||||
|
||||
$analytics_level = $settings_repo->getSetting('analytics', Entity\Analytics::LEVEL_ALL);
|
||||
$analytics_level = $settings_repo->getSetting(Entity\Settings::LISTENER_ANALYTICS, Entity\Analytics::LEVEL_ALL);
|
||||
|
||||
if ($analytics_level === Entity\Analytics::LEVEL_NONE) {
|
||||
$metrics = null;
|
||||
|
|
|
@ -28,7 +28,7 @@ class ListenersController
|
|||
/** @var Entity\Repository\SettingsRepository $settings_repo */
|
||||
$settings_repo = $this->em->getRepository(Entity\Settings::class);
|
||||
|
||||
$analytics_level = $settings_repo->getSetting('analytics', Entity\Analytics::LEVEL_ALL);
|
||||
$analytics_level = $settings_repo->getSetting(Entity\Settings::LISTENER_ANALYTICS, Entity\Analytics::LEVEL_ALL);
|
||||
|
||||
if ($analytics_level !== Entity\Analytics::LEVEL_ALL) {
|
||||
return $view->renderToResponse($response, 'stations/reports/restricted');
|
||||
|
|
|
@ -37,7 +37,7 @@ class OverviewController
|
|||
/** @var Entity\Repository\SettingsRepository $settings_repo */
|
||||
$settings_repo = $this->em->getRepository(Entity\Settings::class);
|
||||
|
||||
$analytics_level = $settings_repo->getSetting('analytics', Entity\Analytics::LEVEL_ALL);
|
||||
$analytics_level = $settings_repo->getSetting(Entity\Settings::LISTENER_ANALYTICS, Entity\Analytics::LEVEL_ALL);
|
||||
|
||||
if ($analytics_level === Entity\Analytics::LEVEL_NONE) {
|
||||
// The entirety of the dashboard can't be shown, so redirect user to the profile page.
|
||||
|
|
|
@ -67,7 +67,7 @@ class StreamersController
|
|||
$settings_repo = $this->em->getRepository(Entity\Settings::class);
|
||||
|
||||
return $view->renderToResponse($response, 'stations/streamers/index', [
|
||||
'server_url' => $settings_repo->getSetting('base_url', ''),
|
||||
'server_url' => $settings_repo->getSetting(Entity\Settings::BASE_URL, ''),
|
||||
'stream_port' => $backend->getStreamPort($station),
|
||||
'streamers' => $station->getStreamers(),
|
||||
'dj_mount_point' => $be_settings['dj_mount_point'] ?? '/',
|
||||
|
|
|
@ -59,7 +59,7 @@ class Manager implements EventSubscriberInterface
|
|||
public function checkComposeVersion(GetNotifications $event)
|
||||
{
|
||||
// This notification is for full administrators only.
|
||||
if (!$this->acl->userAllowed($event->getCurrentUser(), 'administer all')) {
|
||||
if (!$this->acl->userAllowed($event->getCurrentUser(), Acl::GLOBAL_ALL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ class Manager implements EventSubscriberInterface
|
|||
public function checkUpdates(GetNotifications $event)
|
||||
{
|
||||
// This notification is for full administrators only.
|
||||
if (!$this->acl->userAllowed($event->getCurrentUser(), 'administer all')) {
|
||||
if (!$this->acl->userAllowed($event->getCurrentUser(), Acl::GLOBAL_ALL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class HistoryCleanup extends AbstractTask
|
|||
/** @var Entity\Repository\SettingsRepository $settings_repo */
|
||||
$settings_repo = $this->em->getRepository(Entity\Settings::class);
|
||||
|
||||
$days_to_keep = (int)$settings_repo->getSetting('history_keep_days', Entity\SongHistory::DEFAULT_DAYS_TO_KEEP);
|
||||
$days_to_keep = (int)$settings_repo->getSetting(Entity\Settings::HISTORY_KEEP_DAYS, Entity\SongHistory::DEFAULT_DAYS_TO_KEEP);
|
||||
|
||||
if ($days_to_keep !== 0) {
|
||||
$threshold = (new Chronos())
|
||||
|
|
|
@ -65,7 +65,7 @@ echo $assets->js();
|
|||
</a>
|
||||
</li>
|
||||
<li class="dropdown-divider"> </li>
|
||||
<?php if ($acl->userAllowed($user, 'view administration')): ?>
|
||||
<?php if ($acl->userAllowed($user, \App\Acl::GLOBAL_VIEW)): ?>
|
||||
<li>
|
||||
<a class="dropdown-item" href="<?=$router->named('admin:index:index') ?>">
|
||||
<i class="material-icons" aria-hidden="true">settings</i>
|
||||
|
|
Loading…
Reference in New Issue