Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
69 lines
2.2 KiB
Bash
Executable File
69 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
||
set -euo pipefail
|
||
|
||
# Load IP configuration
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
|
||
|
||
|
||
# Fix NPMplus admin user permissions
|
||
|
||
set -e
|
||
|
||
PROXMOX_HOST="${1:-192.168.11.11}"
|
||
CONTAINER_ID="${2:-10233}"
|
||
|
||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||
echo "🔧 Fixing NPMplus Admin Permissions"
|
||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||
echo ""
|
||
|
||
ssh root@"$PROXMOX_HOST" "pct exec $CONTAINER_ID -- docker exec npmplus bash -c '
|
||
# Check if better-sqlite3 is available
|
||
if ! node -e \"require(\\\"better-sqlite3\\\")\" >/dev/null 2>&1; then
|
||
echo \"Installing better-sqlite3...\"
|
||
npm install better-sqlite3 --no-save
|
||
fi
|
||
|
||
# Check current user
|
||
node << EOF
|
||
const Database = require(\"better-sqlite3\");
|
||
const db = new Database(\"/data/database.sqlite\");
|
||
|
||
try {
|
||
const users = db.prepare(\"SELECT * FROM user\").all();
|
||
console.log(\"Current users:\");
|
||
console.log(JSON.stringify(users, null, 2));
|
||
|
||
// Check if admin user exists and has correct permissions
|
||
const admin = users.find(u => u.email === \"admin@example.org\");
|
||
if (admin) {
|
||
console.log(\"\\nAdmin user found:\");
|
||
console.log(\" ID: \" + admin.id);
|
||
console.log(\" Email: \" + admin.email);
|
||
console.log(\" Is Admin: \" + admin.is_admin);
|
||
console.log(\" Enabled: \" + admin.enabled);
|
||
|
||
// Ensure user is admin and enabled
|
||
if (!admin.is_admin || !admin.enabled) {
|
||
console.log(\"\\nFixing admin permissions...\");
|
||
const stmt = db.prepare(\"UPDATE user SET is_admin = 1, enabled = 1 WHERE email = ?\");
|
||
stmt.run(\"admin@example.org\");
|
||
console.log(\"✅ Admin permissions updated\");
|
||
}
|
||
} else {
|
||
console.log(\"\\n⚠️ Admin user not found\");
|
||
}
|
||
} catch (e) {
|
||
console.error(\"Error: \" + e.message);
|
||
}
|
||
|
||
db.close();
|
||
EOF
|
||
'"
|
||
|
||
echo ""
|
||
echo "✅ Permission check complete"
|
||
echo ""
|