When removing a user, the system currently iterates over og_role_revoke() causing a hit to the database for each role to be removed - this is not optimal.

CommentFileSizeAuthor
#1 og_role_revoke_all_1846008.patch711 bytesdbehrman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dbehrman’s picture

This is an added function to optimize all role removal in a single database call. It is not implemented in og.module, so it will only be used if called explicitly.

rv0’s picture

I like the idea of grouping this functionality in one function.

Currently we are syncing users and groups/roles to LDAP. Every time a user logs in in it gets synced by adding memberships and removing memberships where needed.
For roles we remove all of them and then re-add them as needed.

amitaibu’s picture

Issue summary: View changes
Status: Active » Needs review

correct status.

rv0’s picture

Status: Needs review » Needs work

- does not adhere to OG 7.x-2.x api (does not have a $group_type function argument)
- is missing rules integration from og_role_revoke

Also, it may be a better solution to re-use og_role_revoke, or adjust it so that it can take both a $rid or an array of $rids as argument.
Less code duplication.