private AppUserPermissions getAppUserPermissions(final UserRef userRef) {
        final Set<AppPermission> permissions = new HashSet<>(JooqUtil
                .contextResult(securityDbConnProvider, context -> context
                        .select(
                                PERMISSION_APP.PERMISSION_ID)
                        .from(PERMISSION_APP)
                        .where(PERMISSION_APP.USER_UUID.eq(userRef.getUuid()))
                        .fetch())
                .map(r2 -> {
                    final int permissionId = r2.get(PERMISSION_APP.PERMISSION_ID).intValue();
                    final String permissionName = appPermissionIdDao.get(permissionId);
                    return AppPermission.getPermissionForName(permissionName);
                }));
        return new AppUserPermissions(userRef, permissions);
    }
Get application permissions for users plus any that they inherit from their group membership.

@param request The Fetch request.
@return A result page of user permissions.
stroom-security/stroom-security-impl-db/src/main/java/stroom/security/impl/db/AppPermissionDaoImpl.java