You are here

vppr.install in Vocabulary Permissions Per Role 7

Same filename and directory in other branches
  1. 6 vppr.install

Vocabulary Permissions Per Role - uninstallation routines.

File

vppr.install
View source
<?php

/**
 * @file
 * Vocabulary Permissions Per Role - uninstallation routines.
 */

/**
 * Turns old-school VPPR permission variable into proper permissions.
 */
function vppr_update_7000() {
  $vocabs = taxonomy_get_vocabularies();
  $roles = user_roles(TRUE);
  $perms = variable_get('vppr_perms', array(
    array(),
  ));
  foreach ($vocabs as $vocab) {
    foreach ($roles as $rid => $role_name) {
      $perm = isset($perms[$vocab->vid]) && isset($perms[$vocab->vid][$rid]) ? $perms[$vocab->vid][$rid] : 0;
      if ($perm) {
        user_role_grant_permissions($rid, array(
          'administer ' . $vocab->machine_name . ' vocabulary terms',
        ));
      }
    }
  }
  variable_del('vppr_perms');
}

Functions

Namesort descending Description
vppr_update_7000 Turns old-school VPPR permission variable into proper permissions.