You are here

function commons_wikis_user_revision_access in Drupal Commons 7.3

Custom access callback for viewing revision info.

1 string reference to 'commons_wikis_user_revision_access'
commons_wikis_menu_alter in modules/commons/commons_wikis/commons_wikis.module
Implements hook_menu_alter().

File

modules/commons/commons_wikis/commons_wikis.module, line 38

Code

function commons_wikis_user_revision_access($node = NULL, $old_callback = '_node_revision_access') {

  // Only use custom revision access for wikis. Access to other content types
  // should be handled by the standard callback.
  if ($node->type == 'wiki') {

    // The content was posted to specific groups.
    if (isset($node->og_group_ref[LANGUAGE_NONE][0]['target_id'])) {
      return og_user_access('node', $node->og_group_ref[LANGUAGE_NONE][0]['target_id'], 'update any wiki content');
    }
    elseif (isset($node->og_user_group_ref[LANGUAGE_NONE][0]['target_id'])) {
      return og_user_access('user', $node->og_user_group_ref[LANGUAGE_NONE][0]['target_id'], 'update any wiki content');
    }
  }
  return $old_callback($node, 'view');
}