diff --git a/src/web/postgraphile.js b/src/web/postgraphile.js index d7158916..e9056420 100644 --- a/src/web/postgraphile.js +++ b/src/web/postgraphile.js @@ -12,6 +12,12 @@ const { ActorPlugins, SitePlugins, ReleasePlugins } = require('./plugins/plugins const connectionString = `postgres://${config.database.query.user}:${config.database.query.password}@${config.database.query.host}:5432/${config.database.query.database}`; +async function pgSettings(req) { + return { + 'user.id': req.session.user?.id, + }; +} + module.exports = postgraphile( connectionString, 'public', @@ -37,4 +43,5 @@ module.exports = postgraphile( ...ReleasePlugins, ], }, + pgSettings, );