issue #21302: Extensions need to consider roles too. Performance tweak.