fix: Actualizar con branding de GLM y restringir acceso con Supabase.

This commit is contained in:
2026-06-26 16:20:20 -04:00
parent 4252e524f6
commit 0932ede688
35 changed files with 1059 additions and 285 deletions
+7 -9
View File
@@ -1,5 +1,6 @@
import { useEffect, useState } from "react";
import { supabase } from "@/lib/supabase";
import { getCurrentTableroCdcAccess } from "@/lib/accessControl";
import type { ColorId, Status } from "@/data/lists";
export interface Project {
@@ -178,9 +179,6 @@ type DirectProjectSummaryRow = {
const DEFAULT_COLOR: ColorId = "blue";
const OPEN_STATUS = "Activo";
const GERARDO_EMAIL = "gmarrero@gomezleemarketing.com";
const INTERNAL_PRICING_ALLOWED_EMAILS = [GERARDO_EMAIL, "iaracena@gomezleemarketing.com"];
const DELETE_ALLOWED_EMAILS = [GERARDO_EMAIL, "iaracena@gomezleemarketing.com"];
const DEFAULT_PROJECT_PARAMS: ProjectQueryParams = {
tab: "todos",
search: "",
@@ -478,18 +476,18 @@ async function getCurrentUserId(): Promise<string> {
}
async function currentUserIsGerardo(): Promise<boolean> {
const user = await getCurrentUser();
return user.email?.toLowerCase() === GERARDO_EMAIL;
const access = await getCurrentTableroCdcAccess();
return access.role === "director_creativo";
}
async function currentUserCanManageInternalPricing(): Promise<boolean> {
const user = await getCurrentUser();
return INTERNAL_PRICING_ALLOWED_EMAILS.includes(user.email?.toLowerCase() || "");
const access = await getCurrentTableroCdcAccess();
return access.canManageInternalPricing;
}
async function currentUserCanDeleteProjects(): Promise<boolean> {
const user = await getCurrentUser();
return DELETE_ALLOWED_EMAILS.includes(user.email?.toLowerCase() || "");
const access = await getCurrentTableroCdcAccess();
return access.canDeleteProjects;
}
function toProjectRow(project: Omit<Project, "id" | "createdAt"> | Partial<Project>) {