Merge pull request #224 from dod-ccpo/fix-unauthorized-error
Handle unauthorized error in workspace context
This commit is contained in:
commit
c7e6d2a894
@ -7,6 +7,7 @@ from flask import (
|
|||||||
url_for,
|
url_for,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from atst.domain.exceptions import UnauthorizedError
|
||||||
from atst.domain.workspaces import Workspaces
|
from atst.domain.workspaces import Workspaces
|
||||||
from atst.domain.projects import Projects
|
from atst.domain.projects import Projects
|
||||||
from atst.forms.new_project import NewProjectForm
|
from atst.forms.new_project import NewProjectForm
|
||||||
@ -19,9 +20,12 @@ bp = Blueprint("workspaces", __name__)
|
|||||||
def workspace():
|
def workspace():
|
||||||
workspace = None
|
workspace = None
|
||||||
if "workspace_id" in http_request.view_args:
|
if "workspace_id" in http_request.view_args:
|
||||||
|
try:
|
||||||
workspace = Workspaces.get(
|
workspace = Workspaces.get(
|
||||||
g.current_user, http_request.view_args["workspace_id"]
|
g.current_user, http_request.view_args["workspace_id"]
|
||||||
)
|
)
|
||||||
|
except UnauthorizedError:
|
||||||
|
pass
|
||||||
return {"workspace": workspace}
|
return {"workspace": workspace}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user