Skip to content

Commit

Permalink
Merge pull request #11 from ncstate-sat/LIBS-27-move-authz-to-checker
Browse files Browse the repository at this point in the history
LIBS-27 load policies
  • Loading branch information
JeremyGibson authored Jul 16, 2024
2 parents 0d876c6 + f4581de commit dc0fccb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions auth_checker/authz/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def authorize(
:param valid: The token validator dependency. Contains the user's account information.
:returns: A boolean indicating whether the user is authorized to perform the action.
"""
authz.enforcer.load_policy()
try:
if not authz.authorize(valid.account.email, resource, action):
raise HTTPException(
Expand All @@ -38,6 +39,7 @@ def get_roles(valid: Annotated[TokenValidator, Depends(TokenValidator)]):
:param valid: The token validator dependency. Contains the user's account information.
:returns: A list of roles assigned to the user.
"""
authz.enforcer.load_policy()
try:
return {"roles": authz.roles_for_user(valid.account.email)}
except AttributeError as ae:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "auth-checker"
version = "2.0.5"
version = "2.0.6"
authors = [
{ name="Ryan Semmler", email="[email protected]" },
{ name="Luc Sanchez", email="[email protected]" },
Expand Down

0 comments on commit dc0fccb

Please sign in to comment.