diff --git a/admin/nginx.conf b/admin/nginx.conf index f238d80f..1de6c8a0 100644 --- a/admin/nginx.conf +++ b/admin/nginx.conf @@ -46,7 +46,7 @@ http { } location /api { - proxy_pass http://192.168.1.6:8000/; + proxy_pass http://127.0.0.1:8000/; proxy_connect_timeout 75; proxy_read_timeout 600; send_timeout 600; diff --git a/myems-api/MyEMS.postman_collection.json b/myems-api/MyEMS.postman_collection.json index 23bc36c9..0639ac50 100644 --- a/myems-api/MyEMS.postman_collection.json +++ b/myems-api/MyEMS.postman_collection.json @@ -1315,7 +1315,7 @@ }, { "key": "Token", - "value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f", + "value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1", "type": "text", "description": "Login to get a valid token" } @@ -1476,7 +1476,7 @@ }, { "key": "Token", - "value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f", + "value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1", "type": "text", "description": "Login to get a valid token" } @@ -4758,7 +4758,7 @@ }, { "key": "Token", - "value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f", + "value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1", "type": "text", "description": "Login to get a valid token" } @@ -4788,7 +4788,7 @@ }, { "key": "Token", - "value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f", + "value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1", "type": "text", "description": "Login to get a valid token" } @@ -4819,7 +4819,7 @@ }, { "key": "Token", - "value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f", + "value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1", "type": "text", "description": "Login to get a valid token" } @@ -4853,19 +4853,19 @@ }, { "key": "Token", - "value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f", + "value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1", "type": "text", "description": "Login to get a valid token" } ], "url": { - "raw": "{{base_url}}/points/2", + "raw": "{{base_url}}/points/11", "host": [ "{{base_url}}" ], "path": [ "points", - "2" + "11" ] } }, @@ -4884,7 +4884,7 @@ }, { "key": "Token", - "value": "ce8adcab80f37322487df375c3e3923e6febbcfb26d2b654a5814db6874f2b072fb40a85199efa725af7f3aa4f490f9cc833422b793fa85266237dc5278dff9f", + "value": "44e05939a3c8a545fef506ca42d51c13fc934af45b57346247697ac0b4797ca30d3d950f54d5e16d51876abc0f48b8b5db4894841b56dbfdb2ac9b8162c4e6d1", "type": "text", "description": "Login to get a valid token" } diff --git a/myems-api/core/point.py b/myems-api/core/point.py index fb7f8eab..2b0913d7 100644 --- a/myems-api/core/point.py +++ b/myems-api/core/point.py @@ -17,6 +17,8 @@ class PointCollection: @staticmethod def on_get(req, resp): + """Handles GET requests""" + access_control(req) cnx = mysql.connector.connect(**config.myems_system_db) cursor = cnx.cursor(dictionary=True) @@ -207,6 +209,8 @@ class PointItem: @staticmethod def on_get(req, resp, id_): + """Handles GET requests""" + access_control(req) if not id_.isdigit() or int(id_) <= 0: raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_POINT_ID') diff --git a/web/nginx.conf b/web/nginx.conf index 39683aaf..e841df22 100644 --- a/web/nginx.conf +++ b/web/nginx.conf @@ -47,7 +47,7 @@ http { } location /api { - proxy_pass http://192.168.1.6:8000/; + proxy_pass http://127.0.0.1:8000/; proxy_connect_timeout 75; proxy_read_timeout 600; send_timeout 600;