array('administrator', 'editor'), ); $path_alias = drupal_get_path_alias($_GET['q']); global $user; foreach ($restrictions as $path => $roles) { // See if the current path matches any of the patterns provided. if (drupal_match_path($path_alias, $path)) { // It matches, check the current user has any of the required roles $valid = FALSE; foreach ($roles as $role) { if (in_array($role, $user->roles)) { $valid = TRUE; break; } } if (!$valid) { drupal_goto('access-denied'); // Or whatever the URL is for your site's access denied/403 page. } } } } ?>