--- hs_taxonomy_old.module	2009-03-20 20:44:54.000000000 +0300
+++ hs_taxonomy.module	2009-06-29 12:09:13.599793257 +0400
@@ -678,11 +678,19 @@
   if (!isset($children[$vid])) {
     $children[$vid] = array();
 
+		$check_perm = FALSE;    
+		if(function_exists('term_permissions_allowed')) {
+			global $user;
+			$check_perm = TRUE;
+		}
+
     $result = db_query(db_rewrite_sql('SELECT t.tid, t.*, parent FROM {term_data} t INNER JOIN  {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d ORDER BY weight, name', 't', 'tid'), $vid);
     while ($term = db_fetch_object($result)) {
-      $children[$vid][$term->parent][] = $term->tid;
-      $parents[$vid][$term->tid][] = $term->parent;
-      $terms[$vid][$term->tid] = $term;
+    	if(!$check_perm || term_permissions_allowed($term->tid, $user)){
+	      $children[$vid][$term->parent][] = $term->tid;
+	      $parents[$vid][$term->tid][] = $term->parent;
+	      $terms[$vid][$term->tid] = $term;
+	    }
     }
   }
 
