Improve performance of get_permissions when groups are involved.
Improve performance of get_permissions when groups are involved.

lkraav/davical-rss-feature-branch,lkraav/davical-rss-feature-branch,lkraav/davical-rss-feature-branch,lkraav/davical-rss-feature-branch