0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

refactor(core): fix rls error alert message (#3103)

This commit is contained in:
Gao Sun 2023-02-14 10:34:16 +08:00 committed by GitHub
parent 9c7bd2d0a8
commit 2b7da7b228
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,10 +49,12 @@ export const checkRowLevelSecurity = async (client: QueryClient) => {
and rowsecurity=false
`);
if (rows.some(({ tablename }) => tablename !== Systems.table)) {
const rlsDisabled = rows.filter(({ tablename }) => tablename !== Systems.table);
if (rlsDisabled.length > 0) {
throw new Error(
'Row-level security has to be enforced on EVERY business table when starting Logto.\n' +
`Found following table(s) without RLS: ${rows
`Found following table(s) without RLS: ${rlsDisabled
.map((row) => conditionalString(isKeyInObject(row, 'tablename') && String(row.tablename)))
.join(', ')}\n\n` +
'Did you forget to run `npm cli db multi-tenancy enable`?'