Add authentication, user management, and database migration features

- Implement OAuth 2.0 and PAT authentication methods
- Add user management, roles, and profile functionality
- Add database migrations and admin user scripts
- Update services for authentication and user settings
- Add protected routes and permission hooks
- Update documentation for authentication and database access
This commit is contained in:
2026-01-15 03:20:50 +01:00
parent f3637b85e1
commit 1fa424efb9
70 changed files with 15597 additions and 2098 deletions

61
scripts/open-database.sh Executable file
View File

@@ -0,0 +1,61 @@
#!/bin/bash
# Script to easily open PostgreSQL database
# Usage: ./scripts/open-database.sh [method]
# Methods: psql (default), docker, url
set -e
# Database connection details (from docker-compose.yml)
DB_NAME="cmdb"
DB_USER="cmdb"
DB_PASSWORD="cmdb-dev"
DB_HOST="localhost"
DB_PORT="5432"
# Check if PostgreSQL is running
if ! docker ps | grep -q "postgres"; then
echo "⚠️ PostgreSQL container is not running!"
echo "Start it with: docker-compose up -d postgres"
exit 1
fi
METHOD=${1:-psql}
case $METHOD in
psql)
echo "🔌 Connecting to PostgreSQL database using psql..."
echo "Database: $DB_NAME | User: $DB_USER | Host: $DB_HOST:$DB_PORT"
echo ""
echo "Useful commands:"
echo " \\dt - List all tables"
echo " \\d table_name - Describe a table"
echo " \\q - Quit"
echo ""
PGPASSWORD=$DB_PASSWORD psql -h $DB_HOST -p $DB_PORT -U $DB_USER -d $DB_NAME
;;
docker)
echo "🐳 Connecting to PostgreSQL via Docker exec..."
docker exec -it $(docker ps | grep postgres | awk '{print $1}') psql -U $DB_USER -d $DB_NAME
;;
url)
echo "📋 Connection string:"
echo "postgresql://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME"
echo ""
echo "Use this with:"
echo " - pgAdmin"
echo " - DBeaver"
echo " - TablePlus"
echo " - DataGrip"
echo " - psql: psql 'postgresql://$DB_USER:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME'"
;;
*)
echo "Usage: $0 [psql|docker|url]"
echo ""
echo "Methods:"
echo " psql - Connect using psql command (default)"
echo " docker - Connect via Docker exec"
echo " url - Show connection string for GUI tools"
exit 1
;;
esac