You are here

function gmap_macro_builder_update_5100 in GMap Module 5

Rename 'create macro' permission.

File

./gmap_macro_builder.install, line 11
Install / update routines for gmap_macro_builder.

Code

function gmap_macro_builder_update_5100() {
  $ret = array();
  $result = db_query('SELECT rid, perm FROM {permission}');
  while ($row = db_fetch_object($result)) {

    // We leave "create macro" in for now just in case someone else already had that permission.
    // It should get removed automatically the next time an admin tweaks the permissions.
    $permissions = explode(', ', $row->perm);
    if (in_array('create macro', $permissions) && !in_array('create gmap macro', $permissions)) {
      $permissions[] = 'create gmap macro';
    }
    $permissions = implode(', ', $permissions);
    db_query("UPDATE {permission} SET perm = '%s' WHERE rid = %d", $permissions, $row->rid);
  }
  return $ret;
}