--- advpoll.module	2009-05-30 19:16:40.000000000 +0200
+++ advpoll.module	2009-11-04 19:51:52.000000000 +0200
@@ -33,7 +33,7 @@ function advpoll_help($path, $arg) {
  * Implementation of hook_perm().
  */
 function advpoll_perm() {
-  return array('create polls', 'edit polls', 'edit own polls', 'vote on polls', 'cancel own vote', 'administer polls', 'inspect all votes', 'access electoral list', 'add write-ins');
+  return array('create polls', 'edit polls', 'edit own polls', 'vote on polls', 'cancel own vote', 'administer polls', 'inspect all votes', 'hide vote results', 'access electoral list', 'add write-ins');
 }
 
 /**
@@ -779,7 +779,12 @@ function advpoll_view($node, $teaser = F
   }
   else {
     // Show results (the user has voted, poll is closed or poll has passed).
-    $poll = advpoll_view_results($node, $teaser, $page);
+    if (!user_access('hide vote results')) {
+      $poll = advpoll_view_results($node, $teaser, $page);
+    }
+    elseif (user_access('cancel own vote')) {
+      $poll = _advpoll_show_cancel_form($node);
+    }
   }
 
   $node->content['poll'] = array(
@@ -1352,7 +1357,12 @@ function _advpoll_vote_response($node, $
     }
 
     list($node->voted, $node->cancel_vote) = _advpoll_user_voted($node->nid);
-    $ajax_output = advpoll_view_results($node, NULL, NULL);
+    if (!user_access('hide vote results')) {
+      $ajax_output = advpoll_view_results($node, NULL, NULL);
+    }
+    elseif (user_access('cancel own vote')) {
+      $ajax_output = _advpoll_show_cancel_form($node);
+    }
     // Remove linebreaks as they will break jQuery's insert-HTML methods.
     $ajax_output = str_replace("\n", '', $ajax_output);
     drupal_set_header('Content-Type: text/plain; charset=utf-8');
