skuhl / RobotRemote

0 stars 0 forks source link

Only Allow the Correct Users to View the Control Panel. #50

Closed BinaryFissionGames closed 6 years ago

BinaryFissionGames commented 6 years ago

Currently, any user can view the control panel, so long as there is a free arm. We want to change this so that users can only go on during their approved timeslot. In order to do this, the /ControlPanel.html route will have to be edited substantially. Essentially, though, these steps need to be taken (at a high level view).

  1. Look up the timeslots for the current user.
  2. Check to see if one of the requested ones is currently happening.
  3. If not, redirect, either to an error screen, or to the scheduler page.
  4. If so, call sendClientDetails on the actuator that is associated with the given request. sendClientDetails takes the number of milliseconds that the actuator server should keep the client before booting them, so change this to be the difference between the end of the timeslot and now, in ms.
  5. Set the secret of all the cameras, in the same fashion. As above, they must also be provided with number of ms before kicking the user off.
  6. Send the user the control panel HTML.
GraysonHoward commented 6 years ago

Okay so where I'm at with this right now: set up database calls(they seem to be working), and working on using that to filter people out if they aren't registered for the current time. It is successfully blocking people from entry but it's blocking everyone right now with out writing out any error as to why they're getting blocked...

BinaryFissionGames commented 6 years ago

So, I changed how logging works a bit; Errors log in info.log for right now, because i think the [Error] tag is enough to differentiate messages.

There are errors printing to that file related to SQL. Might want to look into those errors?

GraysonHoward commented 6 years ago

yeah i restarted my computer and got those to show up too I'm wondering if it has something to do with the nested SQL statements? I tested the statements themselves and they seem to be working correctly.

BinaryFissionGames commented 6 years ago

It looked like it was maybe some small problem with passing the ID. I've changed it, and it doesn't seem to be throwing SQL errors anymore. I don't know if it works though, didn't test with a good timeslot.

GraysonHoward commented 6 years ago

Cool I can test that part. Thanks for taking a look at it

GraysonHoward commented 6 years ago

Did everything regarding the original issue done unless there's more to add with this

BinaryFissionGames commented 6 years ago

Sounds good, let's close this issue then.