Browse Source

Fixed bug with node permissions

Stephen Ficklin 9 years ago
parent
commit
9d6642b1fc

+ 1 - 1
legacy/tripal_analysis/includes/tripal_analysis.chado_node.inc

@@ -618,7 +618,7 @@ function chado_analysis_load($nodes) {
  *
  * @ingroup tripal_analysis
  */
-function chado_analysis_node_access($node, $op, $account) {
+function tripal_analysis_node_access($node, $op, $account) {
 
   $node_type = $node;
   if (is_object($node)) {

+ 1 - 1
legacy/tripal_contact/includes/tripal_contact.chado_node.inc

@@ -317,7 +317,7 @@ function chado_contact_validate($node, $form, &$form_state) {
  *
  * @ingroup tripal_contact
  */
-function chado_contact_node_access($node, $op, $account ) {
+function tripal_contact_node_access($node, $op, $account ) {
 
   $node_type = $node;
   if (is_object($node)) {

+ 1 - 1
legacy/tripal_example/includes/tripal_example.chado_node.inc

@@ -70,7 +70,7 @@ function tripal_example_node_info() {
  * value is TRUE then access is granted regardless of any other rules that might
  * be implemented by other modules.
  */
-function chado_example_node_access($node, $op, $account) {
+function tripal_example_node_access($node, $op, $account) {
   $node_type = $node;
   if (is_object($node)) {
     $node_type = $node->type;

+ 1 - 1
legacy/tripal_feature/includes/tripal_feature.chado_node.inc

@@ -370,7 +370,7 @@ function chado_feature_validate($node, $form, &$form_state) {
  *
  * @ingroup tripal_feature
  */
-function chado_feature_node_access($node, $op, $account) {
+function tripal_feature_node_access($node, $op, $account) {
   $node_type = $node;
   if (is_object($node)) {
     $node_type = $node->type;

+ 2 - 2
legacy/tripal_featuremap/includes/tripal_featuremap.chado_node.inc

@@ -172,7 +172,7 @@ function chado_featuremap_validate($node, $form, &$form_state) {
   if ($node->unittype_id == 0) {
     form_set_error('unittype_id', 'Please provide a unit type for this map.');
   }
-  
+
   // trim white space from text fields
   $node->fmapname = property_exists($node, 'fmapname') ? trim($node->fmapname) : '';
 
@@ -221,7 +221,7 @@ function chado_featuremap_validate($node, $form, &$form_state) {
  *
  * @ingroup tripal_featuremap
  */
-function chado_featuremap_node_access($node, $op, $account) {
+function tripal_featuremap_node_access($node, $op, $account) {
   $node_type = $node;
   if (is_object($node)) {
     $node_type = $node->type;

+ 1 - 1
legacy/tripal_library/includes/tripal_library.chado_node.inc

@@ -485,7 +485,7 @@ function chado_library_delete(&$node) {
  *
  * @ingroup tripal_library
  */
-function chado_library_node_access($node, $op, $account) {
+function tripal_library_node_access($node, $op, $account) {
   $node_type = $node;
   if (is_object($node)) {
     $node_type = $node->type;

+ 1 - 1
legacy/tripal_organism/includes/tripal_organism.chado_node.inc

@@ -61,7 +61,7 @@ function tripal_organism_node_info() {
  *
  * @ingroup tripal_organism
  */
-function chado_organism_node_access($node, $op, $account) {
+function tripal_organism_node_access($node, $op, $account) {
   $node_type = $node;
   if (is_object($node)) {
     $node_type = $node->type;

+ 1 - 1
legacy/tripal_project/includes/tripal_project.chado_node.inc

@@ -445,7 +445,7 @@ function chado_project_load($nodes) {
  *
  * @ingroup tripal_project
  */
-function chado_project_node_access($node, $op, $account) {
+function tripal_project_node_access($node, $op, $account) {
 
   $node_type = $node;
   if (is_object($node)) {

+ 5 - 5
legacy/tripal_pub/includes/tripal_pub.chado_node.inc

@@ -541,7 +541,7 @@ function chado_pub_validate_check_duplicate($title, $pyear, $series_name, $cvter
  *
  * @ingroup tripal_pub
  */
-function chado_pub_node_access($node, $op, $account) {
+function tripal_pub_node_access($node, $op, $account) {
   $node_type = $node;
   if (is_object($node)) {
     $node_type = $node->type;
@@ -549,23 +549,23 @@ function chado_pub_node_access($node, $op, $account) {
 
   if($node_type == 'chado_pub') {
     if ($op == 'create') {
-      if (!user_access('create chado_pub', $account)) {
+      if (!user_access('create chado_pub content', $account)) {
         return NODE_ACCESS_DENY;
       }
       return NODE_ACCESS_ALLOW;
     }
     if ($op == 'update') {
-      if (!user_access('edit chado_pub', $account)) {
+      if (!user_access('edit chado_pub content', $account)) {
         return NODE_ACCESS_DENY;
       }
     }
     if ($op == 'delete') {
-      if (!user_access('delete chado_pub', $account)) {
+      if (!user_access('delete chado_pub content', $account)) {
         return NODE_ACCESS_DENY;
       }
     }
     if ($op == 'view') {
-      if (!user_access('access chado_pub', $account)) {
+      if (!user_access('access chado_pub content', $account)) {
         return NODE_ACCESS_DENY;
       }
     }

+ 27 - 20
legacy/tripal_stock/tripal_stock.module

@@ -207,32 +207,39 @@ function tripal_stock_permission() {
  *
  * @ingroup tripal_stock
  */
-/*
-function chado_stock_node_access($node, $op, $account) {
-  if ($op == 'create') {
-    if (!user_access('create chado_stock content', $account)) {
-      return FALSE;
-    }
-    return TRUE;
+
+function tripal_stock_node_access($node, $op, $account) {
+  $node_type = $node;
+  if (is_object($node)) {
+    $node_type = $node->type;
   }
-  if ($op == 'update') {
-    if (!user_access('edit chado_stock content', $account)) {
-      return FALSE;
+
+  if($node_type == 'chado_stock') {
+    if ($op == 'create') {
+      if (!user_access('create chado_stock content', $account)) {
+        return NODE_ACCESS_DENY;
+      }
+      return NODE_ACCESS_ALLOW;
     }
-  }
-  if ($op == 'delete') {
-    if (!user_access('delete chado_stock content', $account)) {
-      return FALSE;
+    if ($op == 'update') {
+      if (!user_access('edit chado_stock content', $account)) {
+        return NODE_ACCESS_DENY;
+      }
     }
-  }
-  if ($op == 'view') {
-    if (!user_access('access chado_stock content', $account)) {
-      return FALSE;
+    if ($op == 'delete') {
+      if (!user_access('delete chado_stock content', $account)) {
+        return NODE_ACCESS_DENY;
+      }
     }
+    if ($op == 'view') {
+      if (!user_access('access chado_stock content', $account)) {
+        return NODE_ACCESS_DENY;
+      }
+    }
+    return NODE_ACCESS_IGNORE;
   }
-  return NULL;
 }
-*/
+
 /**
  * Implements hook_views_api().
  *