public function index()
{
// Confirm that the user has at least one of the many admin preferences.
$this->permission(['Garden.Settings.View', 'Garden.Settings.Manage', 'Garden.Community.Manage', 'Garden.Moderation.Manage', 'Moderation.ModerationQueue.Manage', 'Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete', 'Garden.Users.Approve'], false);
// Send the user to the last section they navigated to in the dashboard.
$section = Gdn::session()->getPreference('DashboardNav.DashboardLandingPage', 'DashboardHome');
if ($section) {
$sections = DashboardNavModule::getDashboardNav()->getSectionsInfo();
$url = val('url', val($section, $sections));
if ($url) {
redirect($url);
}
}
// Resolve our default landing page redirection based on permissions.
if (!Gdn::session()->checkPermission(['Garden.Settings.View', 'Garden.Settings.Manage', 'Garden.Community.Manage'], false)) {
// We don't have permission to see the dashboard/home.
redirect(DashboardNavModule::getDashboardNav()->getUrlForSection('Moderation'));
}
// Still here?
redirect('dashboard/settings/home');
}