--- sidecontent.module	2005-11-25 15:22:52.000000000 +0100
+++ sidecontent.module.new	2005-12-21 16:16:11.000000000 +0100
@@ -33,7 +33,7 @@
 function sidecontent_block($op = 'list', $delta = 0, $edit = array()) {
 
   $edit = $_POST["edit"];
-  
+
   switch ($op) {
     case 'list':
     $blocks[0]['info'] = t('Side content');
@@ -42,8 +42,13 @@
     case 'view':
         // is this a node?
         if (arg(0) != 'node' || !is_numeric(arg(1))) break;
+
         // does user have  access to view node?
         if (!user_access('access side content') && !user_access('create side content')) break;
+
+        //does current user have view access on parent node?
+        if (!node_access('view',node_load(arg(1)) )) break;
+
         // Preview ?
         if ($edit['format_sidecontent']) {
         $sidecontent->format = $edit['format_sidecontent'];
@@ -58,28 +63,28 @@
           return $block;
         }
         break;
-      
+
     case 'configure':
       $output = form_textfield(t('Block Title'), 'sidecontent_title', variable_get('sidecontent_title', NULL), 50, 64, t('Leave blank to not display a title.'));
       return $output;
-      
+
     case 'save':
         if (!user_access('create side content')) break;
         $edit['sidecontent_title'] = trim($edit['sidecontent_title']);
         variable_set('sidecontent_title', $edit['sidecontent_title']);
       break;
   }
-    
+
 }
 
 
 
 function sidecontent_nodeapi(&$node, $op, $teaser, $page) {
-    
+
     if (!user_access('create side content')) return;
- 
+
     switch ($op) {
-        case 'settings': 
+        case 'settings':
             return form_radios(t('Side content'), 'sidecontent_'. $node->type, variable_get('sidecontent_'. $node->type, 1), array(t('Disabled'), t('Enabled')));
         case 'load':
             if (!variable_get('sidecontent_'. $node->type, 1)) break;
@@ -98,7 +103,7 @@
             $output = form_textarea(t("Text" ), "sidecontent", $node->sidecontent, 60, 20);
             $output .= filter_form('format_sidecontent', $node->format_sidecontent);
             $output = form_group(t('Side Content'), $output, t('Content to display in side block.'));
-            return $output;  
+            return $output;
         case 'validate':
             if (!variable_get('sidecontent_'. $node->type, 1)) break;
             $node->sidecontent = rtrim($node->sidecontent);
