og icon indicating copy to clipboard operation
og copied to clipboard

OgMembershipAccessControlHandler has a fatal error when trying to use JSON:API to create memberships

Open pwolanin opened this issue 1 year ago • 0 comments

\Drupal\og\OgMembershipAccessControlHandler::createAccess() has a fatal error when it's called in any normal way via REST or JSON:API. It only works from the OG UI when called as a route access check from \Drupal\og\Access\OgMembershipAddAccessCheck::access()

The problem resolves around the use of $context['group'] to try to generate a cid when we probably don't even get much advantage from caching this access result (you'd have to be creating multiple in the same page load).

Should probably be resolved by not bothering to try to try to cache. Also possibly get the current group from the OG Context if it's not passed in. Finally, seems like the general goal of this is that the group context and the group the membership is being created for should match - that might need some kind of additional validation constraitnt?

pwolanin avatar Apr 06 '23 19:04 pwolanin