You are here

function forum_access_update_6104 in Forum Access 6

Remove grants for roles with the 'administer nodes' permission.

File

./forum_access.install, line 257
Install, update and uninstall functions for the forum_access module.

Code

function forum_access_update_6104() {
  $ret = array();
  if ($admin_rids = array_keys(user_roles(FALSE, 'administer nodes'))) {
    $ret[] = update_sql("\n      UPDATE {forum_access}\n      SET grant_view = 0, grant_update = 0, grant_delete = 0\n      WHERE rid IN (" . implode($admin_rids, ', ') . ")\n    ");
    $ret[] = update_sql("\n      DELETE FROM {node_access}\n      WHERE realm = 'forum_access'\n        AND gid IN (" . implode($admin_rids, ', ') . ")\n    ");
  }
  return $ret;
}