Complete operator and customer workflows for Coulobre 0.12
This commit is contained in:
1 parent
4b60663821
commit
5bddcd5512
72 files changed
+2674
-215
No files matched your search
@@ -50,18 +50,31 @@ def can_manage_hosting(user, permissions):
|
||||
)
|
||||
|
||||
|
||||
def owns_customer_operations(user, account):
|
||||
customer = customer_for_user(user)
|
||||
if customer is not None:
|
||||
return account.customer_id == customer.pk
|
||||
return not is_tenant(user) and account.customer_id is None
|
||||
|
||||
|
||||
def panel_access(request):
|
||||
customer = customer_for_user(request.user) is not None
|
||||
reseller = not customer and reseller_for_user(request.user) is not None
|
||||
from .workspaces import CUSTOMER_ACCOUNT, groups_for, workspace_accounts
|
||||
from .workspaces import (
|
||||
CUSTOMER_ACCOUNT,
|
||||
active_navigation,
|
||||
groups_for,
|
||||
workspace_accounts,
|
||||
)
|
||||
|
||||
operator = request.user.is_authenticated and not (customer or reseller)
|
||||
groups = groups_for(request, customer=customer, manager=reseller)
|
||||
active_link = active_navigation(request, customer=customer)
|
||||
current = next(
|
||||
(
|
||||
label
|
||||
for label, links in groups
|
||||
if any(url == request.path for url, _ in links)
|
||||
if any(url == active_link for url, _ in links)
|
||||
),
|
||||
"",
|
||||
)
|
||||
@@ -82,6 +95,7 @@ def panel_access(request):
|
||||
"is_operator": operator,
|
||||
"navigation_groups": groups,
|
||||
"open_workspace_group": current,
|
||||
"active_navigation_link": active_link,
|
||||
"workspace_accounts": available if len(available) > 1 else [],
|
||||
"workspace_selected": selected,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user