diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-08-20 01:42:52 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-08-20 01:42:52 +0000 |
commit | ff836870d80f5e1703990e8823bac1e506d96ce1 (patch) | |
tree | d8a28ea8254bd346df068f480396a35078f13cef /modules | |
parent | db7a326d3cbd5c3ea28121b1a0914133273b2b66 (diff) | |
download | brdo-ff836870d80f5e1703990e8823bac1e506d96ce1.tar.gz brdo-ff836870d80f5e1703990e8823bac1e506d96ce1.tar.bz2 |
- Patch #652122 by sun, catch, moshe weitzman, Berdir, mr.baileys, chx, David_Rothstein, Scott Reynolds, Damien Tournoud: fix dashboard as the default /admin local task.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/dashboard/dashboard.module | 24 | ||||
-rw-r--r-- | modules/dashboard/dashboard.test | 6 | ||||
-rw-r--r-- | modules/system/system.module | 3 |
3 files changed, 19 insertions, 14 deletions
diff --git a/modules/dashboard/dashboard.module b/modules/dashboard/dashboard.module index 0ac52f2b6..02f417707 100644 --- a/modules/dashboard/dashboard.module +++ b/modules/dashboard/dashboard.module @@ -29,17 +29,18 @@ function dashboard_menu() { 'title' => 'Dashboard', 'description' => 'View and customize your dashboard', 'page callback' => 'dashboard_admin', - 'access arguments' => array('access administration pages'), + 'access arguments' => array('access dashboard'), + 'type' => MENU_LOCAL_TASK | MENU_NORMAL_ITEM, // Make this appear first, so for example, in admin menus, it shows up on // the top corner of the window as a convinient "home link". - 'weight' => -100, + 'weight' => -15, ); $items['admin/dashboard/customize'] = array( 'title' => 'Dashboard', 'description' => 'View and customize your dashboard', 'page callback' => 'dashboard_admin', 'page arguments' => array(TRUE), - 'access arguments' => array('access administration pages'), + 'access arguments' => array('access dashboard'), 'type' => MENU_CALLBACK, ); $items['admin/dashboard/drawer'] = array( @@ -62,14 +63,17 @@ function dashboard_menu() { } /** - * Implements hook_menu_alter(). + * Implements hook_permission(). */ -function dashboard_menu_alter(&$items) { - // Make the dashboard the default local task on /admin. - $items['admin']['title'] = 'Dashboard'; - $items['admin']['page callback'] = 'dashboard_admin'; - $items['admin/dashboard']['type'] = MENU_DEFAULT_LOCAL_TASK; - $items['admin/by-task']['type'] = MENU_LOCAL_TASK; +function dashboard_permission() { + return array( + 'access dashboard' => array( + 'title' => t('View the administrative dashboard'), + 'description' => t('Customizing the dashboard requires the !permission-name permission.', array( + '!permission-name' => l(t('Administer blocks'), 'admin/people/permissions', array('fragment' => 'module-block')), + )), + ), + ); } /** diff --git a/modules/dashboard/dashboard.test b/modules/dashboard/dashboard.test index 6d9a21e4f..8d7f22296 100644 --- a/modules/dashboard/dashboard.test +++ b/modules/dashboard/dashboard.test @@ -19,7 +19,7 @@ class DashboardAccessTestCase extends DrupalWebTestCase { parent::setUp(); // Create and log in an administrative user having access to the dashboard. - $admin_user = $this->drupalCreateUser(array('access administration pages', 'administer blocks')); + $admin_user = $this->drupalCreateUser(array('access dashboard', 'administer blocks')); $this->drupalLogin($admin_user); // Make sure that the dashboard is using the same theme as the rest of the @@ -46,14 +46,14 @@ class DashboardAccessTestCase extends DrupalWebTestCase { $this->drupalPost('admin/structure/block/add', $custom_block, t('Save block')); // Ensure admin access. - $this->drupalGet('admin'); + $this->drupalGet('admin/dashboard'); $this->assertResponse(200, t('Admin has access to the dashboard.')); $this->assertRaw($custom_block['title'], t('Admin has access to a dashboard block.')); // Ensure non-admin access is denied. $normal_user = $this->drupalCreateUser(); $this->drupalLogin($normal_user); - $this->drupalGet('admin'); + $this->drupalGet('admin/dashboard'); $this->assertResponse(403, t('Non-admin has no access to the dashboard.')); $this->assertNoText($custom_block['title'], t('Non-admin has no access to a dashboard block.')); } diff --git a/modules/system/system.module b/modules/system/system.module index 364feb0e0..d19c02912 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -543,13 +543,14 @@ function system_menu() { 'access arguments' => array('access administration pages'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'file' => 'system.admin.inc', + 'weight' => -20, ); $items['admin/by-module'] = array( 'title' => 'By module', 'page callback' => 'system_admin_by_module', 'access arguments' => array('access administration pages'), 'type' => MENU_LOCAL_TASK, - 'weight' => 2, + 'weight' => -18, 'file' => 'system.admin.inc', ); |