feat: version 2.15.0 -- instalador del agente GLPI, filtro de componentes y token recuperable
Instalador .bat generado en el navegador, casilla para ocultar actualizaciones/drivers/componentes en Software, buscador por pestaña en el detalle, GUIDs como componentes y tokens de ingesta cifrados (migraciones 024 y 025). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -27,17 +27,22 @@ export const touchToken = (id) => pool.query('UPDATE inventory_tokens SET last_u
|
||||
|
||||
export async function listTokens() {
|
||||
const [rows] = await pool.query(
|
||||
`SELECT t.id, t.label, t.is_active, t.last_used_at, t.created_at, u.name AS created_by_name
|
||||
`SELECT t.id, t.label, t.is_active, t.last_used_at, t.created_at, u.name AS created_by_name, (t.token_enc IS NOT NULL) AS has_secret
|
||||
FROM inventory_tokens t LEFT JOIN users u ON u.id = t.created_by ORDER BY t.id DESC`
|
||||
);
|
||||
return rows;
|
||||
return rows.map((r) => ({ ...r, has_secret: !!r.has_secret }));
|
||||
}
|
||||
|
||||
export async function createToken(label, hash, userId) {
|
||||
const [r] = await pool.query('INSERT INTO inventory_tokens (label, token_hash, created_by) VALUES (?, ?, ?)', [label, hash, userId]);
|
||||
export async function createToken(label, hash, enc, userId) {
|
||||
const [r] = await pool.query('INSERT INTO inventory_tokens (label, token_hash, token_enc, created_by) VALUES (?, ?, ?, ?)', [label, hash, enc, userId]);
|
||||
return r.insertId;
|
||||
}
|
||||
|
||||
export async function findTokenSecret(id) {
|
||||
const [[row]] = await pool.query('SELECT token_enc FROM inventory_tokens WHERE id = ?', [id]);
|
||||
return row?.token_enc || null;
|
||||
}
|
||||
|
||||
export const setTokenActive = (id, active) => pool.query('UPDATE inventory_tokens SET is_active = ? WHERE id = ?', [active ? 1 : 0, id]);
|
||||
export const deleteToken = (id) => pool.query('DELETE FROM inventory_tokens WHERE id = ?', [id]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user