mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
Merge branch 'MDL-74216-master' of https://github.com/mihailges/moodle
This commit is contained in:
commit
cb9480841c
@ -45,23 +45,21 @@ class primary extends view {
|
||||
$sitehome = $this->add(get_string('home'), new \moodle_url('/'), self::TYPE_SYSTEM,
|
||||
null, 'home', new \pix_icon('i/home', ''));
|
||||
}
|
||||
if (isloggedin() ) {
|
||||
if (!isguestuser()) {
|
||||
$homepage = get_home_page();
|
||||
if ($homepage == HOMEPAGE_MY || $homepage == HOMEPAGE_MYCOURSES) {
|
||||
// We need to stop automatic redirection.
|
||||
if ($showhomenode) {
|
||||
$sitehome->action->param('redirect', '0');
|
||||
}
|
||||
if (isloggedin() && !isguestuser()) {
|
||||
$homepage = get_home_page();
|
||||
if ($homepage == HOMEPAGE_MY || $homepage == HOMEPAGE_MYCOURSES) {
|
||||
// We need to stop automatic redirection.
|
||||
if ($showhomenode) {
|
||||
$sitehome->action->param('redirect', '0');
|
||||
}
|
||||
}
|
||||
|
||||
// Add the dashboard link.
|
||||
$showmyhomenode = empty($this->page->theme->removedprimarynavitems) ||
|
||||
!in_array('myhome', $this->page->theme->removedprimarynavitems);
|
||||
if ($showmyhomenode) {
|
||||
$this->add(get_string('myhome'), new \moodle_url('/my/'),
|
||||
self::TYPE_SETTING, null, 'myhome', new \pix_icon('i/dashboard', ''));
|
||||
}
|
||||
// Add the dashboard link.
|
||||
$showmyhomenode = empty($this->page->theme->removedprimarynavitems) ||
|
||||
!in_array('myhome', $this->page->theme->removedprimarynavitems);
|
||||
if ($showmyhomenode) {
|
||||
$this->add(get_string('myhome'), new \moodle_url('/my/'),
|
||||
self::TYPE_SETTING, null, 'myhome', new \pix_icon('i/dashboard', ''));
|
||||
}
|
||||
|
||||
// Add the mycourses link.
|
||||
|
@ -61,7 +61,7 @@ class primary_test extends \advanced_testcase {
|
||||
*/
|
||||
public function test_setting_initialise_provider() {
|
||||
return [
|
||||
'Testing as a guest user' => ['guest', ['home', 'courses']],
|
||||
'Testing as a guest user' => ['guest', ['home']],
|
||||
'Testing as an admin' => ['admin', ['home', 'myhome', 'courses', 'siteadminnode']],
|
||||
'Testing as a regular user' => ['user', ['home', 'myhome', 'courses']]
|
||||
];
|
||||
|
@ -54,3 +54,12 @@ Feature: Primary navigation
|
||||
And "Side panel" "button" should exist
|
||||
And I click on "Side panel" "button"
|
||||
And I should see "Home" in the "theme_boost-drawers-primary" "region"
|
||||
|
||||
@theme_boost
|
||||
Scenario: Guest users can only see the Home item in the primary navigation menu
|
||||
Given I log in as "guest"
|
||||
When I am on site homepage
|
||||
Then I should see "Home" in the ".primary-navigation" "css_element"
|
||||
And I should not see "Dashboard" in the ".primary-navigation" "css_element"
|
||||
And I should not see "My courses" in the ".primary-navigation" "css_element"
|
||||
And I should not see "Site administration" in the ".primary-navigation" "css_element"
|
||||
|
Loading…
x
Reference in New Issue
Block a user