You are here

function oa_core_update_7227 in Open Atrium Core 7.2

Fix accidentatly given roles.

File

./oa_core.install, line 279
Provides update and install hooks to oa_core.

Code

function oa_core_update_7227() {

  // NOTE: The original version of this update hook did not remove orphaned
  // entries in the og_role table.  This was added here when update 7232 was
  // added to help users who might not have run 7227 yet.
  // Without this, the DELETE statement below could remove roles from users
  // that had bad entries in the og_role table left over from this issue:
  // https://www.drupal.org/node/2411041
  _oa_core_remove_orphaned_og_roles();

  // Now we can remove user roles that are associated with groups using
  // overridden permissions but having rid values from the default permissions.
  db_query("DELETE FROM {og_users_roles} where gid in (SELECT gid from {og_role} where gid > 0) and rid in (SELECT rid from {og_role} where gid = 0)");
}