#158114970 BUILT new endpoints & applied security using jwt #32
Open
aokilipa wants to merge 3 commits into
Open
#158114970 BUILT new endpoints & applied security using jwt #32aokilipa wants to merge 3 commits into
aokilipa wants to merge 3 commits into
Conversation
| current_user = get_jwt_identity() | ||
| user_id = find_by_username(current_user)[0] | ||
|
|
||
| if user_id == response['requestor']: |
There was a problem hiding this comment.
have a response for a non-existent request instead of just returning an empty list.
| """Modify a request""" | ||
| @jwt_required | ||
| def put(self, req_id): | ||
| """Modify a request""" |
There was a problem hiding this comment.
you aren't checking whether the user is authorised to edit the request
There was a problem hiding this comment.
you also need to check whether the request is already approved by the admin, then it shouldn't be editable.
| if check_admin is True: | ||
| try: | ||
|
|
||
| RM.request_action(self, status,last_modified,request_id) |
There was a problem hiding this comment.
check to see that admin cannot resolve a disapproved request
| from flask_jwt_extended import JWTManager | ||
|
|
||
| config_name = os.getenv('APP_SETTINGS') | ||
| config_name = 'testing'#os.getenv('APP_SETTINGS') |
There was a problem hiding this comment.
why are you defining the config_name variable as testing
Owner
Author
There was a problem hiding this comment.
This was temporary I forgot to undo..
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Have API endpoints protected with JWT and add Approve, Disapprove and Resolve request endpoint
Description of Task to be completed?
Have the following endpoints protected and working:
GET /api/v1/requestPUT /api/v1/requests/<requestId>/approvePUT /api/v1/requests/<requestId>/disapprovePUT /api/v1/requests/<requestId>/resolveHow should this be manually tested?
git clone https://github.com/antokish/Maintenance-Tracker.gitcd Maintenance-Tracker/$ python run.pyhttp://127.0.0.1:5000/api/v1/requestWhat are the relevant pivotal tracker stories?
#158114970
Screenshots
Get all request
Expired Token
Approve request