Implement RLS and security functions

Apply Row Level Security to orphaned_images and system_alerts tables. Create RLS policies for admin/moderator access. Replace system_health view with get_system_health() function.
This commit is contained in:
gpt-engineer-app[bot]
2025-11-07 01:02:58 +00:00
parent 6bc5343256
commit e747e1f881
6 changed files with 265 additions and 22 deletions

View File

@@ -98,7 +98,7 @@ export const authTestSuite: TestSuite = {
// Test is_superuser() database function
const { data: isSuper, error: superError } = await supabase
.rpc('is_superuser', { _user_id: user.id });
.rpc('is_superuser', { p_user_id: user.id });
if (superError) throw new Error(`is_superuser() failed: ${superError.message}`);
@@ -217,7 +217,7 @@ export const authTestSuite: TestSuite = {
// Test is_user_banned() database function
const { data: isBanned, error: bannedError } = await supabase
.rpc('is_user_banned', { _user_id: user.id });
.rpc('is_user_banned', { p_user_id: user.id });
if (bannedError) throw new Error(`is_user_banned() failed: ${bannedError.message}`);

View File

@@ -220,7 +220,7 @@ export const performanceTestSuite: TestSuite = {
const banStart = Date.now();
const { data: isBanned, error: banError } = await supabase
.rpc('is_user_banned', {
_user_id: userData.user.id
p_user_id: userData.user.id
});
const banDuration = Date.now() - banStart;