Index: gotwo.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/gotwo/gotwo.install,v retrieving revision 1.1 diff -u -p -r1.1 gotwo.install --- gotwo.install 4 Jul 2006 18:55:59 -0000 1.1 +++ gotwo.install 30 Oct 2007 17:36:38 -0000 @@ -32,3 +32,20 @@ function gotwo_install() { break; } } + +# update the permissions table, to reflect changes to hook_perm +function gotwo_update_5100() { + $res = db_query("SELECT rid,perm FROM {permission}"); + $perms = array(); + while ($p = db_fetch_object($res)) { + $perm = $p->perm; + $perm = preg_replace('/Administrative Settings/', 'administer gotwo', $perm); + $perm = preg_replace('/view entry list/', 'view gotwo entries', $perm); + $perm = preg_replace('/edit entries/', 'edit gotwo entries', $perm); + $perms[$p->rid] = $perm; + } + + foreach (array_keys($perms) as $rid) { + db_query("UPDATE {permission} SET perm = '%s' WHERE rid = %d", $perms[$rid], $rid); + } +} Index: gotwo.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/gotwo/gotwo.module,v retrieving revision 1.5.2.2 diff -u -p -r1.5.2.2 gotwo.module --- gotwo.module 29 Oct 2007 17:22:12 -0000 1.5.2.2 +++ gotwo.module 30 Oct 2007 17:36:38 -0000 @@ -68,7 +68,7 @@ function gotwo_menu($may_cache) { 'title' => 'Go list', 'path' => 'admin/build/gotwo', 'callback' => '__gotwo_list', - 'access' => user_access('view entry list'), + 'access' => user_access('view gotwo entries'), ); */ $items[] = array( @@ -77,33 +77,33 @@ function gotwo_menu($may_cache) { 'description' => t('Configure URL parameters and disclaimer options'), 'callback' => 'drupal_get_form', 'callback arguments' => array('gotwo_admin_settings'), - 'access' => user_access('Administrative Settings'), + 'access' => user_access('administer gotwo'), ); $items[] = array( 'title' => 'list', 'path' => 'admin/build/gotwo/list', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'access' => user_access('view entry list'), + 'access' => user_access('view gotwo entries'), ); $items[] = array( 'title' => 'add', 'path' => 'admin/build/gotwo/add', 'callback' => '__gotwo_manual_add', 'type' => MENU_LOCAL_TASK, - 'access' => user_access('view entry list'), + 'access' => user_access('view gotwo entries'), ); } else { $items[] = array( 'path' => 'admin/build/gotwo/reset', 'callback' => '__gotwo_reset', - 'access' => user_access('edit entries'), + 'access' => user_access('edit gotwo entries'), 'type' => MENU_CALLBACK ); $items[] = array( 'path' => 'admin/build/gotwo/remove', 'callback' => '__gotwo_remove_page', - 'access' => user_access('edit entries'), + 'access' => user_access('edit gotwo entries'), 'type' => MENU_CALLBACK ); } @@ -111,7 +111,7 @@ function gotwo_menu($may_cache) { } function gotwo_perm() { - return array('view entry list', 'edit entries'); + return array('view gotwo entries', 'edit gotwo entries', 'administer gotwo'); } /** @@ -364,7 +364,7 @@ function __gotwo_list() { array('data' => t('Destination'), 'field' => 'dst'), array('data' => t('Counter'), 'field' => 'cnt', 'sort' => 'desc'), ); - if (user_access('edit entries')) $header[] = array('data' => t('Tools')); + if (user_access('edit gotwo entries')) $header[] = array('data' => t('Tools')); $sql = "SELECT * FROM {gotwo}"; $tablesort = tablesort_sql($header); @@ -380,7 +380,7 @@ function __gotwo_list() { $go->cnt ) ); - if (user_access('edit entries')) $rows[$i]['data'][] = l(t('reset'), 'admin/build/gotwo/reset/'.$go->gid, array('title' => t('Reset the counter'))).' '.l(t('remove'), 'admin/build/gotwo/remove/'.$go->gid); + if (user_access('edit gotwo entries')) $rows[$i]['data'][] = l(t('reset'), 'admin/build/gotwo/reset/'.$go->gid, array('title' => t('Reset the counter'))).' '.l(t('remove'), 'admin/build/gotwo/remove/'.$go->gid); } if (!$rows) {