Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a way to open the admin settings overview directly #33756

Merged
merged 3 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion apps/settings/lib/Controller/CommonSettingsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,12 @@ private function formatSettings(array $settings): array {
}

private function getIndexResponse($type, $section) {
$this->navigationManager->setActiveEntry('settings');
if ($type === 'personal') {
$this->navigationManager->setActiveEntry('settings');
} elseif ($type === 'admin') {
$this->navigationManager->setActiveEntry('admin_settings');
}

$templateParams = [];
$templateParams = array_merge($templateParams, $this->getNavigationParameters($type, $section));
$templateParams = array_merge($templateParams, $this->getSettings($section));
Expand Down
40 changes: 30 additions & 10 deletions lib/private/NavigationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,37 @@ private function init() {
'icon' => $this->urlGenerator->imagePath('settings', 'apps.svg'),
'name' => $l->t('Apps'),
]);
}

// Personal and (if applicable) admin settings
$this->add([
'type' => 'settings',
'id' => 'settings',
'order' => 2,
'href' => $this->urlGenerator->linkToRoute('settings.PersonalSettings.index'),
'name' => $l->t('Settings'),
'icon' => $this->urlGenerator->imagePath('settings', 'admin.svg'),
]);
// Personal settings
$this->add([
'type' => 'settings',
'id' => 'settings',
'order' => 2,
'href' => $this->urlGenerator->linkToRoute('settings.PersonalSettings.index'),
'name' => $l->t('Personal settings'),
'icon' => $this->urlGenerator->imagePath('settings', 'personal.svg'),
]);

// Admin settings
$this->add([
'type' => 'settings',
'id' => 'admin_settings',
'order' => 3,
'href' => $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'overview']),
'name' => $l->t('Admin settings'),
'icon' => $this->urlGenerator->imagePath('settings', 'admin.svg'),
]);
} else {
// Personal settings
$this->add([
'type' => 'settings',
'id' => 'settings',
'order' => 2,
'href' => $this->urlGenerator->linkToRoute('settings.PersonalSettings.index'),
'name' => $l->t('Settings'),
'icon' => $this->urlGenerator->imagePath('settings', 'admin.svg'),
]);
}

