Group account creation links and use consistent package labels

This commit is contained in:
parkel committed 2026-11-24 08:57:25 +01:00
1 parent 1c3ee425d1
commit 287daf5036
31 files changed
+140 -97

No files matched your search

+13 -13
View File
@@ -631,8 +631,8 @@ A verified superuser can assign a Customer or Manager role to an
active login from **Customers** or **Managers**. Choose **Assign active login from **Customers** or **Managers**. Choose **Assign
to existing login** and enter the username. Customer roles use their own to existing login** and enter the username. Customer roles use their own
assigned hosting accounts. Managers use their own hosting account assigned hosting accounts. Managers use their own hosting account
assignments and hosting plan policy. New manager assignments use the default assignments and hosting package policy. New manager assignments use the default
manager profile when one is configured. manager package when one is configured.
Logins with multiple roles can choose **Panel role** in the account area. Logins with multiple roles can choose **Panel role** in the account area.
The role applies to the session, including direct page requests and actions. The role applies to the session, including direct page requests and actions.
@@ -955,7 +955,7 @@ first mailbox adds the signing key's public DKIM record.
## Verify a new installation ## Verify a new installation
Use a test hosting plan, account, and domain for these checks. Enable the Use a test hosting package, account, and domain for these checks. Enable the
local services that the installation will offer before checking them. local services that the installation will offer before checking them.
1. Sign in through the hostname clients will use. Check the HTTPS certificate, 1. Sign in through the hostname clients will use. Check the HTTPS certificate,
@@ -1052,7 +1052,7 @@ to see the latest result. [Website storage measurement](development.md#measure-w
To enforce hard limits, prepare a dedicated ext4 volume with user quotas for To enforce hard limits, prepare a dedicated ext4 volume with user quotas for
the managed sites. Use **Change storage limit** on the deployed account to the managed sites. Use **Change storage limit** on the deployed account to
apply the hosting plan's default or choose a per-site value. apply the hosting package's default or choose a per-site value.
[Website storage quotas](development.md#apply-a-website-storage-limit) [Website storage quotas](development.md#apply-a-website-storage-limit)
### Choose PHP versions for hosted websites ### Choose PHP versions for hosted websites
@@ -1072,7 +1072,7 @@ sudo apt install php8.5-fpm php8.6-fpm
sudo systemctl enable --now php8.5-fpm php8.6-fpm sudo systemctl enable --now php8.5-fpm php8.6-fpm
``` ```
Under **Hosting plans**, enter the **Allowed PHP series** as a comma-separated Under **Hosting packages**, enter the **Allowed PHP series** as a comma-separated
list, such as `8.5, 8.6`. A blank list makes every installed stable series list, such as `8.5, 8.6`. A blank list makes every installed stable series
available. New website activations select the newest installed stable series available. New website activations select the newest installed stable series
in the plan. Each active site retains its recorded series when a package or in the plan. Each active site retains its recorded series when a package or
@@ -1104,7 +1104,7 @@ jobs use their own configured runtimes. Use a versioned command such as
### Configure PHP pool limits per website ### Configure PHP pool limits per website
Under **Hosting plans**, set default PHP memory, upload size, request timeout, Under **Hosting packages**, set default PHP memory, upload size, request timeout,
or PHP-FPM worker limits. The panel captures these values when an operator or PHP-FPM worker limits. The panel captures these values when an operator
first requests local activation. A repeat activation preserves an installed first requests local activation. A repeat activation preserves an installed
pool's settings. pool's settings.
@@ -1157,7 +1157,7 @@ serves no tenant content when unknown hosts should be rejected.
## Host independent websites ## Host independent websites
Set a hosting plan's **Website limit** above one to allow additional Set a hosting package's **Website limit** above one to allow additional
websites under an account. The limit includes the primary website. Existing websites under an account. The limit includes the primary website. Existing
plans start with one website. In **Independent websites**, choose **Add plans start with one website. In **Independent websites**, choose **Add
website** to provision a domain or subdomain with its own document root, website** to provision a domain or subdomain with its own document root,
@@ -2124,7 +2124,7 @@ To locate that file, download the manifest and use the node's `apply` command.
Reapplying the manifest preserves the password and prints the file path. Reapplying the manifest preserves the password and prints the file path.
[Show mailbox connection details in the panel](#show-local-database-and-mailbox-connection-details) [Show mailbox connection details in the panel](#show-local-database-and-mailbox-connection-details)
Set a per-mailbox storage limit on the hosting plan for new mailbox requests. Set a per-mailbox storage limit on the hosting package for new mailbox requests.
Enable Dovecot quota enforcement on the mail node before provisioning them. Enable Dovecot quota enforcement on the mail node before provisioning them.
[Mailbox storage limits](development.md#enforce-mailbox-storage-limits) [Mailbox storage limits](development.md#enforce-mailbox-storage-limits)
@@ -2167,7 +2167,7 @@ smtpd_reject_unlisted_recipient = yes
Run `sudo postfix check` and `sudo postfix reload`. Set Run `sudo postfix check` and `sudo postfix reload`. Set
`COULOBRE_MAIL_ROUTING=1` in `/etc/coulobre/panel.env`. Operators can opt a `COULOBRE_MAIL_ROUTING=1` in `/etc/coulobre/panel.env`. Operators can opt a
hosting plan into catch-all and external forwarding separately. Plan changes hosting package into catch-all and external forwarding separately. Plan changes
are checked when saving the next routing revision. To revoke an active are checked when saving the next routing revision. To revoke an active
forwarder or catch-all, remove the rule and apply the update. forwarder or catch-all, remove the rule and apply the update.
@@ -2689,9 +2689,9 @@ remote receiver, while databases still use the local credential service.
## Set up manager access ## Set up manager access
Open **Managers** to add a manager login or change an existing manager's Open **Managers** to add a manager login or change an existing manager's
panel access, account limit, and allowed hosting plans. The detail page shows panel access, account limit, and allowed hosting packages. The detail page shows
allocated accounts and audit history. Viewing account names and plan details allocated accounts and audit history. Viewing account names and plan details
requires the corresponding hosting account and hosting plan permissions. requires the corresponding hosting account and hosting package permissions.
The account limit and allowed plans apply when a manager creates a hosting The account limit and allowed plans apply when a manager creates a hosting
account. Reducing the limit or removing a plan takes effect on the next account. Reducing the limit or removing a plan takes effect on the next
@@ -2702,8 +2702,8 @@ changes to manager policy and account assignments made through the panel.
### Onboard customers ### Onboard customers
Managers can open **My users** to create a customer login and its first Managers can open **Add User** to create a customer login and its first
hosting account together. Choose an allowed hosting plan and give the hosting account together. Choose an allowed hosting package and give the
customer's email address to send a welcome email with a link to set their customer's email address to send a welcome email with a link to set their
password. Preview the email before creating the account. To add a login password. Preview the email before creating the account. To add a login
for an existing unassigned hosting account, open the account and choose for an existing unassigned hosting account, open the account and choose
+8 -8
View File
@@ -19,11 +19,11 @@ Select **Add hosting account** and enter a name and a primary domain such as
`example.org`. Open an account from the list to edit its details or request an `example.org`. Open an account from the list to edit its details or request an
Apache preview. Manage users, groups, and permissions at `/admin/`. Apache preview. Manage users, groups, and permissions at `/admin/`.
Use **Hosting plans** to add named plans with an optional description. Choose a Use **Hosting packages** to add named plans with an optional description. Choose a
plan when creating or editing an account. Existing accounts start unassigned. plan when creating or editing an account. Existing accounts start unassigned.
Operators need permission to view hosting plans before they can assign one. Operators need permission to view hosting packages before they can assign one.
Set a database limit and a mailbox limit on a hosting plan to cap how many Set a database limit and a mailbox limit on a hosting package to cap how many
requests each assigned account can make through the panel. A blank limit allows requests each assigned account can make through the panel. A blank limit allows
unlimited requests. Zero blocks new requests of that type. Accounts without a unlimited requests. Zero blocks new requests of that type. Accounts without a
plan have unlimited requests. The account page shows usage for configured plan have unlimited requests. The account page shows usage for configured
@@ -39,7 +39,7 @@ Set **Website storage limit (MiB)** to supply the initial value when an
operator applies a website quota from the account page. operator applies a website quota from the account page.
[Apply a website storage limit](#apply-a-website-storage-limit) [Apply a website storage limit](#apply-a-website-storage-limit)
Set optional PHP resource defaults on a hosting plan. Coulobre applies them Set optional PHP resource defaults on a hosting package. Coulobre applies them
on first local activation and when an operator reapplies the plan on the on first local activation and when an operator reapplies the plan on the
account page. See [website PHP settings](deployment.md#configure-php-pool-limits-per-website). account page. See [website PHP settings](deployment.md#configure-php-pool-limits-per-website).
@@ -56,11 +56,11 @@ Then open a hosting account in Coulobre Panel and select the manager when
editing the account. Existing accounts start with no manager assigned. editing the account. Existing accounts start with no manager assigned.
Managers can sign in to Coulobre Panel to see their assigned hosting accounts Managers can sign in to Coulobre Panel to see their assigned hosting accounts
and plans. They can also onboard customers and assign an allowed hosting plan and plans. They can also onboard customers and assign an allowed hosting package
to an existing account. to an existing account.
To let the manager add accounts, set a positive account limit and select the To let the manager add accounts, set a positive account limit and select the
available hosting plans in the manager's admin record. The manager's account available hosting packages in the manager's admin record. The manager's account
list shows their allowance. The limit applies to self-service creation, and list shows their allowance. The limit applies to self-service creation, and
operator assignments also count toward the allowance. New hosting accounts operator assignments also count toward the allowance. New hosting accounts
automatically belong to the manager and require an allowed plan. A limit of automatically belong to the manager and require an allowed plan. A limit of
@@ -83,7 +83,7 @@ should be able to access. To give an existing user customer access, add a
The customer signs in after setting or receiving their password. The customer signs in after setting or receiving their password.
Their account list shows only the hosting accounts assigned to them. Each Their account list shows only the hosting accounts assigned to them. Each
account page shows its hosting plan, database requests, DNS zones, and mailbox account page shows its hosting package, database requests, DNS zones, and mailbox
requests. Customers can request databases and mailboxes for their own accounts requests. Customers can request databases and mailboxes for their own accounts
within their plan limits. Operators deploy those requests on the hosting nodes. within their plan limits. Operators deploy those requests on the hosting nodes.
@@ -1095,7 +1095,7 @@ user quotas are active with
On the local installation, open a deployed hosting account and select On the local installation, open a deployed hosting account and select
**Change storage limit** under **Website storage**. An operator with **Can **Change storage limit** under **Website storage**. An operator with **Can
change site storage limit** can apply the hosting plan's default or enter change site storage limit** can apply the hosting package's default or enter
another value in MiB. Clear the field to remove the space limit. The page another value in MiB. Clear the field to remove the space limit. The page
shows the last confirmed limit and any pending update. shows the last confirmed limit and any pending update.
@@ -51,7 +51,7 @@ class ManagerOnboardingForm(InviteLoginForm):
"primary_domain" "primary_domain"
).formfield(required=True) ).formfield(required=True)
plan = forms.ModelChoiceField( plan = forms.ModelChoiceField(
queryset=HostingPlan.objects.none(), label="Hosting plan" queryset=HostingPlan.objects.none(), label="Hosting package"
) )
manage_dns = forms.BooleanField( manage_dns = forms.BooleanField(
required=False, label="Manage DNS in Coulobre" required=False, label="Manage DNS in Coulobre"
@@ -122,7 +122,7 @@ class ManagerOnboardingView(UserPassesTestMixin, FormView):
form_class = ManagerOnboardingForm form_class = ManagerOnboardingForm
template_name = "hosting/workspace_form.html" template_name = "hosting/workspace_form.html"
extra_context = { extra_context = {
"title": "Add a new user", "title": "Add user",
"submit_label": "Create customer and hosting account", "submit_label": "Create customer and hosting account",
"invitation_preview": True, "invitation_preview": True,
} }
@@ -301,7 +301,7 @@ class OperatorCreateView(OperatorAuthorization, FormView):
template_name = "hosting/workspace_form.html" template_name = "hosting/workspace_form.html"
success_url = reverse_lazy("panel:all_users") success_url = reverse_lazy("panel:all_users")
extra_context = { extra_context = {
"title": "Add an operator", "title": "Add operator",
"submit_label": "Create operator", "submit_label": "Create operator",
} }
@@ -332,7 +332,7 @@ class MoveHostingForm(forms.Form):
) )
confirm = forms.BooleanField( confirm = forms.BooleanField(
required=False, required=False,
label="I reviewed the destination and its hosting plan policy", label="I reviewed the destination and its hosting package policy",
) )
@@ -398,7 +398,7 @@ class MoveHostingView(OperatorAuthorization, FormView):
item.hosting_plan_id not in allowed_plans for item in moving item.hosting_plan_id not in allowed_plans for item in moving
): ):
raise ValidationError( raise ValidationError(
"The destination must have room and allow every hosting plan." "The destination needs room and must allow all packages."
) )
revision = [ revision = [
destination.pk, destination.pk,
+1 -1
View File
@@ -77,7 +77,7 @@ def check_version(account, version):
allowed = allowed_versions(account) allowed = allowed_versions(account)
if allowed and version not in allowed: if allowed and version not in allowed:
raise ValidationError( raise ValidationError(
{"php_version": "This PHP series is outside the hosting plan."} {"php_version": "This PHP series is outside the hosting package."}
) )
+2 -2
View File
@@ -47,7 +47,7 @@ def validate_policy(resource, spec, account):
def validate_routing(domain, spec, plan): def validate_routing(domain, spec, plan):
if spec.catchall and not (plan and plan.allow_mail_catchall): if spec.catchall and not (plan and plan.allow_mail_catchall):
raise ValidationError("This hosting plan does not allow catch-all.") raise ValidationError("This hosting package does not allow catch-all.")
mailboxes = domain.mailboxes.all() mailboxes = domain.mailboxes.all()
if mailboxes.filter(local_part__in=spec.aliases).exists(): if mailboxes.filter(local_part__in=spec.aliases).exists():
raise ValidationError("An alias cannot replace a requested mailbox.") raise ValidationError("An alias cannot replace a requested mailbox.")
@@ -68,7 +68,7 @@ def validate_routing(domain, spec, plan):
) )
elif not (plan and plan.allow_external_mail_forwarding): elif not (plan and plan.allow_external_mail_forwarding):
raise ValidationError( raise ValidationError(
"This hosting plan does not allow external forwarding." "This hosting package does not allow external forwarding."
) )
+2 -2
View File
@@ -40,7 +40,7 @@ class SitePhpSettingsForm(forms.Form):
) )
max_children = php_setting_input("max_children", "Maximum PHP-FPM workers") max_children = php_setting_input("max_children", "Maximum PHP-FPM workers")
use_plan = forms.BooleanField( use_plan = forms.BooleanField(
label="Apply the current hosting plan defaults", label="Apply the current hosting package defaults",
required=False, required=False,
help_text="Uses the plan's values in place of the limits above.", help_text="Uses the plan's values in place of the limits above.",
) )
@@ -116,7 +116,7 @@ def limit_customer_php_settings(account, requested):
value = values[key] value = values[key]
if value is not None and (limit is None or value > limit): if value is not None and (limit is None or value > limit):
raise ValidationError( raise ValidationError(
"Keep PHP limits within the account's hosting plan." "Keep PHP limits within the account's hosting package."
) )
if value is None: if value is None:
values[key] = limit values[key] = limit
+1 -1
View File
@@ -131,7 +131,7 @@ def create_reseller_account(access, account):
raise ValidationError( raise ValidationError(
{ {
"hosting_plan": ( "hosting_plan": (
"This hosting plan is no longer available to you." "This hosting package is no longer available to you."
) )
} }
) )
@@ -134,7 +134,9 @@ def claim_own_customer_hosting(request, pk):
class ManagerHostingPlanForm(forms.Form): class ManagerHostingPlanForm(forms.Form):
plan = forms.ModelChoiceField(queryset=HostingPlan.objects.none()) plan = forms.ModelChoiceField(
queryset=HostingPlan.objects.none(), label="Hosting package"
)
def __init__(self, *args, manager, **kwargs): def __init__(self, *args, manager, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@@ -145,8 +147,8 @@ class ManagerHostingPlanView(UserPassesTestMixin, FormView):
form_class = ManagerHostingPlanForm form_class = ManagerHostingPlanForm
template_name = "hosting/workspace_form.html" template_name = "hosting/workspace_form.html"
extra_context = { extra_context = {
"title": "Assign hosting plan", "title": "Assign hosting package",
"submit_label": "Assign plan", "submit_label": "Assign package",
} }
def test_func(self): def test_func(self):
+5 -2
View File
@@ -20,6 +20,7 @@ class ResellerProfileForm(forms.ModelForm):
class Meta: class Meta:
model = ResellerProfile model = ResellerProfile
fields = ("name", "account_limit", "hosting_plans") fields = ("name", "account_limit", "hosting_plans")
labels = {"hosting_plans": "Allowed hosting packages"}
help_texts = { help_texts = {
"account_limit": "Enter 0 to manage existing accounts only.", "account_limit": "Enter 0 to manage existing accounts only.",
} }
@@ -32,7 +33,7 @@ class ResellerProfileForm(forms.ModelForm):
values = super().clean() values = super().clean()
if values.get("account_limit") and not values.get("hosting_plans"): if values.get("account_limit") and not values.get("hosting_plans"):
self.add_error( self.add_error(
"hosting_plans", "Select at least one hosting plan." "hosting_plans", "Select at least one hosting package."
) )
return values return values
@@ -67,7 +68,9 @@ class ProfileEditor(ProfilesAccess):
try: try:
return super().form_valid(form) return super().form_valid(form)
except IntegrityError: except IntegrityError:
form.add_error(None, "The profiles changed. Review and try again.") form.add_error(
None, "The manager packages changed. Review and try again."
)
return self.form_invalid(form) return self.form_invalid(form)
+3 -3
View File
@@ -33,11 +33,11 @@ class ResellerPolicyForm(forms.ModelForm):
class Meta: class Meta:
model = Reseller model = Reseller
fields = ("is_active", "account_limit", "hosting_plans") fields = ("is_active", "account_limit", "hosting_plans")
labels = {"hosting_plans": "Allowed hosting plans"} labels = {"hosting_plans": "Allowed hosting packages"}
help_texts = { help_texts = {
"account_limit": "Enter 0 to manage existing accounts only.", "account_limit": "Enter 0 to manage existing accounts only.",
"hosting_plans": ( "hosting_plans": (
"Plans available when a manager creates an account." "Packages available when a manager creates an account."
), ),
} }
@@ -61,7 +61,7 @@ class ResellerPolicyForm(forms.ModelForm):
and not values.get("hosting_plans") and not values.get("hosting_plans")
): ):
self.add_error( self.add_error(
"hosting_plans", "Select at least one hosting plan." "hosting_plans", "Select at least one hosting package."
) )
return values return values
+3 -1
View File
@@ -635,7 +635,9 @@ def apply_site_php_version(job):
raise ValueError("Activate the current website before changing PHP.") raise ValueError("Activate the current website before changing PHP.")
versions = plan_php_versions(account) versions = plan_php_versions(account)
if versions and job.requested_version not in versions: if versions and job.requested_version not in versions:
raise ValueError("The hosting plan no longer allows this PHP series.") raise ValueError(
"The hosting package no longer allows this PHP series."
)
site = WebSite(job.account_id, job.domain) site = WebSite(job.account_id, job.domain)
return { return {
"applied_version": update_local_php_version( "applied_version": update_local_php_version(
@@ -25,7 +25,7 @@
{% block page_content %} {% block page_content %}
<dl class="details surface"> <dl class="details surface">
{% if is_tenant or perms.hosting.view_hostingplan %} {% if is_tenant or perms.hosting.view_hostingplan %}
<div><dt>Hosting plan</dt><dd>{% if account.hosting_plan %}{{ account.hosting_plan.name }}{% else %}Unassigned{% endif %} <div><dt>Hosting package</dt><dd>{% if account.hosting_plan %}{{ account.hosting_plan.name }}{% else %}Unassigned{% endif %}
{% if is_reseller %}<a class="record-link" href="{% url 'panel:manager_assign_plan' account.pk %}">Assign plan</a>{% endif %}</dd></div> {% if is_reseller %}<a class="record-link" href="{% url 'panel:manager_assign_plan' account.pk %}">Assign plan</a>{% endif %}</dd></div>
{% endif %} {% endif %}
{% if is_operator and perms.hosting.view_reseller %} {% if is_operator and perms.hosting.view_reseller %}
@@ -42,7 +42,7 @@
<th scope="col">Account</th> <th scope="col">Account</th>
<th scope="col">Status</th> <th scope="col">Status</th>
{% if is_operator and perms.hosting.view_customer %}<th scope="col">Customer</th>{% endif %} {% if is_operator and perms.hosting.view_customer %}<th scope="col">Customer</th>{% endif %}
{% if is_tenant or perms.hosting.view_hostingplan %}<th scope="col">Hosting plan</th>{% endif %} {% if is_tenant or perms.hosting.view_hostingplan %}<th scope="col">Hosting package</th>{% endif %}
<th scope="col" class="cell-date">Added</th> <th scope="col" class="cell-date">Added</th>
</tr> </tr>
</thead> </thead>
@@ -1,6 +1,11 @@
{% extends "hosting/workspace_page.html" %} {% extends "hosting/workspace_page.html" %}
{% block title %}All users · Coulobre Panel{% endblock %} {% block title %}All users · Coulobre Panel{% endblock %}
{% block page_title %}All users{% endblock %} {% block page_title %}All users{% endblock %}
{% block page_actions %}
{% if perms.hosting.add_customer %}
<a class="button primary" href="{% url 'panel:customer_create' %}">Add user</a>
{% endif %}
{% endblock %}
{% block page_context %} {% block page_context %}
<form method="get" class="workspace-context form-actions" role="search"> <form method="get" class="workspace-context form-actions" role="search">
<label class="visually-hidden" for="username-search">Search by username</label> <label class="visually-hidden" for="username-search">Search by username</label>
@@ -11,7 +11,7 @@
{% if request.user.is_superuser and request.user.is_verified %} {% if request.user.is_superuser and request.user.is_verified %}
<a class="button secondary" href="{% url 'panel:assign_panel_role' %}?role=customer">Assign to existing login</a> <a class="button secondary" href="{% url 'panel:assign_panel_role' %}?role=customer">Assign to existing login</a>
{% endif %} {% endif %}
<a class="button primary" href="{% url 'panel:customer_create' %}">Add customer login</a> <a class="button primary" href="{% url 'panel:customer_create' %}">Add user</a>
</div> </div>
{% endif %} {% endif %}
</header> </header>
@@ -3,7 +3,7 @@
{% block title %}{{ page_title }} · Coulobre Panel{% endblock %} {% block title %}{{ page_title }} · Coulobre Panel{% endblock %}
{% block page_title %}{{ page_title }}{% endblock %} {% block page_title %}{{ page_title }}{% endblock %}
{% block page_context %} {% block page_context %}
<a class="quiet-link" href="{% url 'panel:hosting_plans' %}">← Hosting plans</a> <a class="quiet-link" href="{% url 'panel:hosting_plans' %}">← Hosting packages</a>
{% endblock %} {% endblock %}
{% block page_content %} {% block page_content %}
<section class="surface editor-surface"> <section class="surface editor-surface">
@@ -1,15 +1,15 @@
{% extends "hosting/workspace_page.html" %} {% extends "hosting/workspace_page.html" %}
{% block title %}Hosting plans · Coulobre Panel{% endblock %} {% block title %}Hosting packages · Coulobre Panel{% endblock %}
{% block page_header %} {% block page_header %}
<header class="page-heading"> <header class="page-heading">
<h1>Hosting plans</h1> <h1>Hosting packages</h1>
{% if perms.hosting.add_hostingplan %} {% if perms.hosting.add_hostingplan %}
<a class="button primary" href="{% url 'panel:hosting_plan_create' %}">Add hosting plan</a> <a class="button primary" href="{% url 'panel:hosting_plan_create' %}">Add hosting package</a>
{% endif %} {% endif %}
</header> </header>
{% endblock %} {% endblock %}
{% block page_content %} {% block page_content %}
<section class="surface" aria-label="Hosting plans"> <section class="surface" aria-label="Hosting packages">
{% if hosting_plans %} {% if hosting_plans %}
<div class="table-scroll"> <div class="table-scroll">
<table> <table>
@@ -48,7 +48,7 @@
</table> </table>
</div> </div>
{% else %} {% else %}
<p class="empty">No hosting plans yet.</p> <p class="empty">No hosting packages yet.</p>
{% endif %} {% endif %}
{% include "hosting/pagination.html" %} {% include "hosting/pagination.html" %}
</section> </section>
@@ -1,6 +1,6 @@
{% extends "hosting/workspace_page.html" %} {% extends "hosting/workspace_page.html" %}
{% block title %}User packages · Coulobre Panel{% endblock %} {% block title %}Hosting packages · Coulobre Panel{% endblock %}
{% block page_title %}User packages{% endblock %} {% block page_title %}Hosting packages{% endblock %}
{% block page_content %} {% block page_content %}
<section class="surface"> <section class="surface">
<ul class="workspace-list"> <ul class="workspace-list">
@@ -9,7 +9,7 @@ Set your password by opening this link within 48 hours:
{{ setup_url }} {{ setup_url }}
{% if account %}Your hosting account is {{ account.primary_domain }}.{% if account.hosting_plan %} {% if account %}Your hosting account is {{ account.primary_domain }}.{% if account.hosting_plan %}
Hosting plan: {{ account.hosting_plan.name }} Hosting package: {{ account.hosting_plan.name }}
Website limit: {{ account.hosting_plan.website_limit }} Website limit: {{ account.hosting_plan.website_limit }}
Scheduled tasks per account: {{ account.hosting_plan.website_job_limit }} Scheduled tasks per account: {{ account.hosting_plan.website_job_limit }}
Database limit: {{ account.hosting_plan.database_limit|default_if_none:"Unlimited" }} Database limit: {{ account.hosting_plan.database_limit|default_if_none:"Unlimited" }}
@@ -21,7 +21,7 @@
<div><dt>Accounts allocated</dt><dd>{{ account_count }} of {{ reseller.account_limit }}</dd></div> <div><dt>Accounts allocated</dt><dd>{{ account_count }} of {{ reseller.account_limit }}</dd></div>
{% if perms.hosting.view_hostingplan %} {% if perms.hosting.view_hostingplan %}
<div> <div>
<dt>Allowed hosting plans</dt> <dt>Allowed hosting packages</dt>
<dd>{% for plan in allowed_plans %}{{ plan.name }}{% if not forloop.last %}, {% endif %}{% empty %}None{% endfor %}</dd> <dd>{% for plan in allowed_plans %}{{ plan.name }}{% if not forloop.last %}, {% endif %}{% empty %}None{% endfor %}</dd>
</div> </div>
{% endif %} {% endif %}
@@ -33,7 +33,7 @@
<div class="table-scroll"> <div class="table-scroll">
<table> <table>
<thead> <thead>
<tr><th scope="col">Account</th><th scope="col">Primary domain</th>{% if perms.hosting.view_hostingplan %}<th scope="col">Hosting plan</th>{% endif %}</tr> <tr><th scope="col">Account</th><th scope="col">Primary domain</th>{% if perms.hosting.view_hostingplan %}<th scope="col">Hosting package</th>{% endif %}</tr>
</thead> </thead>
<tbody> <tbody>
{% for account in account_page %} {% for account in account_page %}
@@ -87,9 +87,9 @@
{% if event.changes.hosting_plans %} {% if event.changes.hosting_plans %}
<div>Allowed plans {% for plan in event.changes.hosting_plans.before %}{{ plan.name }}{% if not forloop.last %}, {% endif %}{% empty %}None{% endfor %} → {% for plan in event.changes.hosting_plans.after %}{{ plan.name }}{% if not forloop.last %}, {% endif %}{% empty %}None{% endfor %}</div> <div>Allowed plans {% for plan in event.changes.hosting_plans.before %}{{ plan.name }}{% if not forloop.last %}, {% endif %}{% empty %}None{% endfor %} → {% for plan in event.changes.hosting_plans.after %}{{ plan.name }}{% if not forloop.last %}, {% endif %}{% empty %}None{% endfor %}</div>
{% endif %} {% endif %}
{% if event.changes.plan %}<div>Hosting plan {{ event.changes.plan.name }}</div>{% endif %} {% if event.changes.plan %}<div>Hosting package {{ event.changes.plan.name }}</div>{% endif %}
{% if event.changes.account_plan %} {% if event.changes.account_plan %}
<div>Hosting plan {{ event.changes.account_plan.before.name|default:"Unassigned" }} → {{ event.changes.account_plan.after.name|default:"Unassigned" }}</div> <div>Hosting package {{ event.changes.account_plan.before.name|default:"Unassigned" }} → {{ event.changes.account_plan.after.name|default:"Unassigned" }}</div>
{% endif %} {% endif %}
{% endif %} {% endif %}
</td> </td>
@@ -9,13 +9,13 @@
{% if profiles %} {% if profiles %}
<form method="get" class="editor"> <form method="get" class="editor">
<div> <div>
<label for="manager-profile">Load profile</label> <label for="manager-profile">Manager package</label>
<select id="manager-profile" name="profile"> <select id="manager-profile" name="profile">
<option value="">Custom settings</option> <option value="">Custom settings</option>
{% for profile in profiles %}<option value="{{ profile.pk }}"{% if profile.pk == selected_profile.pk %} selected{% endif %}>{{ profile }}</option>{% endfor %} {% for profile in profiles %}<option value="{{ profile.pk }}"{% if profile.pk == selected_profile.pk %} selected{% endif %}>{{ profile }}</option>{% endfor %}
</select> </select>
</div> </div>
<p class="heading-meta">Choose a profile, then review its settings before saving.</p> <p class="heading-meta">Choose a manager package, then review its settings before saving.</p>
<button class="button secondary" type="submit">Load settings</button> <button class="button secondary" type="submit">Load settings</button>
</form> </form>
{% endif %} {% endif %}
@@ -27,15 +27,15 @@
{{ form.as_div }} {{ form.as_div }}
</fieldset> </fieldset>
<fieldset class="editor"> <fieldset class="editor">
<legend>Access and plans</legend> <legend>Access and packages</legend>
{{ policy_form.as_div }} {{ policy_form.as_div }}
</fieldset> </fieldset>
{% else %} {% else %}
{{ form.as_div }} {{ form.as_div }}
{% endif %} {% endif %}
{% if can_add_hosting_plan %} {% if can_add_hosting_plan %}
<p><a href="{% url 'panel:hosting_plan_create' %}" target="_blank" rel="noopener">Create a hosting plan</a>. The plan opens in a new tab.</p> <p><a href="{% url 'panel:hosting_plan_create' %}" target="_blank" rel="noopener">Create a hosting package</a>. The package opens in a new tab.</p>
<button class="button secondary" type="submit" name="refresh_plans" value="1" formnovalidate>Reload available plans</button> <button class="button secondary" type="submit" name="refresh_plans" value="1" formnovalidate>Reload available packages</button>
{% endif %} {% endif %}
<div class="form-actions"> <div class="form-actions">
<button class="button primary" type="submit">{{ submit_label }}</button> <button class="button primary" type="submit">{{ submit_label }}</button>
@@ -5,7 +5,7 @@
<h1>Managers</h1> <h1>Managers</h1>
<div class="form-actions"> <div class="form-actions">
{% if perms.hosting.change_reseller and perms.hosting.view_hostingplan %} {% if perms.hosting.change_reseller and perms.hosting.view_hostingplan %}
<a class="button secondary" href="{% url 'panel:reseller_profiles' %}">Profiles</a> <a class="button secondary" href="{% url 'panel:reseller_profiles' %}">Manager packages</a>
{% endif %} {% endif %}
{% if perms.hosting.add_reseller %} {% if perms.hosting.add_reseller %}
{% if request.user.is_superuser and request.user.is_verified %} {% if request.user.is_superuser and request.user.is_verified %}
@@ -1,15 +1,15 @@
{% extends "hosting/workspace_page.html" %} {% extends "hosting/workspace_page.html" %}
{% block title %}{% if object %}Edit profile{% else %}Add profile{% endif %} · Coulobre Panel{% endblock %} {% block title %}{% if object %}Edit manager package{% else %}Add manager package{% endif %} · Coulobre Panel{% endblock %}
{% block page_title %}{% if object %}Edit profile{% else %}Add profile{% endif %}{% endblock %} {% block page_title %}{% if object %}Edit manager package{% else %}Add manager package{% endif %}{% endblock %}
{% block page_context %} {% block page_context %}
<a class="quiet-link" href="{% url 'panel:reseller_profiles' %}">← Manager profiles</a> <a class="quiet-link" href="{% url 'panel:reseller_profiles' %}">← Manager packages</a>
{% endblock %} {% endblock %}
{% block page_content %} {% block page_content %}
<section class="surface editor-surface"> <section class="surface editor-surface">
<form method="post" class="editor"> <form method="post" class="editor">
{% csrf_token %} {% csrf_token %}
{{ form.as_div }} {{ form.as_div }}
<button type="submit" class="button primary">Save profile</button> <button type="submit" class="button primary">Save package</button>
</form> </form>
</section> </section>
{% endblock %} {% endblock %}
@@ -1,9 +1,9 @@
{% extends "hosting/workspace_page.html" %} {% extends "hosting/workspace_page.html" %}
{% block title %}Manager profiles · Coulobre Panel{% endblock %} {% block title %}Manager packages · Coulobre Panel{% endblock %}
{% block page_header %} {% block page_header %}
<header class="page-heading"> <header class="page-heading">
<h1>Manager profiles</h1> <h1>Manager packages</h1>
<a class="button primary" href="{% url 'panel:reseller_profile_create' %}">Add profile</a> <a class="button primary" href="{% url 'panel:reseller_profile_create' %}">Add manager package</a>
</header> </header>
{% endblock %} {% endblock %}
{% block page_context %} {% block page_context %}
@@ -12,7 +12,7 @@
{% block page_content %} {% block page_content %}
<section class="surface"> <section class="surface">
<table> <table>
<thead><tr><th scope="col">Profile</th><th scope="col">Account limit</th></tr></thead> <thead><tr><th scope="col">Package</th><th scope="col">Account limit</th></tr></thead>
<tbody> <tbody>
{% for profile in object_list %} {% for profile in object_list %}
<tr> <tr>
@@ -20,7 +20,7 @@
<td>{% if profile.account_limit %}{{ profile.account_limit }}{% else %}Manage existing accounts only{% endif %}</td> <td>{% if profile.account_limit %}{{ profile.account_limit }}{% else %}Manage existing accounts only{% endif %}</td>
</tr> </tr>
{% empty %} {% empty %}
<tr><td colspan="2">No profiles yet. Add one to reuse a set of plans, limits, and permissions.</td></tr> <tr><td colspan="2">No manager packages yet. Add one to reuse account limits and a set of hosting packages.</td></tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
@@ -14,7 +14,7 @@
{% block page_content %} {% block page_content %}
<section class="surface editor-surface"> <section class="surface editor-surface">
<form method="post" class="editor"> <form method="post" class="editor">
<p>{% if is_customer %}Blank fields use the hosting plan defaults.{% else %}Blank fields use the web node defaults.{% endif %}</p> <p>{% if is_customer %}Blank fields use the hosting package defaults.{% else %}Blank fields use the web node defaults.{% endif %}</p>
{% csrf_token %} {% csrf_token %}
{{ form.as_div }} {{ form.as_div }}
<div class="form-actions"> <div class="form-actions">
+2 -2
View File
@@ -319,7 +319,7 @@ class CustomerManagementTests(TestCase):
): ):
self.client.force_login(self.operator) self.client.force_login(self.operator)
customers = reverse("panel:customers") customers = reverse("panel:customers")
self.assertContains(self.client.get(customers), "Add customer") self.assertContains(self.client.get(customers), "Add user")
password = "initial-correct-horse-battery-staple" password = "initial-correct-horse-battery-staple"
self.assertRedirects( self.assertRedirects(
@@ -462,7 +462,7 @@ class CustomerManagementTests(TestCase):
self.client.force_login(reader) self.client.force_login(reader)
response = self.client.get(reverse("panel:customers")) response = self.client.get(reverse("panel:customers"))
self.assertContains(response, "alice") self.assertContains(response, "alice")
self.assertNotContains(response, "Add customer") self.assertNotContains(response, "Add user")
self.assertNotContains(response, "Suspend sign-in") self.assertNotContains(response, "Suspend sign-in")
self.assertEqual( self.assertEqual(
self.client.post(url, {"access": "suspend"}).status_code, 403 self.client.post(url, {"access": "suspend"}).status_code, 403
@@ -140,7 +140,7 @@ class IndependentWebsiteTests(TestCase):
response = self.client.post( response = self.client.post(
self.add, {"domain": "shop.example.test", "php_version": "8.3"} self.add, {"domain": "shop.example.test", "php_version": "8.3"}
) )
self.assertContains(response, "outside the hosting plan") self.assertContains(response, "outside the hosting package")
website = self.create_website() website = self.create_website()
self.assertContains( self.assertContains(
self.client.get(self.account.get_absolute_url()), self.client.get(self.account.get_absolute_url()),
+1 -1
View File
@@ -252,7 +252,7 @@ class ResellerAccountCreationTests(TestCase):
}, },
) )
self.assertContains( self.assertContains(
response, "This hosting plan is no longer available to you." response, "This hosting package is no longer available to you."
) )
self.assertEqual(self.reseller.hostingaccount_set.count(), 1) self.assertEqual(self.reseller.hostingaccount_set.count(), 1)
+18
View File
@@ -17,6 +17,24 @@ from .models import (
class WorkspaceTests(TestCase): class WorkspaceTests(TestCase):
def test_operator_navigation_keeps_creation_and_package_links_together(
self,
):
operator = get_user_model().objects.create_superuser("operator")
self.client.force_login(operator)
landing = self.client.get(reverse("panel:accounts"))
links = dict(landing.context["navigation_groups"])["Account Manager"]
actions = [
(reverse("panel:customer_create"), "Add User"),
(reverse("panel:reseller_create"), "Add Manager"),
(reverse("panel:operator_create"), "Add Operator"),
(reverse("panel:hosting_plans"), "Hosting Packages"),
(reverse("panel:reseller_profiles"), "Manager Packages"),
]
entries = [(url, label) for url, label, _ in links]
start = entries.index(actions[0])
self.assertEqual(entries[start : start + len(actions)], actions)
@override_settings(WEBSITE_USAGE=True) @override_settings(WEBSITE_USAGE=True)
def test_operator_summary_respects_usage_and_task_permissions(self): def test_operator_summary_respects_usage_and_task_permissions(self):
operator = get_user_model().objects.create_user( operator = get_user_model().objects.create_user(
+6 -4
View File
@@ -422,13 +422,14 @@ class AccountEditor:
form = super().get_form(form_class) form = super().get_form(form_class)
if "hosting_plan" in form.fields: if "hosting_plan" in form.fields:
field = form.fields["hosting_plan"] field = form.fields["hosting_plan"]
field.label = "Hosting package"
reseller = reseller_for_user(self.request.user) reseller = reseller_for_user(self.request.user)
if reseller is None: if reseller is None:
field.empty_label = "Unassigned" field.empty_label = "Unassigned"
else: else:
field.queryset = reseller.hosting_plans.all() field.queryset = reseller.hosting_plans.all()
field.required = True field.required = True
field.empty_label = "Select a hosting plan" field.empty_label = "Select a hosting package"
for name in ("reseller", "customer"): for name in ("reseller", "customer"):
if name in form.fields: if name in form.fields:
field = form.fields[name] field = form.fields[name]
@@ -1909,6 +1910,7 @@ class CustomerCreate(OperatorOnlyMixin, PermissionRequiredMixin, FormView):
permission_required = (VIEW_CUSTOMERS, "hosting.add_customer") permission_required = (VIEW_CUSTOMERS, "hosting.add_customer")
form_class = InviteLoginForm form_class = InviteLoginForm
template_name = "hosting/customer_form.html" template_name = "hosting/customer_form.html"
extra_context = {"title": "Add user"}
success_url = reverse_lazy("panel:customers") success_url = reverse_lazy("panel:customers")
def form_valid(self, form): def form_valid(self, form):
@@ -2605,8 +2607,8 @@ class HostingPlanCreate(
): ):
permission_required = (VIEW_HOSTING_PLANS, "hosting.add_hostingplan") permission_required = (VIEW_HOSTING_PLANS, "hosting.add_hostingplan")
extra_context = { extra_context = {
"page_title": "Add hosting plan", "page_title": "Add hosting package",
"submit_label": "Add plan", "submit_label": "Add package",
} }
@@ -2615,7 +2617,7 @@ class HostingPlanEdit(
): ):
permission_required = (VIEW_HOSTING_PLANS, "hosting.change_hostingplan") permission_required = (VIEW_HOSTING_PLANS, "hosting.change_hostingplan")
extra_context = { extra_context = {
"page_title": "Edit hosting plan", "page_title": "Edit hosting package",
"submit_label": "Save changes", "submit_label": "Save changes",
} }
+27 -16
View File
@@ -78,6 +78,8 @@ WORKSPACE_PARENT_ROUTES = {
"reseller_edit": ("resellers", ()), "reseller_edit": ("resellers", ()),
"hosting_plan_create": ("hosting_plans", ()), "hosting_plan_create": ("hosting_plans", ()),
"hosting_plan_edit": ("hosting_plans", ()), "hosting_plan_edit": ("hosting_plans", ()),
"reseller_profile_create": ("reseller_profiles", ()),
"reseller_profile_edit": ("reseller_profiles", ()),
"manager_assign_plan": ("manager_packages", ()), "manager_assign_plan": ("manager_packages", ()),
"account": ("accounts", ()), "account": ("accounts", ()),
} }
@@ -244,6 +246,7 @@ NAVIGATION_ICONS = {
"accounts": "accounts", "accounts": "accounts",
"all_users": "customers", "all_users": "customers",
"customers": "customers", "customers": "customers",
"customer_create": "customers",
"customer_onboarding": "customers", "customer_onboarding": "customers",
"move_accounts": "transfer", "move_accounts": "transfer",
"operator_create": "customers", "operator_create": "customers",
@@ -357,24 +360,39 @@ def groups_for(request, *, customer, manager):
( (
"Account Manager", "Account Manager",
[ [
link("customer_onboarding", "Add New User"),
link("customers", "My Users"),
link("accounts", "Customer hosting"), link("accounts", "Customer hosting"),
link("manager_packages", "User Packages"), link("customers", "My Users"),
link("customer_onboarding", "Add User"),
link("manager_packages", "Hosting Packages"),
], ],
) )
] ]
else: else:
accounts = [] accounts = []
for permission, route, label in ( for permission, route, label in (
("view_hostingaccount", "accounts", "Hosting accounts"), (("view_hostingaccount",), "accounts", "Hosting accounts"),
("view_customer", "all_users", "Show All Users"), (("view_customer",), "all_users", "Show All Users"),
("view_reseller", "resellers", "Managers"), (("view_reseller",), "resellers", "Managers"),
("add_reseller", "reseller_create", "Add Manager"), (("view_customer", "add_customer"), "customer_create", "Add User"),
("view_hostingplan", "hosting_plans", "Hosting plans"), (
("view_reseller", "add_reseller"),
"reseller_create",
"Add Manager",
),
): ):
if user.has_perm(f"hosting.{permission}"): if user.has_perms(f"hosting.{name}" for name in permission):
accounts.append(link(route, label)) accounts.append(link(route, label))
if user.is_superuser:
accounts.append(link("operator_create", "Add Operator"))
if user.has_perm("hosting.view_hostingplan"):
accounts.append(link("hosting_plans", "Hosting Packages"))
if user.is_superuser:
accounts.extend(
(
link("reseller_profiles", "Manager Packages"),
link("move_accounts", "Move Users"),
)
)
server, admin_tools = [], [] server, admin_tools = [], []
if user.has_perm("hosting.view_webprovisioningplan"): if user.has_perm("hosting.view_webprovisioningplan"):
server.append(link("plans", "Web provisioning")) server.append(link("plans", "Web provisioning"))
@@ -389,13 +407,6 @@ def groups_for(request, *, customer, manager):
if user.has_perm("hosting.view_servicehealth"): if user.has_perm("hosting.view_servicehealth"):
admin_tools.append(link("service_health", "System Services")) admin_tools.append(link("service_health", "System Services"))
if user.is_superuser: if user.is_superuser:
accounts.extend(
(
link("operator_create", "Add New Operator"),
link("reseller_profiles", "Manager Packages"),
link("move_accounts", "Move Users"),
)
)
server.extend( server.extend(
( (
link("operator_settings", "Operator Settings", "general"), link("operator_settings", "Operator Settings", "general"),