I noticed a (static?) caching issue in \Drupal\group\Access\ChainGroupPermissionCalculator(). After I retrieved a user's permissions with `\Drupal\group\Access\ChainGroupPermissionCalculator::calculatePermissions()` then it did not matter which user I passed to the method, it always returned the same result.

caching isuse

On the attached screenshot you can see that first I tried to retrieve all permissions of User 4, then User 1, but I got the same result, although it should have been different. Even the "user:4" cache tag is the same on the returned result.

Installed version: 8.x-1.x-dev b41ee99bb.

Comments

mxr576 created an issue. See original summary.

mxr576’s picture

mxr576’s picture

Issue summary: View changes
StatusFileSize
new139.09 KB

Additional context: User 1 is not a member of any existing groups.

mxr576’s picture

Status: Active » Needs review
StatusFileSize
new1.05 KB

Hm... could it be just easy like this? For the first sight, it seems only an account-specific cache key was missing from the cache key for logged in users.

mxr576’s picture

Added test coverage.

kristiaanvandeneynde’s picture

Does this still happen with the latest dev? I just pushed a change to how we calculate permissions for a passed in account.

kristiaanvandeneynde’s picture

Your test-only patch goes green locally. Will commit your extra test coverage if it goes green here :)

kristiaanvandeneynde’s picture

Status: Needs review » Closed (duplicate)

Actually, this should now be properly covered by the tests that use a non-current-user to calculate permissions with. Closing as a duplicate of the issue that spotted this first. Will add you to the credits there.

mxr576’s picture

Thanks! So if I am not mistaken, ^ this issue contained the fix for this problem as well.