diff --git a/public/tramites/api.php b/public/tramites/api.php index aa7be47..ee95b1b 100644 --- a/public/tramites/api.php +++ b/public/tramites/api.php @@ -369,9 +369,8 @@ try { $tramiteId = (int)$row['tramite_id']; if (!canView($pdo, $tramiteId)) err('No tienes acceso al trámite', 403); - if (!Auth::isSocio() && $row['autor_email'] !== $user['email']) { - err('Solo quien registró las horas (o un Socio/Admin) puede editarlas', 403); - } + // Cualquiera que pueda ver el trámite (creador, abogado solicitante, + // involucrado, o socio/admin) puede editar las horas registradas. $abog = trim((string)($b['abogado'] ?? $row['abogado'])); $hrs = (float) ($b['hrs'] ?? $row['hrs']); @@ -400,9 +399,7 @@ try { $tramiteId = (int)$row['tramite_id']; if (!canView($pdo, $tramiteId)) err('No tienes acceso al trámite', 403); - if (!Auth::isSocio() && $row['autor_email'] !== $user['email']) { - err('Solo quien registró las horas (o un Socio/Admin) puede eliminarlas', 403); - } + // Misma regla que update_hours: cualquiera con acceso al trámite puede eliminar. $pdo->prepare('DELETE FROM tramites_hours WHERE id = :id')->execute([':id' => $hourId]); $pdo->prepare('UPDATE tramites_legales SET actualizado_por = :u WHERE id = :id') diff --git a/views/tramites.html b/views/tramites.html index e974449..c271306 100644 --- a/views/tramites.html +++ b/views/tramites.html @@ -538,14 +538,13 @@ function buildDetail(dept,r){ const obs=(r.obs||[]).map(o=>`
  • ${esc(o.texto)}
    ${esc(o.abogado)} · ${esc(o.fecha)}${o.autor_email?` · ${esc(o.autor_email.split('@')[0])}`:''}
  • `).join(''); const lastUpd=r.obs&&r.obs.length?`
    Última actualización: ${esc(r.obs[r.obs.length-1].fecha)}
    `:''; + // Cualquiera que pueda ver este trámite puede editar/eliminar horas + // (la API valida lo mismo: canView del trámite). const hrs=(r.hours||[]).map(h => { - const canEditHr = IS_SOCIO || h.autor_email === MY_EMAIL; - const actions = canEditHr - ? ` - - - ` - : ''; + const actions = ` + + + `; return `
  • ${esc(h.abogado)} ${fmtHours(h.hrs)} · ${esc(h.fecha)}${actions}