| @@ 2543-2554 (lines=12) @@ | ||
| 2540 | cursor.execute(query, (user_uuid, token,)) |
|
| 2541 | row = cursor.fetchone() |
|
| 2542 | ||
| 2543 | if row is None: |
|
| 2544 | cursor.close() |
|
| 2545 | cnx.disconnect() |
|
| 2546 | raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', |
|
| 2547 | description='API.USER_SESSION_NOT_FOUND') |
|
| 2548 | else: |
|
| 2549 | utc_expires = row[0] |
|
| 2550 | if datetime.utcnow() > utc_expires: |
|
| 2551 | cursor.close() |
|
| 2552 | cnx.disconnect() |
|
| 2553 | raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', |
|
| 2554 | description='API.USER_SESSION_TIMEOUT') |
|
| 2555 | # get privilege |
|
| 2556 | query = (" SELECT is_admin, privilege_id " |
|
| 2557 | " FROM tbl_users " |
|
| @@ 669-680 (lines=12) @@ | ||
| 666 | cursor.execute(query, (admin_user_uuid, admin_token,)) |
|
| 667 | row = cursor.fetchone() |
|
| 668 | ||
| 669 | if row is None: |
|
| 670 | cursor.close() |
|
| 671 | cnx.disconnect() |
|
| 672 | raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', |
|
| 673 | description='API.ADMINISTRATOR_SESSION_NOT_FOUND') |
|
| 674 | else: |
|
| 675 | utc_expires = row[0] |
|
| 676 | if datetime.utcnow() > utc_expires: |
|
| 677 | cursor.close() |
|
| 678 | cnx.disconnect() |
|
| 679 | raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', |
|
| 680 | description='API.ADMINISTRATOR_SESSION_TIMEOUT') |
|
| 681 | ||
| 682 | query = (" SELECT name " |
|
| 683 | " FROM tbl_users " |
|
| @@ 556-567 (lines=12) @@ | ||
| 553 | cursor.execute(query, (user_uuid, token,)) |
|
| 554 | row = cursor.fetchone() |
|
| 555 | ||
| 556 | if row is None: |
|
| 557 | cursor.close() |
|
| 558 | cnx.disconnect() |
|
| 559 | raise falcon.HTTPError(falcon.HTTP_404, title='API.NOT_FOUND', |
|
| 560 | description='API.USER_SESSION_NOT_FOUND') |
|
| 561 | else: |
|
| 562 | utc_expires = row[0] |
|
| 563 | if datetime.utcnow() > utc_expires: |
|
| 564 | cursor.close() |
|
| 565 | cnx.disconnect() |
|
| 566 | raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', |
|
| 567 | description='API.USER_SESSION_TIMEOUT') |
|
| 568 | ||
| 569 | query = (" SELECT salt, password " |
|
| 570 | " FROM tbl_users " |
|