Backported  GEOT-4792 and GEOT-4800 to 10.x

Optimizations to JDBCDataStore ensureAuthorization and related fix to FilterToSQL to correctly encode multiple fids filter combined with other filters