offline tool: add enable/disable-auditor cmd
.
This commit is contained in:
parent
ac4058df7e
commit
6ee1a994ad
14 changed files with 330 additions and 242 deletions
|
|
@ -308,12 +308,16 @@ module Auditors = struct
|
|||
match last_date_opt with
|
||||
| None ->
|
||||
let+ () = Pg.insert_auditor db_conn v |> unwrap_err_caqti in
|
||||
Logs.info (fun m -> m "enabled auditor");
|
||||
()
|
||||
| Some last_date ->
|
||||
let cmp = Timestamp.compare last_date validity_start |> Option.get in
|
||||
if cmp > 0 then Error "more recent management auditor already present"
|
||||
if cmp > 0 then
|
||||
Error
|
||||
"database has more recent auditor data for this auditor public key"
|
||||
else
|
||||
let+ () = Pg.update_auditor db_conn v |> unwrap_err_caqti in
|
||||
Logs.info (fun m -> m "updated auditor");
|
||||
()
|
||||
|
||||
let jsont = AuditorSetupMessage.jsont
|
||||
|
|
@ -347,7 +351,9 @@ module Auditors_disable = struct
|
|||
| None -> Error "auditor not found"
|
||||
| Some last_date ->
|
||||
let cmp = Timestamp.compare last_date validity_end |> Option.get in
|
||||
if cmp > 0 then Error "more recent management auditor already present"
|
||||
if cmp > 0 then
|
||||
Error
|
||||
"database has more recent auditor data for this auditor public key"
|
||||
else
|
||||
let+ () =
|
||||
Pg.disable_auditor db_conn ~auditor_pub ~change_date:validity_end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue