--- org.protected_node.module	2008-05-18 17:38:51.000000000 -0700
+++ protected_node.module	2008-05-18 17:38:52.000000000 -0700
@@ -136,7 +136,19 @@ function protected_node_nodeapi(&$node, 
 					if (!$user->uid && variable_get('cache', 0)) {					
 						$GLOBALS['conf']['cache'] = FALSE;
 					}
-		      		
+                                /* Avoid password protection for user 1 */
+                                if ((variable_get('protected_node_user_1_bypass', '0') && ($user->uid == 1))) {
+                                  break;
+                                }
+                                /* Avoid password protection if user's role permits */
+                                $node_roles = variable_get('protected_node_roles', array());
+                                foreach ($user->roles as $u_key => $u_value) {
+                                  foreach ($node_roles as $n_key => $n_value) {
+                                    if ($u_key == $n_value) {
+                                      return;
+                                    }
+                                  }
+                                }
 			      	if ($node->uid !== $user->uid) {	      		
 				      	// If node is protected and not teaser nor page view and not owner of node
 					    if (!isset($_SESSION['_protected_node']['passwords'][$node->nid])) {
@@ -301,6 +313,21 @@ function protected_node_admin_settings()
   	'#default_value' => variable_get('protected_node_info', ''),
 	'#description' => t('You can use node type tokens from the token module if you have installed it previously.'),  	
   );
-  
+
+  $form['protected_node_roles'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Avoid passowrd protection per roles'),
+    '#options' => user_roles(2),
+    '#default_value' => variable_get('protected_node_roles', array()),
+    '#description' => t('User will not required to type password if role is set.')
+  );
+
+  $form['protected_node_user_1_bypass'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('<b>Avoid passowrd protection for user 1</b>'),
+    '#default_value' => variable_get('protected_node_user_1_bypass', 0),
+    '#description' => t('User 1 will not be required to type password.')
+  );
+
   return system_settings_form($form);
-}
\ No newline at end of file
+}
