utils: add is_portal_agent function (#58851)
This commit is contained in:
parent
75a5bac20a
commit
c7530e8813
|
@ -57,6 +57,7 @@ from combo.data.utils import (
|
|||
import_site_tar,
|
||||
)
|
||||
from combo.urls_utils import staff_required
|
||||
from combo.utils.misc import is_portal_agent
|
||||
|
||||
from .forms import (
|
||||
CellVisibilityForm,
|
||||
|
@ -862,13 +863,8 @@ def menu_json(request):
|
|||
else:
|
||||
label = _('Content Management')
|
||||
|
||||
slug = 'portal'
|
||||
if getattr(settings, 'KNOWN_SERVICES') and 'combo' in settings.KNOWN_SERVICES:
|
||||
# switch to custom slug if the site is the portal agent.
|
||||
for service in settings.KNOWN_SERVICES['combo'].values():
|
||||
if service.get('is-portal-agent') and not service.get('secret'):
|
||||
slug = 'portal-agent'
|
||||
break
|
||||
# use a custom slug if the site is the portal agent.
|
||||
slug = 'portal-agent' if is_portal_agent() else 'portal'
|
||||
|
||||
json_str = json.dumps(
|
||||
[
|
||||
|
|
|
@ -56,3 +56,11 @@ def is_url_from_known_service(url):
|
|||
if not netloc:
|
||||
return True
|
||||
return bool(get_known_service_for_url(url))
|
||||
|
||||
|
||||
def is_portal_agent():
|
||||
if getattr(settings, 'KNOWN_SERVICES') and 'combo' in settings.KNOWN_SERVICES:
|
||||
for service in settings.KNOWN_SERVICES['combo'].values():
|
||||
if service.get('is-portal-agent') and not service.get('secret'):
|
||||
return True
|
||||
return False
|
||||
|
|
Loading…
Reference in New Issue