Log entry & remote inductions implementation #3
Description
Perhaps the "log" implementation could be as follows, with JSON POSTed to a new flask endpoint?
POST /logs/new
{
"machineuid":"machine-uid",
"carduid":"card-uid",
"elapsed":x in seconds
}
The server assumes that the start time is x seconds prior to the submission time, to simplify the node programming (it's expected the Python server will know the time, but it's more of a pain to get time from NTP on the access node).
It would follow that the new permissions (from the induction) would be similar:
POST /permissions/new
{
"machineuid":"machine-uid",
"inductor":"inductor-card-uid",
"inductee":"inductee-card-uid"
}
Where inductor-card-uid is the UID of a card which is canInduct = true and inductee-card-uid is presumably a UID of a card which is canUse = false for the current machine. Return 200 for all OK and inserted, or another status code for a failure? 403, "user cannot induct on this machine" for example.
The python side would create a new entry in the user table if it doesn't exist, with a generic username. Perhaps this can in future be updated from SPACEDATA.