|
@@ -205,29 +205,36 @@ 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;
|
|
|
}
|
|
|
|
|
|
/**
|