Browse Source

fixes hook_node_access hooks and converted featuremap module

spficklin 11 years ago
parent
commit
fa6e8865b4

+ 5 - 5
tripal_contact/tripal_contact.module

@@ -173,7 +173,7 @@ function tripal_contact_theme() {
 /**
  * Implement hook_perm().
  */
-function tripal_contact_perm() {
+function tripal_contact_permissions() {
   return array(
     'access chado_contact content',
     'create chado_contact content',
@@ -188,12 +188,12 @@ function tripal_contact_perm() {
  *
  * This hook allows node modules to limit access to the node types they define.
  *
- *  @param $op
- *  The operation to be performed
- *
  *  @param $node
  *  The node on which the operation is to be performed, or, if it does not yet exist, the
  *  type of node to be created
+ *  
+ *  @param $op
+ *  The operation to be performed
  *
  *  @param $account
  *  A user object representing the user for whom the operation is to be performed
@@ -205,7 +205,7 @@ function tripal_contact_perm() {
  *  return TRUE if the permission is set.
  *
  */
-function chado_contact_access($op, $node, $account ) {
+function chado_contact_node_access($node, $op, $account ) {
   if ($op == 'create') {
     if (!user_access('create chado_contact content', $account)) {
       return FALSE;

+ 17 - 17
tripal_featuremap/includes/tripal_featuremap.admin.inc

@@ -78,7 +78,7 @@ function get_tripal_featuremap_admin_form_taxonomy_set(&$form) {
 
   // iterate through all of the maps
   $lib_boxes = array();
-  while ($featuremap = db_fetch_object($lib_rset)) {
+  while ($featuremap = $lib_rset->fetchObject()) {
     $lib_boxes[$featuremap->featuremap_id] = "$featuremap->name";
   }
 
@@ -123,7 +123,7 @@ function get_tripal_featuremap_admin_form_reindex_set(&$form) {
 
   // iterate through all of the maps
   $lib_boxes = array();
-  while ($featuremap = db_fetch_object($lib_rset)) {
+  while ($featuremap = $lib_rset->fetchObject()) {
     $lib_boxes[$featuremap->featuremap_id] = "$featuremap->name";
   }
   $form['reindex']['description'] = array(
@@ -170,11 +170,11 @@ function get_tripal_featuremap_admin_form_sync_set(&$form) {
   // a message stating that all maps are currently synced.
   $lib_boxes = array();
   $added = 0;
-  while ($featuremap = db_fetch_object($lib_rset)) {
+  while ($featuremap = $lib_rset->fetchObject()) {
     // check to see if the map is already present as a node in drupal.
     // if so, then skip it.
-    $sql = "SELECT * FROM {chado_featuremap} WHERE featuremap_id = %d";
-    if (!db_fetch_object(db_query($sql, $featuremap->featuremap_id))) {
+    $sql = "SELECT * FROM {chado_featuremap} WHERE featuremap_id = :featuremap_id";
+    if (!db_query($sql, array(':featuremap_id' => $featuremap->featuremap_id))->fetchObject()) {
       $lib_boxes[$featuremap->featuremap_id] = "$featuremap->name";
       $added++;
     }
@@ -238,8 +238,8 @@ function tripal_featuremap_admin_validate($form, &$form_state) {
     }
     if ($featuremap_id and preg_match("/^\d+$/i", $featuremap_id)) {
       // get the map info
-      $sql = "SELECT * FROM {featuremap} WHERE featuremap_id = %d";
-      $featuremap = db_fetch_object(chado_query($sql, $featuremap_id));
+      $sql = "SELECT * FROM {featuremap} WHERE featuremap_id = :featuremap_id";
+      $featuremap = chado_query($sql, array(':featuremap_id' => $featuremap_id))->fetchObject();
       $to_sync[$featuremap_id] = $featuremap->name;
     }
   }
@@ -263,8 +263,8 @@ function tripal_featuremap_admin_validate($form, &$form_state) {
     foreach ($featuremaps as $featuremap_id) {
       if ($featuremap_id and preg_match("/^\d+$/i", $featuremap_id)) {
         // get the map info
-        $sql = "SELECT * FROM {featuremap} WHERE featuremap_id = %d";
-        $featuremap = db_fetch_object(chado_query($sql, $featuremap_id));
+        $sql = "SELECT * FROM {featuremap} WHERE featuremap_id = :featuremap_id";
+        $featuremap = chado_query($sql, array(':featuremap_id' => $featuremap_id))->fetchObject();
         $job_args[0] = $featuremap_id;
         tripal_add_job("Reindex features for map: $featuremap->name", 'tripal_featuremap',
          'tripal_featuremap_reindex_features', $job_args, $user->uid);
@@ -279,8 +279,8 @@ function tripal_featuremap_admin_validate($form, &$form_state) {
     foreach ($featuremaps as $featuremap_id) {
       if ($featuremap_id and preg_match("/^\d+$/i", $featuremap_id)) {
         // get the map info
-        $sql = "SELECT * FROM {featuremap} WHERE featuremap_id = %d";
-        $featuremap = db_fetch_object(chado_query($sql, $featuremap_id));
+        $sql = "SELECT * FROM {featuremap} WHERE featuremap_id = :featuremap_id";
+        $featuremap = chado_query($sql, array(':featuremap_id' => $featuremap_id))->fetchObject();
         $job_args[0] = $featuremap_id;
         tripal_add_job("Set taxonomy for features in map: $featuremap->name", 'tripal_featuremap',
          'tripal_featuremap_taxonify_features', $job_args, $user->uid);
@@ -307,24 +307,24 @@ function tripal_featuremap_sync_featuremaps($featuremap_id = NULL, $job_id = NUL
 
   // get the list of featuremaps and create new nodes
   if (!$featuremap_id) {
-    $sql = "SELECT * FROM {featuremap} L";
+    $sql = "SELECT * FROM {featuremap} F";
     $results = chado_query($sql);
   }
   else {
-    $sql = "SELECT * FROM {featuremap} L WHERE featuremap_id = %d";
-    $results = chado_query($sql, $featuremap_id);
+    $sql = "SELECT * FROM {featuremap} F WHERE featuremap_id = :featuremap_id";
+    $results = chado_query($sql, array(':featuremap_id' => $featuremap_id));
   }
 
   // We'll use the following SQL statement for checking if the map
   // already exists as a drupal node.
   $sql = "SELECT * FROM {chado_featuremap} ".
-        "WHERE featuremap_id = %d";
+        "WHERE featuremap_id = :featuremap_id";
 
-  while ($featuremap = db_fetch_object($results)) {
+  while ($featuremap = $results->fetchObject()) {
 
     // check if this map already exists in the drupal database. if it
     // does then skip this map and go to the next one.
-    if (!db_fetch_object(db_query($sql, $featuremap->featuremap_id))) {
+    if (!db_query($sql, array(':featuremap_id' => $featuremap->featuremap_id))->fetchObject()) {
 
     $new_node = new stdClass();
     $new_node->type = 'chado_featuremap';

+ 8 - 8
tripal_featuremap/includes/tripal_featuremap.form.inc

@@ -55,7 +55,7 @@ function chado_featuremap_form($node) {
     ORDER BY CVT.name ASC 
   ";
   $prop_types = chado_query($sql);
-  while ($prop = db_fetch_object($prop_types)) {
+  while ($prop = $prop_types->fetchObject()) {
     $properties_select[$prop->cvterm_id] = $prop->name;
     $properties_list[$prop->cvterm_id] = $prop;
   }
@@ -129,13 +129,13 @@ function chado_featuremap_validate($node, &$form) {
   if ($node->featuremap_id) {
     $sql = "
       SELECT * FROM {featuremap} 
-      WHERE name = '%s' AND NOT featuremap_id = %d
+      WHERE name = :name AND NOT featuremap_id = :featuremap_id
     ";
-    $featuremap = db_fetch_object(chado_query($sql, $node->title, $node->featuremap_id));
+    $featuremap = chado_query($sql, array(':name' => $node->title, ':featurempa_id' => $node->featuremap_id))->fetchObject();
   }
   else {
-    $sql = "SELECT * FROM {featuremap} WHERE name = '%s'";
-    $featuremap = db_fetch_object(chado_query($sql, $node->title));
+    $sql = "SELECT * FROM {featuremap} WHERE name = :name";
+    $featuremap = chado_query($sql, array(':name' => $node->title))->fetchObject();
   }
   if ($featuremap) {
     form_set_error('name', t('The unique map name already exists. Please choose another'));
@@ -326,11 +326,11 @@ function chado_featuremap_node_form_add_featuremapprop_table_props(&$form, $form
     SELECT CVT.cvterm_id, CVT.name, CVT.definition, PP.value, PP.rank
     FROM {featuremapprop} PP
       INNER JOIN {cvterm} CVT on CVT.cvterm_id = PP.type_id
-    WHERE PP.featuremap_id = %d
+    WHERE PP.featuremap_id = :featuremap_id
     ORDER BY CVT.name, PP.rank
   ";
-  $featuremap_props = chado_query($sql, $featuremap_id);
-  while ($prop = db_fetch_object($featuremap_props)) {
+  $featuremap_props = chado_query($sql, array(':featuremap_id' => $featuremap_id));
+  while ($prop = $featuremap_props->fetchObject()) {
 
     $type_id = $prop->cvterm_id;
     $rank = count($d_properties[$type_id]);

+ 3 - 3
tripal_featuremap/tripal_featuremap.info

@@ -1,9 +1,9 @@
 name = Tripal Feature Map
-description = A module for interfacing the GMOD chado database with Drupal, providing viewing, inserting and editing of maps.
-core = 6.x
+description = A module for interfacing the GMOD chado database with Drupal, providing viewing, inserting and editing of maps (e.g. genetic maps).
+core = 7.x
 project = tripal_featuremap
 package = Tripal
-version = 6.x-1.1
+version = 7.x-2.0-beta
 dependencies[] = tripal_core
 dependencies[] = tripal_organism
 dependencies[] = tripal_feature

+ 24 - 67
tripal_featuremap/tripal_featuremap.install

@@ -4,6 +4,24 @@
  * @todo Add file header description
  */
 
+/**
+ * Implementation of hook_requirements().
+ */
+function tripal_featuremap_requirements($phase) {
+  $requirements = array();
+  if ($phase == 'install') {
+    // make sure chado is installed
+    if (!tripal_core_is_chado_installed()) {
+      $requirements ['tripal_featuremap'] = array(
+        'title' => "tripal_featuremap",
+        'value' => "ERROR: Chado most be installed before this module can be enabled",
+        'severity' => REQUIREMENT_ERROR,
+      );
+    }
+  }
+  return $requirements;
+}
+
 /**
  * Implementation of hook_install().
  *
@@ -13,10 +31,6 @@ function tripal_featuremap_install() {
   // create the module's data directory
   tripal_create_moddir('tripal_featuremap');
 
-  // create the tables that correlate drupal nodes with chado
-  // features, maps, etc....
-  drupal_install_schema('tripal_featuremap');
-  
   // add the featuremapprop table to Chado
   tripal_featuremap_add_custom_tables();
   
@@ -25,44 +39,21 @@ function tripal_featuremap_install() {
 
 }
 
-/**
- * Implementation of hook_schema().
- *
- * @ingroup tripal_featuremap
- */
-function tripal_featuremap_schema() {
-  $schema = tripal_featuremap_get_schemas();
-  return $schema;
-}
-
 /**
  * Implementation of hook_uninstall().
  *
  * @ingroup tripal_featuremap
  */
 function tripal_featuremap_uninstall() {
-  drupal_uninstall_schema('tripal_featuremap');
 
-  // Get the list of nodes to remove
-  $sql_lib_id = "SELECT nid, vid ".
-                "FROM {node} ".
-                "WHERE type='chado_featuremap'";
-  $result = db_query($sql_lib_id);
-  while ($node = db_fetch_object($result)) {
-    node_delete($node->nid);
-  }
 }
 
 /**
- * This function simply defines all tables needed for the module to work
- * correctly.  By putting the table definitions in a separate function we
- * can easily provide the entire list for hook_install or individual
- * tables for an update.
+ * Implementation of hook_schema().
  *
  * @ingroup tripal_featuremap
  */
-function tripal_featuremap_get_schemas() {
-  $schema = array();
+function tripal_featuremap_schema() {
   $schema['chado_featuremap'] = array(
     'fields' => array(
       'vid' => array(
@@ -95,23 +86,7 @@ function tripal_featuremap_get_schemas() {
   return $schema;
 }
 
-/**
- * Implementation of hook_requirements(). 
- */
-function tripal_featuremap_requirements($phase) {
-  $requirements = array();
-  if ($phase == 'install') {
-    // make sure chado is installed
-    if (!tripal_core_is_chado_installed()) {
-      $requirements ['tripal_featuremap'] = array(
-            'title' => "tripal_featuremap",
-            'value' => "ERROR: Chado most be installed before this module can be enabled",
-            'severity' => REQUIREMENT_ERROR,
-      );
-    }
-  }
-  return $requirements;
-}
+
 
 /*
  * 
@@ -218,7 +193,7 @@ function tripal_featuremap_add_custom_tables(){
       ),
     ),
   );  
-  tripal_core_create_custom_table($ret, 'featuremapprop', $schema, TRUE);
+  tripal_core_create_custom_table('featuremapprop', $schema, TRUE);
   
   // add the featuremap_dbxref table to Chado
   $schema = array (
@@ -270,7 +245,7 @@ function tripal_featuremap_add_custom_tables(){
     ),
     'referring_tables' => NULL,
   );
-  tripal_core_create_custom_table($ret, 'featuremap_dbxref', $schema, TRUE);
+  tripal_core_create_custom_table('featuremap_dbxref', $schema, TRUE);
   
   $schema = array (
     'table' => 'featureposprop',
@@ -330,23 +305,5 @@ function tripal_featuremap_add_custom_tables(){
       ),
     ),
   );
-  tripal_core_create_custom_table($ret, 'featureposprop', $schema, TRUE);
+  tripal_core_create_custom_table('featureposprop', $schema, TRUE);
 }
-
-/**
- *  Update for Drupal 6.x, Tripal 1.1, FeatureMap Module 1.1
- *  This update adds a new featuremapprop, featureposprop, and featuremap_dbxref tables and 
- *  CV terms for the featuremap_property CV
- *
- */
-function tripal_featuremap_update_6100() {
-
-  tripal_featuremap_add_custom_tables();  
-  tripal_featuremap_add_cvterms();
-   
-  $ret = array(
-    '#finished' => 1,
-  );
-
-  return $ret;
-}

+ 100 - 75
tripal_featuremap/tripal_featuremap.module

@@ -53,7 +53,7 @@ function tripal_featuremap_node_info() {
   $nodes = array();
   $nodes['chado_featuremap'] = array(
       'name' => t('Map'),
-      'module' => 'chado_featuremap',
+      'base' => 'chado_featuremap',
       'description' => t('A feature map from the chado database (e.g. genetic map)'),
       'has_title' => FALSE,
       'title_label' => t('Feature Map'),
@@ -71,13 +71,28 @@ function tripal_featuremap_node_info() {
  *
  * @ingroup tripal_featuremap
  */
-function tripal_featuremap_perm() {
+function tripal_featuremap_permissions() {
   return array(
-    'access chado_featuremap content',
-    'create chado_featuremap content',
-    'delete chado_featuremap content',
-    'edit chado_featuremap content',
-    'administer tripal featuremap',
+    'access chado_featuremap content' => array(
+      'title' => t('View Maps'),
+      'description' => t('Allow users to view map pages.'),
+    ),
+    'create chado_featuremap content' => array(
+      'title' => t('Create Maps'),
+      'description' => t('Allow users to create new map pages.'),
+    ),
+    'delete chado_featuremap content' => array(
+      'title' => t('Delete Maps'),
+      'description' => t('Allow users to delete map pages.'),
+    ),
+    'edit chado_featuremap content' => array(
+      'title' => t('Edit Maps'),
+      'description' => t('Allow users to edit map pages.'),
+    ),
+    'adminster tripal featuremap' => array(
+      'title' => t('Administer Maps'),
+      'description' => t('Allow users to administer all maps.'),
+    ),
   );
 }
 /**
@@ -180,35 +195,6 @@ function tripal_featuremap_views_api() {
   );
 }
 
-
-
-/**
- * Implementation of hook_nodeapi().
- * Display map information for associated features or organisms
- * This function also provides contents for indexing
- *
- * @ingroup tripal_featuremap
- */
-function tripal_featuremap_nodeapi(&$node, $op, $teaser, $page) {
-
-  switch ($op) {
-    // Note that this function only adds map view to an organism/feature
-    // node.
-    case 'view':
-      // add the map to the organism/feature search indexing
-      if ($node->build_mode == NODE_BUILD_SEARCH_INDEX) {
-        $node->content['tripal_featuremap_index_version'] = array(
-          '#value' => theme('tripal_featuremap_search_index', $node),
-        );
-      }
-      elseif ($node->build_mode == NODE_BUILD_SEARCH_RESULT) {
-        $node->content['tripal_featuremap_index_version'] = array(
-          '#value' => theme('tripal_featuremap_search_result', $node),
-        );
-      }
-  }
-}
-
 /**
  *  We need to let drupal know about our theme functions and their arguments.
  *  We create theme functions to allow users of the module to customize the
@@ -257,6 +243,64 @@ function tripal_featuremap_theme() {
   );
 }
 
+/**
+ * @ingroup tripal_library
+ */
+function tripal_featuremap_block_info() {
+
+  $blocks['mapbase']['info'] = t('Tripal Map Details');
+  $blocks['mapbase']['cache'] = BLOCK_NO_CACHE;
+
+  $blocks['mapprops']['info'] = t('Tripal Map Properties');
+  $blocks['mapprops']['cache'] = BLOCK_NO_CACHE;
+  
+  $blocks['mappos']['info'] = t('Tripal Map Features');
+  $blocks['mappos']['cache'] = BLOCK_NO_CACHE;
+  
+  $blocks['mappubs']['info'] = t('Tripal Map Publications');
+  $blocks['mappubs']['cache'] = BLOCK_NO_CACHE;
+
+  $blocks['maprefs']['info'] = t('Tripal Map References');
+  $blocks['maprefs']['cache'] = BLOCK_NO_CACHE;
+    
+  return $blocks;
+}
+/**
+ * @ingroup tripal_library
+ */
+function tripal_featuremap_block_view($delta = '') {
+
+  if (user_access('access chado_library content') and arg(0) == 'node' and is_numeric(arg(1))) {
+    $nid = arg(1);
+    $node = node_load($nid);
+
+    $block = array();
+    switch ($delta) {
+      case 'mapbase':
+        $block['subject'] = t('Library Details');
+        $block['content'] = theme('tripal_featuremap_base', $node);
+        break;
+      case 'mapprops':
+        $block['subject'] = t('Properties');
+        $block['content'] = theme('tripal_featuremap_properties', $node);
+        break;
+      case 'mappos':
+        $block['subject'] = t('Features');
+        $block['content'] = theme('tripal_featuremap_featurepos', $node);
+        break;
+      case 'mappubs':
+        $block['subject'] = t('Publications');
+        $block['content'] = theme('tripal_featuremap_publication', $node);
+        break;
+      case 'maprefs':
+        $block['subject'] = t('References');
+        $block['content'] = theme('tripal_featuremap_references', $node);
+        break;
+      default :
+    }
+    return $block;
+  }
+}
 /**
  * This function is an extension of the chado_feature_view and
  * chado_organism_view by providing the markup for the map object
@@ -279,13 +323,13 @@ function tripal_featuremap_cron() {
  *
  * This hook allows node modules to limit access to the node types they define.
  *
- *  @param $op
- *  The operation to be performed
- *
  *  @param $node
  *  The node on which the operation is to be performed, or, if it does not yet exist, the
  *  type of node to be created
  *
+ *  @param $op
+ *  The operation to be performed
+ *
  *  @param $account
  *  A user object representing the user for whom the operation is to be performed
  *
@@ -297,7 +341,7 @@ function tripal_featuremap_cron() {
  *
  * @ingroup tripal_featuremap
  */
-function tripal_featuremap_map_access($op, $node, $account) {
+function chado_featuremap_node_access($node, $op, $account) {
   if ($op == 'create') {
     if (!user_access('create chado_featuremap content', $account)) {
       return FALSE;
@@ -375,7 +419,7 @@ function chado_featuremap_insert($node) {
       ORDER BY CVT.name ASC 
     ";
     $prop_types = chado_query($sql);
-    while ($prop = db_fetch_object($prop_types)) {
+    while ($prop = $prop_types->fetchObject()) {
       $properties_list[$prop->cvterm_id] = $prop->name;
     }   
   
@@ -441,14 +485,13 @@ function chado_featuremap_insert($node) {
     $featuremap_id = chado_get_id_for_node('featuremap', $node->nid) ;
     if (!$featuremap_id) {
        // next add the item to the drupal table
-      $sql = "INSERT INTO {chado_featuremap} (nid, vid, featuremap_id) VALUES (%d, %d, %d)";
-      db_query($sql, $node->nid, $node->vid, $featuremap['featuremap_id']);
-    }       
+      $sql = "
+        INSERT INTO {chado_featuremap} (nid, vid, featuremap_id) 
+        VALUES (:nid, :vid, :featuremap_id)
+      ";
+      db_query($sql, array(':nid' => $node->nid, ':vid' => $node->vid, ':featuremap_id' => $featuremap['featuremap_id']));
+    }
   }
-
-  
-  
-  
 }
 /**
  * Update nodes
@@ -494,7 +537,7 @@ function chado_featuremap_update($node) {
     ORDER BY CVT.name ASC 
   ";
   $prop_types = chado_query($sql);
-  while ($prop = db_fetch_object($prop_types)) {
+  while ($prop = $prop_types->fetchObject()) {
     $properties_list[$prop->cvterm_id] = $prop->name;
   }
   
@@ -613,32 +656,14 @@ function chado_featuremap_delete(&$node) {
 
   // Remove data from {chado_featuremap}, {node} and {node_revisions} tables of
   // drupal database
-  $sql_del = "DELETE FROM {chado_featuremap} ".
-            "WHERE nid = %d ".
-            "AND vid = %d";
-  db_query($sql_del, $node->nid, $node->vid);
-  $sql_del = "DELETE FROM {node} ".
-            "WHERE nid = %d ".
-            "AND vid = %d";
-  db_query($sql_del, $node->nid, $node->vid);
-  $sql_del = "DELETE FROM {node_revisions} ".
-            "WHERE nid = %d ".
-            "AND vid = %d";
-  db_query($sql_del, $node->nid, $node->vid);
+  $sql_del = "DELETE FROM {chado_featuremap} WHERE nid = :nid AND vid = :vid";
+  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  $sql_del = "DELETE FROM {node} WHERE nid = :nid AND vid = :vid";
+  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
+  $sql_del = "DELETE FROM {node_revisions} WHERE nid = :nid AND vid = :vid";
+  db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
 
   // Remove data from map and mapprop tables of chado database as well
-  chado_query("DELETE FROM {featuremap} WHERE featuremap_id = %d", $featuremap_id);
-  chado_query("DELETE FROM {featuremapprop} WHERE featuremap_id = %d", $featuremap_id);
-}
-
-/*
- *
- */
-function theme_tripal_featuremap_search_result($node) {
-
+  chado_query("DELETE FROM {featuremap} WHERE featuremap_id = :featuremap_id", array(':featuremap_id' => $featuremap_id));
+  chado_query("DELETE FROM {featuremapprop} WHERE featuremap_id = :featuremap_id", array(':featuremap_id' => $featuremap_id));
 }
-
-function tripal_featuremap_form_alter(&$form, &$form_state, $form_id) {
-  if ($form_id == "chado_featuremap_node_form") {
-  }
-}

+ 6 - 42
tripal_library/tripal_library.module

@@ -79,7 +79,7 @@ function tripal_library_permisssions() {
     ),
     'adminster tripal library' => array(
       'title' => t('Administer Libraries'),
-      'description' => t('Allow users to administer all librarys.'),
+      'description' => t('Allow users to administer all libraries.'),
     ),
   );
 }
@@ -87,14 +87,14 @@ function tripal_library_permisssions() {
  * Implement hook_access().
  *
  * This hook allows node modules to limit access to the node types they define.
- *
- *  @param $op
- *  The operation to be performed
- *
+ * 
  *  @param $node
  *  The node on which the operation is to be performed, or, if it does not yet exist, the
  *  type of node to be created
  *
+ *  @param $op
+ *  The operation to be performed
+ *
  *  @param $account
  *  A user object representing the user for whom the operation is to be performed
  *
@@ -106,7 +106,7 @@ function tripal_library_permisssions() {
  *
  * @ingroup tripal_library
  */
-function chado_library_node_access($op, $node, $account) {
+function chado_library_node_access($node, $op, $account) {
   if ($op == 'create') {
     if (!user_access('create chado_library content', $account)) {
       return FALSE;
@@ -377,42 +377,6 @@ function theme_tripal_library_node_libraries($node) {
 function tripal_library_cron() {
 
 }
-/**
- *  The following function proves access control for users trying to
- *  perform actions on data managed by this module
- *
- * @ingroup tripal_library
- */
-function tripal_library_node_access($op, $node, $account) {
-  if ($op == 'create') {
-    if (!user_access('create chado_library content', $account)) {
-      return FALSE;
-    }
-  }
-
-  if ($op == 'update') {
-    if (!user_access('edit any chado_library content', $account) &&
-        !user_access('edit own chado_library content', $account)) {
-        return FALSE;
-    }
-    if (user_access('edit own chado_library content', $account) &&
-      $account->uid != $node->uid) {
-      return FALSE;
-    }
-  }
-
-  if ($op == 'delete') {
-    if (!user_access('delete any chado_library content', $account) &&
-      !user_access('delete own chado_library content', $account)) {
-      return FALSE;
-    }
-    if (user_access('delete own chado_library content', $account) &&
-      $account->uid != $node->uid) {
-      return FALSE;
-    }
-  }
-  return NULL;
-}
 
 
 /**

+ 5 - 5
tripal_pub/tripal_pub.module

@@ -271,14 +271,14 @@ function tripal_pub_perm() {
  * Implement hook_access().
  *
  * This hook allows node modules to limit access to the node types they define.
- *
- *  @param $op
- *  The operation to be performed
- *
+ * 
  *  @param $node
  *  The node on which the operation is to be performed, or, if it does not yet exist, the
  *  type of node to be created
  *
+ *  @param $op
+ *  The operation to be performed
+ *
  *  @param $account
  *  A user object representing the user for whom the operation is to be performed
  *
@@ -289,7 +289,7 @@ function tripal_pub_perm() {
  *  return TRUE if the permission is set.
  *
  */
-function chado_pub_access($op, $node, $account ) {
+function chado_pub_node_access($node, $op, $account ) {
   if ($op == 'create') {
     if (!user_access('create chado_pub content', $account)) {
       return FALSE;

+ 5 - 5
tripal_stock/tripal_stock.module

@@ -188,14 +188,14 @@ function tripal_stock_perm() {
  * Implement hook_access().
  *
  * This hook allows node modules to limit access to the node types they define.
- *
- *  @param $op
- *  The operation to be performed
- *
+ * 
  *  @param $node
  *  The node on which the operation is to be performed, or, if it does not yet exist, the
  *  type of node to be created
  *
+ *  @param $op
+ *  The operation to be performed
+ *
  *  @param $account
  *  A user object representing the user for whom the operation is to be performed
  *
@@ -207,7 +207,7 @@ function tripal_stock_perm() {
  *
  * @ingroup tripal_stock
  */
-function chado_stock_access($op, $node, $account) {
+function chado_stock_node_access($node, $op, $account) {
   if ($op == 'create') {
     if (!user_access('create chado_stock content', $account)) {
       return FALSE;