Get user management page working, add permission checking in more places

This commit is contained in:
2025-03-22 22:27:50 -04:00
parent 03dc119a15
commit f421154c1d
9 changed files with 414 additions and 147 deletions

View File

@@ -1,4 +1,19 @@
const pool = global.pool;
// Get pool from global or create a new one if not available
let pool;
if (typeof global.pool !== 'undefined') {
pool = global.pool;
} else {
// If global pool is not available, create a new connection
const { Pool } = require('pg');
pool = new Pool({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
port: process.env.DB_PORT,
});
console.log('Created new database pool in permissions.js');
}
/**
* Check if a user has a specific permission