Commit Graph

108 Commits

Author SHA1 Message Date
059d45b117
patch to require admin APIKey on admin endpoints
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-16 02:19:41 +03:00
39b7d25a57 WIP: enroll device
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-16 02:18:59 +03:00
fc9f1c5c05 file headers
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-16 02:18:43 +03:00
7f90e104d3 sql_app: emergency open time
For some reason, having 3600 set as the
	time for door to stay open in a case of
	fire does not open the door at all.
	Prob a limtiation in door implementation

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-12 21:53:37 +03:00
2c3206fc06
verbose at emerg
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-12 19:56:00 +03:00
b704aee0fc
init_secrets: change file mode when making .env file
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-12 19:34:31 +03:00
99ac2acc0d sql_app: open door on emergency
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-12 19:30:14 +03:00
6a771c589b sql_app: init_db: do not recreate sensor_data and access_log
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-12 12:57:38 +03:00
2c60e14260 sql_app: enforce strict file permissions for .env
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-12 12:52:04 +03:00
21aef6ec6c sql_app: update monitor column
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-11 20:28:39 +03:00
20dfa6dcc4 sql_app: Respond to emergency events record db entry
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-11 18:05:52 +03:00
e1a7c4023b
sql_app: tools: Iot door emulator for testing in absence of door
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-11 17:39:18 +03:00
50a7d8251c
print monitor requests
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-10 21:45:44 +03:00
6ae5b811f4
sql_app: correct monitor mac
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-10 19:11:12 +03:00
21d72f17b2 sql_app: fixed error while setting door state
Old code was taking state from device itself,
	meaning it never changes. Now it is set from
	the incoming request.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-09 22:41:07 +03:00
dcd2ff5b89 sql_app: Split doors and monitors
A alot of interface and database boiler plate

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-09 21:52:42 +03:00
a316374da6 sql_app: remove api key from some functions for testing
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-09 18:21:02 +03:00
a034f17a63 Merge branch 'master' of https://github.com/HeshamTB/ibs
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-08 18:30:09 +03:00
40030c91a1 sql_app: systemd unit file
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-08 18:27:25 +03:00
cdf3a6dfb1 sql_app: implement user activate/deactivate
Previous code now rejects all user authenticated
	endpoints. Even /users/me.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-08 14:37:26 +03:00
35f0e8abb4 sql_app: Use ORM relations for access log requests
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-08 14:31:47 +03:00
6942d4881d sql_app: missing attribute force_close
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-08 14:31:08 +03:00
6a3d9d9e95 sql_app: Use more relations in database
Instead of using manual db lookup for access log,
	use device.access_list to fetch the data from
	access_log table. This does the SQL query underneath.

	To do so, instructions from SQLAlchemey were followed
	to to many-to-one relations for users and devices,
	respectevly.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-08 14:19:27 +03:00
ae5f4e040d sql_app: init_db: added connections and open/close commands
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-08 14:18:43 +03:00
0a4a560ac5 sql_app: fixed errors in room access log endpoints
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-08 13:26:41 +03:00
fdb5be583b sql_app: data: Endpoint to fetch sensor data
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-08 13:01:47 +03:00
c2048d8dba sql_app: User can change password
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-08 12:00:12 +03:00
84db98b6f6
sql_app: Remove hard coded HTTPException codes
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 21:40:01 +03:00
2811b8a5ef
sql_app: update TODO
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 21:29:08 +03:00
b394bd9f2b
hot fix
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 21:14:25 +03:00
4fdd7c231c
sql_app: door: check if valid token on file requests
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 21:09:38 +03:00
b790c6657a
sql_app: door: send actual access_list_counter instead of 0
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 20:15:24 +03:00
0125f3e5fc
sql_app: Add correct door mac
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 20:01:43 +03:00
6f45fc95aa sql_app: remove record_user_connection() due to bug. fix later
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 19:17:32 +03:00
3bcb333df6
sql_app: Added state to Iot Door
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 18:58:23 +03:00
2eed2db77e sql_app: data: collect user connection times
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 16:11:39 +03:00
d9f3a9da4e
sql_app: Introduce force_close flag for Iot Door
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 15:48:28 +03:00
4789b2778c
sql_app: init_db: Added a link (allowance)
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 15:02:33 +03:00
6850823ae8
sql_app: init_db: Add total of 3 users
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 14:54:04 +03:00
2d7ba032a8
encryption: scrapped attempt for BT encryption on esp32
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 14:43:43 +03:00
e45e335d50 sql_app: added init db
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 14:41:48 +03:00
311058f09b sql_app: init_secrets: add new variable for first user password
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 14:41:06 +03:00
01e6c990f7
sql_app: Reorder
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 12:58:56 +03:00
bf14c97cb6
sql_app: main: User access list now includes room sensor data
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-07 12:56:10 +03:00
317b3825c3
helper scripts
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-06 20:07:26 +03:00
7c94abebe5
tests: refactor and added user token tests
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-06 20:03:15 +03:00
1006baa212
sql_app: tests: Add basic unit tests (User Create)
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-06 19:26:48 +03:00
868c97fe73
sql_apps: tests: Add reqs
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-06 18:24:32 +03:00
89f0bc354c sql_app: Added new endpoints to fetch iot dev access list info
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-06 18:17:03 +03:00
80f6c629d4 sql_app: create user now stores new api token
Signed-off-by: HeshamTB <hishaminv@gmail.com>
2022-06-06 18:16:06 +03:00