-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GTC-2794: Only owner or admin can use mutate dataset endpoints #512
Merged
dmannarino
merged 11 commits into
feature/data_manager
from
gtc_2794_protect_dataset_endpoints
May 9, 2024
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5f250db
Add manager check
jterry64 1954271
Pass user instead of bool flag for authentication check
jterry64 8a602d0
Remove accidental changes
jterry64 97a2ec7
Fix API key changes
jterry64 98808ab
Allow owners and admins to modify/delete datasets
dmannarino 23265cd
Update fixtures to return User objects
jterry64 71d6f46
Update all API key functions to use new interface
jterry64 e5c8e38
Fix making User model for check-auth response
jterry64 ce39e29
Merge remote-tracking branch 'origin/feature/user_role' into gtc_2794…
dmannarino bed9485
Add tests for get_owner
dmannarino 99ebb6a
Add doc for get_owner
dmannarino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
from sqlalchemy import create_engine | ||
from sqlalchemy.orm import Session, sessionmaker | ||
|
||
from app.models.pydantic.authentication import User | ||
from app.settings.globals import ( | ||
AWS_REGION, | ||
DATA_LAKE_BUCKET, | ||
|
@@ -51,8 +52,6 @@ | |
BUCKET = "test-bucket" | ||
PORT = 9000 | ||
|
||
RW_USER_ID = "5874bfcca049b7a56ad42771" # pragma: allowlist secret | ||
|
||
SessionLocal: Optional[Session] = None | ||
|
||
|
||
|
@@ -315,8 +314,16 @@ async def get_api_key_mocked() -> Tuple[Optional[str], Optional[str]]: | |
return str(uuid.uuid4()), "localhost" | ||
|
||
|
||
async def get_rw_user_id() -> str: | ||
return RW_USER_ID | ||
async def get_manager_mocked() -> User: | ||
return User( | ||
id="mr_manager123", | ||
name="Mr. Manager", | ||
email="[email protected]", | ||
createdAt="2021-06-13T03:18:23.000Z", | ||
role="MANAGER", | ||
applications=["data-api"], | ||
extraUserData={}, | ||
) | ||
|
||
|
||
def setup_clients(ec2_client, iam_client): | ||
|
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a """ .... """ comment line describing the function above this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do, thanks! Also, I'm adding more tests.