$logoutUrl = \OC_User::getLogoutUrl($this->urlGenerator);
if ($logoutUrl !== '') {
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/access-levels.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Feature: access-levels

Scenario: admin users can see admin-level items on the Settings page
Given I am logged in as the admin
When I visit the settings page
When I visit the admin settings page
Then I see that the "Personal" settings panel is shown
And I see that the "Administration" settings panel is shown
6 changes: 3 additions & 3 deletions tests/acceptance/features/app-files-sharing-link.feature
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Feature: app-files-sharing-link
And I see that the file list contains a file named "farewell.txt"
And I share "farewell.txt" with "user0"
And I see that the file is shared with "user0"
And I visit the settings page
And I visit the admin settings page
And I open the "Sharing" section of the "Administration" group
And I disable resharing
And I see that resharing is disabled
Expand Down Expand Up @@ -209,7 +209,7 @@ Feature: app-files-sharing-link
And I share the link for "farewell.txt"
And I write down the shared link
And I act as John
And I visit the settings page
And I visit the admin settings page
And I open the "Sharing" section of the "Administration" group
And I disable resharing
And I see that resharing is disabled
Expand Down Expand Up @@ -239,7 +239,7 @@ Feature: app-files-sharing-link
And I share the link for "farewell.txt"
And I write down the shared link
And I act as John
And I visit the settings page
And I visit the admin settings page
And I open the "Sharing" section of the "Administration" group
And I disable resharing
And I see that resharing is disabled
Expand Down
8 changes: 4 additions & 4 deletions tests/acceptance/features/app-files-sharing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ Feature: app-files-sharing
And I see that the file list contains a file named "Shared folder"
And I share "Shared folder" with "user0"
And I see that the file is shared with "user0"
When I visit the settings page
When I visit the admin settings page
And I open the "Sharing" section of the "Administration" group
And I disable resharing
And I see that resharing is disabled
Expand All @@ -273,7 +273,7 @@ Feature: app-files-sharing
And I see that the file list contains a file named "Shared folder"
And I share "Shared folder" with "user0"
And I see that the file is shared with "user0"
And I visit the settings page
And I visit the admin settings page
And I open the "Sharing" section of the "Administration" group
And I disable resharing
And I see that resharing is disabled
Expand Down Expand Up @@ -303,7 +303,7 @@ Feature: app-files-sharing
And I open the Files app
And I share "Shared folder" with "user1"
And I act as John
And I visit the settings page
And I visit the admin settings page
And I open the "Sharing" section of the "Administration" group
And I disable resharing
And I see that resharing is disabled
Expand Down Expand Up @@ -336,7 +336,7 @@ Feature: app-files-sharing
And I open the Files app
And I share "Shared folder" with "user1"
And I act as John
And I visit the settings page
And I visit the admin settings page
And I open the "Sharing" section of the "Administration" group
And I disable resharing
And I see that resharing is disabled
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/features/app-files-tags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Feature: app-files-tags

Scenario: create tags using the Administration settings
Given I am logged in as the admin
And I visit the settings page
And I visit the admin settings page
And I open the "Basic settings" section of the "Administration" group
# The "create" button does nothing before JavaScript was initialized, and
# the only way to detect that is waiting for the button to select tags to be
Expand All @@ -32,7 +32,7 @@ Feature: app-files-tags

# Scenario: add tags using the dropdown in the details view
# Given I am logged in as the admin
# And I visit the settings page
# And I visit the admin settings page
# And I open the "Basic settings" section of the "Administration" group
# # The "create" button does nothing before JavaScript was initialized, and
# # the only way to detect that is waiting for the button to select tags to be
Expand Down Expand Up @@ -60,7 +60,7 @@ Feature: app-files-tags
#
# Scenario: remove tags using the dropdown in the details view
# Given I am logged in as the admin
# And I visit the settings page
# And I visit the admin settings page
# And I open the "Basic settings" section of the "Administration" group
# # The "create" button does nothing before JavaScript was initialized, and
# # the only way to detect that is waiting for the button to select tags to be
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/features/app-theming.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature: app-theming

Scenario: changing the color updates the header color
Given I am logged in as the admin
And I visit the settings page
And I visit the admin settings page
And I open the "Theming" section
And I see that the color selector in the Theming app has loaded
# The "eventually" part is not really needed here, as the colour is not
Expand All @@ -16,7 +16,7 @@ Feature: app-theming

Scenario: resetting the color updates the header color
Given I am logged in as the admin
And I visit the settings page
And I visit the admin settings page
And I open the "Theming" section
And I see that the color selector in the Theming app has loaded
And I set the "Color" parameter in the Theming app to "#C9C9C9"
Expand Down
8 changes: 8 additions & 0 deletions tests/acceptance/features/bootstrap/SettingsMenuContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ public function iVisitTheSettingsPage() {
$this->actor->find(self::menuItemFor('Settings'), 2)->click();
}

/**
* @When I visit the admin settings page
*/
public function iVisitTheAdminSettingsPage() {
$this->iOpenTheSettingsMenu();
$this->actor->find(self::menuItemFor('Admin settings'), 2)->click();
}

/**
* @When I log out
*/
Expand Down
7 changes: 4 additions & 3 deletions tests/acceptance/features/header.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ Feature: header
Given I am logged in as the admin
When I open the Settings menu
Then I see that the Settings menu is shown
And I see that the Settings menu has only 7 items
And I see that the Settings menu has only 8 items
And I see that the "Set status" item in the Settings menu is shown
And I see that the "Settings" item in the Settings menu is shown
And I see that the "Personal settings" item in the Settings menu is shown
And I see that the "Admin settings" item in the Settings menu is shown
And I see that the "Apps" item in the Settings menu is shown
And I see that the "Users" item in the Settings menu is shown
And I see that the "Help" item in the Settings menu is shown
Expand All @@ -32,7 +33,7 @@ Feature: header

Scenario: users from other groups are not seen in the contacts menu when autocompletion is restricted within the same group
Given I am logged in as the admin
And I visit the settings page
And I visit the admin settings page
And I open the "Sharing" section of the "Administration" group
And I enable restricting username autocompletion to groups
And I see that username autocompletion is restricted to groups
Expand Down
28 changes: 26 additions & 2 deletions tests/lib/NavigationManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,30 @@ public function providesNavigationConfig() {
'unread' => 0
]
];
$adminSettings = [
'settings' => [
'id' => 'settings',
'order' => 2,
'href' => '/apps/test/',
'icon' => '/apps/settings/img/personal.svg',
'name' => 'Personal settings',
'active' => false,
'type' => 'settings',
'classes' => '',
'unread' => 0
],
'admin_settings' => [
'id' => 'admin_settings',
'order' => 3,
'href' => '/apps/test/',
'icon' => '/apps/settings/img/admin.svg',
'name' => 'Admin settings',
'active' => false,
'type' => 'settings',
'classes' => '',
'unread' => 0
]
];

return [
'minimalistic' => [
Expand Down Expand Up @@ -330,7 +354,7 @@ public function providesNavigationConfig() {
],
'admin' => [
array_merge(
['settings' => $defaults['settings']],
$adminSettings,
$apps,
['test' => [
'id' => 'test',
Expand All @@ -354,7 +378,7 @@ public function providesNavigationConfig() {
],
'no name' => [
array_merge(
['settings' => $defaults['settings']],
$adminSettings,
$apps,
['logout' => $defaults['logout']]
),
Expand Down