How to terminate all DB usage of a PostgreSQL user
pg_cancel_backend takes a process id as its argument.
It doesn't care if that comes from you typing it in, or a from a query. 

That makes it possible, albeit quite risky, to combine these two into one: 

SELECT pg_cancel_backend( pid )
FROM pg_stat_activity 
WHERE usename = 'foo_user'
AND state = 'active' ;


OK, this doesn't give you option to escalate the "cancel" to a "terminate", but it might be enough. 

Obviously, inappropriate use of this could cause huge amounts of Trouble. 
Use with caution. 

A better solution might be to not let them into the database in the first place, but that's a little Draconian and rarely a Real World option (no matter how satisfying it is to "slam the door" on a troublemaker). 

The best solution would be to find out why the User is doing what they're doing and improve their process/query to "play" better with everything else that your database is doing.