-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(auth): add some common auth resource helpers
- Loading branch information
1 parent
b424f14
commit 0b1da18
Showing
2 changed files
with
39 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
__all__ = [ | ||
"RESOURCE_EVERYTHING", | ||
"build_resource", | ||
] | ||
|
||
# TODO: port Pydantic models from authz instead (when we get pydantic 2) | ||
|
||
|
||
RESOURCE_EVERYTHING = {"everything": True} | ||
|
||
|
||
def build_resource(project: str | None = None, dataset: str | None = None, data_type: str | None = None) -> dict: | ||
if project is None: | ||
return RESOURCE_EVERYTHING | ||
|
||
res = {"project": project} | ||
if dataset: | ||
res["dataset"] = dataset | ||
if data_type: | ||
res["data_type"] = data_type | ||
|
||
return res |
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