Implemented the possibility ofa hidden user for playstore tests
Some checks failed
Code Analysis and Production Deploy / analyze (push) Failing after 5m40s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Has been skipped

This commit is contained in:
Torsten Schulz (local)
2026-06-09 11:32:00 +02:00
parent 300dce9835
commit 530e544542
11 changed files with 184 additions and 42 deletions

View File

@@ -27,6 +27,28 @@ export function migrateUserRoles(user) {
return user
}
export function normalizeUserEmail(email) {
return String(email || '').trim().toLowerCase()
}
function configuredHiddenUserEmails() {
return [process.env.PLAYSTORE_REVIEW_EMAIL, process.env.HIDDEN_USER_EMAILS]
.filter(Boolean)
.flatMap(value => String(value).split(','))
.map(normalizeUserEmail)
.filter(Boolean)
}
export function isHiddenUser(user) {
if (!user) return false
if (user.hidden === true || user.invisible === true || user.isHidden === true || user.systemAccount === true) return true
if (String(user.accountType || '').toLowerCase() === 'playstore_review') return true
const email = normalizeUserEmail(user.email)
return email ? configuredHiddenUserEmails().includes(email) : false
}
const JWT_SECRET = process.env.JWT_SECRET || 'harheimertc-secret-key-change-in-production'
// Handle both dev and production paths