seed: cuentas existentes como Produccion; htpasswd en sitio; cabecera indigo
This commit is contained in:
parent
84a171ca73
commit
591d70a0db
@ -44,7 +44,16 @@ EQUIPO = [
|
|||||||
("aldair", "Aldair", "Fabricación / ensamble de tarjetas (rol por confirmar)", "fabricacion", ""),
|
("aldair", "Aldair", "Fabricación / ensamble de tarjetas (rol por confirmar)", "fabricacion", ""),
|
||||||
("gibranlp", "Gibran", "Software htracker (monitor)", "software", ""),
|
("gibranlp", "Gibran", "Software htracker (monitor)", "software", ""),
|
||||||
("claude", "Claude", "Asistente de ingeniería", "asistente", ""),
|
("claude", "Claude", "Asistente de ingeniería", "asistente", ""),
|
||||||
|
# Cuentas que ya existían en el sitio (14-oct): Leo las asigna todas a Producción.
|
||||||
|
("abraham", "Abraham", "Producción", "produccion", ""),
|
||||||
|
("eduardo", "Eduardo", "Producción", "produccion", ""),
|
||||||
|
("jacobo", "Jacobo", "Producción", "produccion", ""),
|
||||||
|
("jose", "José", "Producción", "produccion", ""),
|
||||||
|
("juan", "Juan", "Producción", "produccion", ""),
|
||||||
]
|
]
|
||||||
|
# Cualquier otra cuenta del htpasswd que no tenga miembro se da de alta como Producción (regla de Leo, 14-oct).
|
||||||
|
# Excepciones: cuentas que ya no son del equipo (no se crean como miembro).
|
||||||
|
LOGINS_OMITIDOS = {"luz"} # luz = cuenta duplicada de michelle (se borra con htpasswd -D)
|
||||||
|
|
||||||
SITIOS = [
|
SITIOS = [
|
||||||
{"id": "icave", "nombre": "ICAVE", "cliente": "Hutchison Ports", "ubicacion": "Veracruz, Ver.",
|
{"id": "icave", "nombre": "ICAVE", "cliente": "Hutchison Ports", "ubicacion": "Veracruz, Ver.",
|
||||||
@ -216,7 +225,30 @@ def sembrar_equipo(u):
|
|||||||
t["historial"] = [{"quien": u, "cuando": t["creado_en"], "cambio": "miembro sembrado (seed_1013)"}]
|
t["historial"] = [{"quien": u, "cuando": t["creado_en"], "cambio": "miembro sembrado (seed_1013)"}]
|
||||||
backend._guardar_miembro(t)
|
backend._guardar_miembro(t)
|
||||||
n += 1
|
n += 1
|
||||||
return f"equipo: {n} miembros creados, {len(EQUIPO) - n} ya existían (sin crear accesos)"
|
# cuentas del sitio sin miembro -> Producción
|
||||||
|
extra = 0
|
||||||
|
try:
|
||||||
|
lineas = backend._leer_htpasswd() or []
|
||||||
|
except Exception:
|
||||||
|
lineas = []
|
||||||
|
conocidos = {rid for rid, *_ in EQUIPO}
|
||||||
|
for l in lineas:
|
||||||
|
if ":" not in l:
|
||||||
|
continue
|
||||||
|
login = l.split(":", 1)[0].strip().lower()
|
||||||
|
if not login or login in conocidos or login in LOGINS_OMITIDOS:
|
||||||
|
continue
|
||||||
|
if os.path.isfile(backend._ruta_registro(backend.EQUIPO_DIR, login)):
|
||||||
|
continue
|
||||||
|
t, err = backend._miembro_valido({"nombre": login.capitalize(), "rol": "Producción", "area": "produccion", "correo": "", "activo": True})
|
||||||
|
if err:
|
||||||
|
print(" cuenta", login, "->", err); continue
|
||||||
|
t["id"] = login
|
||||||
|
t.update(marca(u))
|
||||||
|
t["historial"] = [{"quien": u, "cuando": t["creado_en"], "cambio": "miembro creado desde la cuenta del sitio (seed_1013; área Producción por regla de Leo)"}]
|
||||||
|
backend._guardar_miembro(t)
|
||||||
|
extra += 1
|
||||||
|
return f"equipo: {n} miembros creados, {len(EQUIPO) - n} ya existían, {extra} cuentas del sitio dadas de alta como Producción (sin crear accesos)"
|
||||||
|
|
||||||
|
|
||||||
def completar_responsables(u):
|
def completar_responsables(u):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user