At the risk of asking a stupid question, is there a way to expose a query to regular users, perhaps with the aid of this plugn? I'm not too sure about the needed credentials and I don't want to make a poor security decision. I think it has been discussed elsewhere here with only a paid solution being outlined, but I'd like to be able to present a list of users ordered by their last activity time, as many traditional forums do. For example, this query provides the desired information:
SELECT username AS "User", (CURRENT_TIMESTAMP - last_seen_at) AS "Last Active"
WHERE last_seen_at IS NOT NULL
AND (CURRENT_TIMESTAMP - last_seen_at < INTERVAL '15' MINUTE)
ORDER BY last_seen_at DESC