mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 01:31:12 -05:00
Fix email reply access and threading
This commit is contained in:
@@ -38,12 +38,16 @@ const handler = async (req: Request): Promise<Response> => {
|
||||
return createErrorResponse({ message: 'Unauthorized' }, 401, corsHeaders);
|
||||
}
|
||||
|
||||
// Verify admin role
|
||||
const { data: isAdmin, error: roleError } = await supabase
|
||||
// Verify admin, moderator, or superuser role
|
||||
const { data: isSuperuser } = await supabase
|
||||
.rpc('has_role', { _user_id: user.id, _role: 'superuser' });
|
||||
const { data: isAdmin } = await supabase
|
||||
.rpc('has_role', { _user_id: user.id, _role: 'admin' });
|
||||
const { data: isModerator } = await supabase
|
||||
.rpc('has_role', { _user_id: user.id, _role: 'moderator' });
|
||||
|
||||
if (roleError || !isAdmin) {
|
||||
edgeLogger.warn('Non-admin attempted email reply', {
|
||||
if (!isSuperuser && !isAdmin && !isModerator) {
|
||||
edgeLogger.warn('Non-privileged user attempted email reply', {
|
||||
requestId: tracking.requestId,
|
||||
userId: user.id
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user