mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-20 03:19:24 +02:00
Update context_processors.py
This commit is contained in:
parent
39e6cb8933
commit
dbe438b6dc
1 changed files with 13 additions and 22 deletions
|
@ -60,6 +60,17 @@ def add_has_profile_feature_flag_to_context(request):
|
||||||
|
|
||||||
def portfolio_permissions(request):
|
def portfolio_permissions(request):
|
||||||
"""Make portfolio permissions for the request user available in global context"""
|
"""Make portfolio permissions for the request user available in global context"""
|
||||||
|
context = {
|
||||||
|
"has_base_portfolio_permission": False,
|
||||||
|
"has_domains_portfolio_permission": False,
|
||||||
|
"has_domain_requests_portfolio_permission": False,
|
||||||
|
"has_view_members_portfolio_permission": False,
|
||||||
|
"has_edit_members_portfolio_permission": False,
|
||||||
|
"has_view_suborganization": False,
|
||||||
|
"has_edit_suborganization": False,
|
||||||
|
"portfolio": None,
|
||||||
|
"has_organization_feature_flag": False,
|
||||||
|
}
|
||||||
try:
|
try:
|
||||||
portfolio = request.session.get("portfolio")
|
portfolio = request.session.get("portfolio")
|
||||||
if portfolio:
|
if portfolio:
|
||||||
|
@ -76,28 +87,8 @@ def portfolio_permissions(request):
|
||||||
"portfolio": portfolio,
|
"portfolio": portfolio,
|
||||||
"has_organization_feature_flag": True,
|
"has_organization_feature_flag": True,
|
||||||
}
|
}
|
||||||
return {
|
return context
|
||||||
"has_base_portfolio_permission": False,
|
|
||||||
"has_domains_portfolio_permission": False,
|
|
||||||
"has_domain_requests_portfolio_permission": False,
|
|
||||||
"has_view_members_portfolio_permission": False,
|
|
||||||
"has_edit_members_portfolio_permission": False,
|
|
||||||
"has_view_suborganization": False,
|
|
||||||
"has_edit_suborganization": False,
|
|
||||||
"portfolio": None,
|
|
||||||
"has_organization_feature_flag": False,
|
|
||||||
}
|
|
||||||
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# Handles cases where request.user might not exist
|
# Handles cases where request.user might not exist
|
||||||
return {
|
return context
|
||||||
"has_base_portfolio_permission": False,
|
|
||||||
"has_domains_portfolio_permission": False,
|
|
||||||
"has_domain_requests_portfolio_permission": False,
|
|
||||||
"has_view_members_portfolio_permission": False,
|
|
||||||
"has_edit_members_portfolio_permission": False,
|
|
||||||
"has_view_suborganization": False,
|
|
||||||
"has_edit_suborganization": False,
|
|
||||||
"portfolio": None,
|
|
||||||
"has_organization_feature_flag": False,
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue