db: add authzQueryConds helper
Created by: unknwon
This PR is a subset of #13708, which introduces authzQueryConds
helper for composing an AND condition in a SQL query to enforce repository permissions at SQL-level.
This helper is not yet used alone in this PR, please see #13708 with full design and detail.
Part of #11767 (closed)