You are here

function _vppr_access_vocabulary in Vocabulary Permissions Per Role 6

VPPR's access callback for vocabularies (add and reorder terms).

1 call to _vppr_access_vocabulary()
_vppr_page_taxonomy_overview in ./vppr.module
Page callback for taxonomy overview.
1 string reference to '_vppr_access_vocabulary'
vppr_menu_alter in ./vppr.module
Implementation of hook_menu_alter().

File

./vppr.module, line 52
Vocabulary Permissions Per Role

Code

function _vppr_access_vocabulary($vocab) {
  if (user_access('administer taxonomy')) {
    return TRUE;
  }
  global $user;
  $perms = variable_get('vppr_perms', array(
    array(),
  ));
  foreach ($user->roles as $rid => $role) {
    if (isset($perms[$vocab->vid]) && isset($perms[$vocab->vid][$rid]) && $perms[$vocab->vid][$rid]) {
      return TRUE;
    }
  }
  return FALSE;
}