Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0f3f6c4fa | ||
|
|
e0fa131ad8 | ||
|
|
9994e27a07 | ||
|
|
fe2ced25dd | ||
|
|
16eb16b792 | ||
|
|
e658bf5b30 | ||
|
|
3812e37d5b | ||
|
|
b97036778e | ||
|
|
7d0365e54f | ||
|
|
5fdc47bf1a | ||
|
|
20b24aef4e | ||
|
|
c5c2e9e419 | ||
|
|
cede3c1948 | ||
|
|
dbac22b0ce |
No files matched your search
+6
-1
@@ -75,6 +75,11 @@ subsequent changes.
|
|||||||
instructions, and known limitations. Mark a release candidate as a
|
instructions, and known limitations. Mark a release candidate as a
|
||||||
prerelease. Close the milestone when its target version is published.
|
prerelease. Close the milestone when its target version is published.
|
||||||
|
|
||||||
|
Gitea release notes are the project changelog. The panel displays published
|
||||||
|
notes under **System → Updates → Changelog**. Use short Markdown sections for
|
||||||
|
user-visible features, improvements, fixes, and upgrade instructions as
|
||||||
|
applicable.
|
||||||
|
|
||||||
### Build and publish the Debian package
|
### Build and publish the Debian package
|
||||||
|
|
||||||
Build from the same verified source distribution and wheel used for the
|
Build from the same verified source distribution and wheel used for the
|
||||||
@@ -203,4 +208,4 @@ python tools/web_update_manifest.py dist/coulobre_panel-0.10.2rc1-py3-none-any.w
|
|||||||
Run the development checks before submitting a pull request. Gitea Actions
|
Run the development checks before submitting a pull request. Gitea Actions
|
||||||
checks Python 3.12 and 3.14. [Development checks](docs/development.md#checks)
|
checks Python 3.12 and 3.14. [Development checks](docs/development.md#checks)
|
||||||
[debian-registry]: https://docs.gitea.com/usage/packages/debian/
|
[debian-registry]: https://docs.gitea.com/usage/packages/debian/
|
||||||
[apt-installation]: docs/deployment.md#use-the-gitea-apt-repository
|
[apt-installation]: docs/deployment.md#use-the-coulobre-apt-repository
|
||||||
@@ -12,6 +12,8 @@ perform audited support actions on their behalf.
|
|||||||
See [Local development](docs/development.md) to run it.
|
See [Local development](docs/development.md) to run it.
|
||||||
Use the [installer or manual deployment guide](docs/deployment.md) to set up
|
Use the [installer or manual deployment guide](docs/deployment.md) to set up
|
||||||
Apache, MariaDB, and RabbitMQ.
|
Apache, MariaDB, and RabbitMQ.
|
||||||
|
For Ubuntu 26.04 LTS or Debian 13, see the
|
||||||
|
[Coulobre APT setup](docs/deployment.md#use-the-coulobre-apt-repository).
|
||||||
|
|
||||||
## Roadmap and releases
|
## Roadmap and releases
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
if [ "$1" != configure ] || [ ! -e /etc/coulobre/panel.env ]; then
|
if [ "$1" != configure ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -e /etc/coulobre/panel.env ]; then
|
||||||
|
printf '%s\n' \
|
||||||
|
'The Coulobre installer is ready. After APT exits, start setup with the command below.' \
|
||||||
|
' sudo coulobre-install --interactive' \
|
||||||
|
'Run coulobre-install --help for config-file and web setup.'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -31,3 +31,11 @@ mode = "off"
|
|||||||
# ssh_identity. ssh_identity is a root-owned 0600 file on the panel host.
|
# ssh_identity. ssh_identity is a root-owned 0600 file on the panel host.
|
||||||
# For remote mail installation, set mail_hostname to the public service
|
# For remote mail installation, set mail_hostname to the public service
|
||||||
# hostname. Provide tls = "acme" or certificate and key paths on that host.
|
# hostname. Provide tls = "acme" or certificate and key paths on that host.
|
||||||
|
|
||||||
|
[hosting]
|
||||||
|
# Addresses clients use for hosted websites. Used in default A and AAAA records.
|
||||||
|
# public_addresses = ["192.0.2.21", "2001:db8::21"]
|
||||||
|
# Authoritative nameservers for new NS records. Set delegation at the registrar.
|
||||||
|
# nameservers = ["ns1.example.net", "ns2.example.net"]
|
||||||
|
# Public outbound SMTP addresses, including the NAT address if used. Used for SPF.
|
||||||
|
# mail_sending_addresses = ["192.0.2.25"]
|
||||||
@@ -6,6 +6,7 @@ from getpass import getpass
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from tempfile import TemporaryDirectory
|
from tempfile import TemporaryDirectory
|
||||||
|
|
||||||
|
from . import guidance
|
||||||
from .config import (
|
from .config import (
|
||||||
REMOTE_MODES,
|
REMOTE_MODES,
|
||||||
InstallError,
|
InstallError,
|
||||||
@@ -18,7 +19,9 @@ from .config import (
|
|||||||
from .engine import Installer
|
from .engine import Installer
|
||||||
|
|
||||||
|
|
||||||
def prompt(label, default=""):
|
def prompt(label, default="", *, hint=""):
|
||||||
|
if hint:
|
||||||
|
print(f" {hint}", flush=True)
|
||||||
value = input(f"{label}{f' [{default}]' if default else ''}: ").strip()
|
value = input(f"{label}{f' [{default}]' if default else ''}: ").strip()
|
||||||
return value or default
|
return value or default
|
||||||
|
|
||||||
@@ -37,7 +40,9 @@ def comma_separated(values):
|
|||||||
def interactive_plan(previous=None):
|
def interactive_plan(previous=None):
|
||||||
if previous is None:
|
if previous is None:
|
||||||
preset = prompt(
|
preset = prompt(
|
||||||
"Installation profile (full-service or custom)", "full-service"
|
"Installation profile (full-service or custom)",
|
||||||
|
"full-service",
|
||||||
|
hint=guidance.PROFILE,
|
||||||
)
|
)
|
||||||
if preset not in {"full-service", "custom"}:
|
if preset not in {"full-service", "custom"}:
|
||||||
raise InstallError("Choose full-service or custom.")
|
raise InstallError("Choose full-service or custom.")
|
||||||
@@ -46,18 +51,25 @@ def interactive_plan(previous=None):
|
|||||||
preset = "custom"
|
preset = "custom"
|
||||||
defaults = export_parameters(previous, None)
|
defaults = export_parameters(previous, None)
|
||||||
|
|
||||||
def ask(label, section, name, fallback=""):
|
def ask(label, section, name, fallback="", *, hint=""):
|
||||||
return prompt(
|
return prompt(
|
||||||
label, str(defaults.get(section, {}).get(name, fallback))
|
label,
|
||||||
|
str(defaults.get(section, {}).get(name, fallback)),
|
||||||
|
hint=hint,
|
||||||
)
|
)
|
||||||
|
|
||||||
full_service = preset == "full-service"
|
full_service = preset == "full-service"
|
||||||
panel = {"hostname": ask("Panel hostname", "panel", "hostname")}
|
panel = {
|
||||||
|
"hostname": ask(
|
||||||
|
"Panel hostname", "panel", "hostname", hint=guidance.PANEL_HOSTNAME
|
||||||
|
)
|
||||||
|
}
|
||||||
access = panel["access"] = ask(
|
access = panel["access"] = ask(
|
||||||
"Panel access (tls, acme, or proxy)",
|
"Panel access (tls, acme, or proxy)",
|
||||||
"panel",
|
"panel",
|
||||||
"access",
|
"access",
|
||||||
"acme" if full_service else "tls",
|
"acme" if full_service else "tls",
|
||||||
|
hint=guidance.PANEL_ACCESS,
|
||||||
)
|
)
|
||||||
if access == "tls":
|
if access == "tls":
|
||||||
panel["certificate"] = ask(
|
panel["certificate"] = ask(
|
||||||
@@ -66,9 +78,17 @@ def interactive_plan(previous=None):
|
|||||||
panel["key"] = ask("Panel private key path", "panel", "key")
|
panel["key"] = ask("Panel private key path", "panel", "key")
|
||||||
elif access == "proxy":
|
elif access == "proxy":
|
||||||
panel["origin_ip"] = ask(
|
panel["origin_ip"] = ask(
|
||||||
"Private origin address", "panel", "origin_ip"
|
"Private origin address",
|
||||||
|
"panel",
|
||||||
|
"origin_ip",
|
||||||
|
hint=guidance.ORIGIN_ADDRESS,
|
||||||
|
)
|
||||||
|
panel["proxy_ip"] = ask(
|
||||||
|
"Trusted proxy address",
|
||||||
|
"panel",
|
||||||
|
"proxy_ip",
|
||||||
|
hint=guidance.PROXY_ADDRESS,
|
||||||
)
|
)
|
||||||
panel["proxy_ip"] = ask("Trusted proxy address", "panel", "proxy_ip")
|
|
||||||
panel["origin_port"] = number(
|
panel["origin_port"] = number(
|
||||||
ask("Origin port", "panel", "origin_port", "8080"), "the origin"
|
ask("Origin port", "panel", "origin_port", "8080"), "the origin"
|
||||||
)
|
)
|
||||||
@@ -78,7 +98,12 @@ def interactive_plan(previous=None):
|
|||||||
"username": ask(
|
"username": ask(
|
||||||
"Administrator username", "admin", "username", "operator"
|
"Administrator username", "admin", "username", "operator"
|
||||||
),
|
),
|
||||||
"email": ask("Administrator email", "admin", "email"),
|
"email": ask(
|
||||||
|
"Administrator email",
|
||||||
|
"admin",
|
||||||
|
"email",
|
||||||
|
hint=guidance.ADMIN_EMAIL,
|
||||||
|
),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for name in ("dns", "mail"):
|
for name in ("dns", "mail"):
|
||||||
@@ -87,6 +112,7 @@ def interactive_plan(previous=None):
|
|||||||
name,
|
name,
|
||||||
"mode",
|
"mode",
|
||||||
"local" if full_service else "off",
|
"local" if full_service else "off",
|
||||||
|
hint=guidance.DNS_ROLE if name == "dns" else guidance.MAIL_ROLE,
|
||||||
)
|
)
|
||||||
target = data[name] = {"mode": mode}
|
target = data[name] = {"mode": mode}
|
||||||
if mode in REMOTE_MODES:
|
if mode in REMOTE_MODES:
|
||||||
@@ -97,14 +123,20 @@ def interactive_plan(previous=None):
|
|||||||
ask("SSH port", name, "port", "22"), f"the {name} node"
|
ask("SSH port", name, "port", "22"), f"the {name} node"
|
||||||
)
|
)
|
||||||
target["host_key"] = ask(
|
target["host_key"] = ask(
|
||||||
"Verified SSH host public key file", name, "host_key"
|
"Verified SSH host public key file",
|
||||||
|
name,
|
||||||
|
"host_key",
|
||||||
|
hint=guidance.SSH_HOST_KEY,
|
||||||
)
|
)
|
||||||
if mode == "remote-install":
|
if mode == "remote-install":
|
||||||
target["ssh_user"] = ask(
|
target["ssh_user"] = ask(
|
||||||
"SSH administrator username", name, "ssh_user"
|
"SSH administrator username", name, "ssh_user"
|
||||||
)
|
)
|
||||||
target["ssh_identity"] = ask(
|
target["ssh_identity"] = ask(
|
||||||
"SSH administrator private key file", name, "ssh_identity"
|
"SSH administrator private key file",
|
||||||
|
name,
|
||||||
|
"ssh_identity",
|
||||||
|
hint=guidance.SSH_IDENTITY,
|
||||||
)
|
)
|
||||||
if name == "mail" and mode in {"local", "remote-install"}:
|
if name == "mail" and mode in {"local", "remote-install"}:
|
||||||
field = "host" if mode == "local" else "mail_hostname"
|
field = "host" if mode == "local" else "mail_hostname"
|
||||||
@@ -113,12 +145,14 @@ def interactive_plan(previous=None):
|
|||||||
name,
|
name,
|
||||||
field,
|
field,
|
||||||
panel["hostname"] if mode == "local" else "",
|
panel["hostname"] if mode == "local" else "",
|
||||||
|
hint=guidance.MAIL_HOSTNAME,
|
||||||
)
|
)
|
||||||
target["tls"] = ask(
|
target["tls"] = ask(
|
||||||
"Mail TLS (provided or acme)",
|
"Mail TLS (provided or acme)",
|
||||||
name,
|
name,
|
||||||
"tls",
|
"tls",
|
||||||
"acme" if access == "acme" and mode == "local" else "provided",
|
"acme" if access == "acme" and mode == "local" else "provided",
|
||||||
|
hint=guidance.MAIL_TLS,
|
||||||
)
|
)
|
||||||
if target["tls"] == "provided":
|
if target["tls"] == "provided":
|
||||||
target["certificate"] = ask(
|
target["certificate"] = ask(
|
||||||
@@ -128,11 +162,7 @@ def interactive_plan(previous=None):
|
|||||||
"Private key path on the mail host", name, "key"
|
"Private key path on the mail host", name, "key"
|
||||||
)
|
)
|
||||||
hosting = data["hosting"] = {}
|
hosting = data["hosting"] = {}
|
||||||
for name, label in (
|
for name, label, hint in guidance.HOSTING_FIELDS:
|
||||||
("public_addresses", "IP addresses for hosted websites"),
|
|
||||||
("nameservers", "Nameservers for new DNS zones"),
|
|
||||||
("mail_sending_addresses", "Public sending IPs for hosted email"),
|
|
||||||
):
|
|
||||||
if name == "nameservers" and data["dns"]["mode"] == "off":
|
if name == "nameservers" and data["dns"]["mode"] == "off":
|
||||||
continue
|
continue
|
||||||
if name == "mail_sending_addresses" and data["mail"]["mode"] not in {
|
if name == "mail_sending_addresses" and data["mail"]["mode"] not in {
|
||||||
@@ -144,6 +174,7 @@ def interactive_plan(previous=None):
|
|||||||
value = prompt(
|
value = prompt(
|
||||||
f"{label} (comma-separated, or none)",
|
f"{label} (comma-separated, or none)",
|
||||||
", ".join(previous_values) or "none",
|
", ".join(previous_values) or "none",
|
||||||
|
hint=hint,
|
||||||
)
|
)
|
||||||
hosting[name] = [] if value == "none" else comma_separated(value)
|
hosting[name] = [] if value == "none" else comma_separated(value)
|
||||||
return parse_plan(data)
|
return parse_plan(data)
|
||||||
|
|||||||
@@ -485,8 +485,15 @@ class Installer:
|
|||||||
("RabbitMQ", "rabbitmq-server.service"),
|
("RabbitMQ", "rabbitmq-server.service"),
|
||||||
):
|
):
|
||||||
with self.step(f"Starting {name} on loopback"):
|
with self.step(f"Starting {name} on loopback"):
|
||||||
systemctl("enable", "--now", unit)
|
try:
|
||||||
systemctl("restart", unit)
|
systemctl("enable", "--now", unit)
|
||||||
|
systemctl("restart", unit)
|
||||||
|
except InstallError:
|
||||||
|
self.progress(
|
||||||
|
f"Read the {name} service log with "
|
||||||
|
f"sudo journalctl -b -u {unit} -n 60 --no-pager"
|
||||||
|
)
|
||||||
|
raise
|
||||||
|
|
||||||
def mariadb(sql):
|
def mariadb(sql):
|
||||||
return run(
|
return run(
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
"""Help text shared by the interactive installer and browser wizard."""
|
||||||
|
|
||||||
|
PROFILE = (
|
||||||
|
"Full-service preselects local DNS and mail with Let's Encrypt. "
|
||||||
|
"Custom starts with DNS and mail off."
|
||||||
|
)
|
||||||
|
PANEL_HOSTNAME = (
|
||||||
|
"The full DNS name administrators and customers use to sign in."
|
||||||
|
)
|
||||||
|
PANEL_ACCESS = (
|
||||||
|
"Use acme for Let's Encrypt, tls for an existing certificate on this "
|
||||||
|
"server, or proxy when a trusted reverse proxy handles HTTPS."
|
||||||
|
)
|
||||||
|
ORIGIN_ADDRESS = (
|
||||||
|
"The private address on this server that the proxy connects to."
|
||||||
|
)
|
||||||
|
PROXY_ADDRESS = "The source IP of the trusted proxy as seen by this server."
|
||||||
|
ADMIN_EMAIL = (
|
||||||
|
"Use an inbox you can open now. Coulobre uses this address for notices "
|
||||||
|
"and Let's Encrypt registration when enabled."
|
||||||
|
)
|
||||||
|
DNS_ROLE = (
|
||||||
|
"Use local to serve zones here, or off to manage DNS elsewhere. "
|
||||||
|
"Use remote for an existing Coulobre DNS node or remote-install to "
|
||||||
|
"set one up over SSH."
|
||||||
|
)
|
||||||
|
MAIL_ROLE = (
|
||||||
|
"Use local to host mail here, or off to use a separate mail provider. "
|
||||||
|
"Use remote for an existing Coulobre mail node or remote-install to "
|
||||||
|
"set one up over SSH."
|
||||||
|
)
|
||||||
|
MAIL_HOSTNAME = (
|
||||||
|
"The public name mail clients and other mail servers use to reach "
|
||||||
|
"this mail service."
|
||||||
|
)
|
||||||
|
MAIL_TLS = (
|
||||||
|
"Use acme for Let's Encrypt or provided for certificate and key files "
|
||||||
|
"already available on the mail server."
|
||||||
|
)
|
||||||
|
SSH_HOST_KEY = "A file with the verified public host key of the remote server."
|
||||||
|
SSH_IDENTITY = (
|
||||||
|
"The private key file on this panel server used to sign in as the "
|
||||||
|
"SSH administrator."
|
||||||
|
)
|
||||||
|
|
||||||
|
HOSTING_FIELDS = (
|
||||||
|
(
|
||||||
|
"public_addresses",
|
||||||
|
"IP addresses for hosted websites",
|
||||||
|
"Public IPv4 or IPv6 addresses used in default A and AAAA records. "
|
||||||
|
"Use the addresses visitors connect to, or leave unset to add them "
|
||||||
|
"later.",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"nameservers",
|
||||||
|
"Nameservers for new DNS zones",
|
||||||
|
"Authoritative nameserver hostnames, such as ns1.example.net. "
|
||||||
|
"Coulobre uses them in new NS records. Set public delegation "
|
||||||
|
"separately at the registrar, or leave unset to configure later.",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"mail_sending_addresses",
|
||||||
|
"Public sending IPs for hosted email",
|
||||||
|
"The public outbound SMTP addresses, including the NAT address "
|
||||||
|
"if used. Coulobre uses them to prepare SPF and managed mail DNS. "
|
||||||
|
"Leave unset to configure those records separately.",
|
||||||
|
),
|
||||||
|
)
|
||||||
@@ -9,6 +9,7 @@ from http.server import BaseHTTPRequestHandler, HTTPServer
|
|||||||
from threading import Thread
|
from threading import Thread
|
||||||
from urllib.parse import parse_qs
|
from urllib.parse import parse_qs
|
||||||
|
|
||||||
|
from . import guidance
|
||||||
from .cli import comma_separated, number
|
from .cli import comma_separated, number
|
||||||
from .config import REMOTE_MODES, InstallError, parse_plan, port
|
from .config import REMOTE_MODES, InstallError, parse_plan, port
|
||||||
from .engine import SOURCE, Installer
|
from .engine import SOURCE, Installer
|
||||||
@@ -21,28 +22,34 @@ FORM = """<form method="post" action="/review">
|
|||||||
websites, databases, DNS and mail run locally. Adjust the settings below
|
websites, databases, DNS and mail run locally. Adjust the settings below
|
||||||
for a different deployment.</p>
|
for a different deployment.</p>
|
||||||
<fieldset><legend>Panel</legend>
|
<fieldset><legend>Panel</legend>
|
||||||
<label>Hostname<input name="hostname" autocomplete="off" required></label>
|
<label>Hostname<input name="hostname" aria-describedby="hostname-hint"
|
||||||
<label>Access<select name="access">
|
autocomplete="off" required></label>
|
||||||
|
{hostname_hint}
|
||||||
|
<label>Access<select name="access" aria-describedby="access-hint">
|
||||||
<option value="acme">HTTPS with Let's Encrypt</option>
|
<option value="acme">HTTPS with Let's Encrypt</option>
|
||||||
<option value="tls">HTTPS on this server</option>
|
<option value="tls">HTTPS with an existing certificate</option>
|
||||||
<option value="proxy">Trusted external HTTPS proxy</option></select></label>
|
<option value="proxy">Trusted external HTTPS proxy</option></select></label>
|
||||||
|
{access_hint}
|
||||||
<label>Panel certificate path<input name="certificate"></label>
|
<label>Panel certificate path<input name="certificate"></label>
|
||||||
<label>Panel private key path<input name="key"></label>
|
<label>Panel private key path<input name="key"></label>
|
||||||
<label>Private origin address<input name="origin_ip"></label>
|
<label>Private origin address
|
||||||
<label>Trusted proxy address<input name="proxy_ip"></label>
|
<input name="origin_ip" aria-describedby="origin_ip-hint"></label>
|
||||||
|
{origin_hint}
|
||||||
|
<label>Trusted proxy address
|
||||||
|
<input name="proxy_ip" aria-describedby="proxy_ip-hint"></label>
|
||||||
|
{proxy_hint}
|
||||||
<label>Origin port<input name="origin_port" type="number" value="8080"></label>
|
<label>Origin port<input name="origin_port" type="number" value="8080"></label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset><legend>Administrator</legend>
|
<fieldset><legend>Administrator</legend>
|
||||||
<label>Username<input name="username" value="operator" required></label>
|
<label>Username<input name="username" value="operator" required></label>
|
||||||
<label>Email<input name="email" type="email" required></label>
|
<label>Email<input name="email" type="email" aria-describedby="email-hint"
|
||||||
|
required></label>
|
||||||
|
{email_hint}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{dns}{mail}
|
{dns}{mail}
|
||||||
<fieldset><legend>New hosting accounts</legend>
|
<fieldset><legend>New hosting accounts</legend>
|
||||||
<p>Separate multiple values with commas. You can also set these later.</p>
|
<p>Separate multiple values with commas.</p>
|
||||||
<label>IP addresses for hosted websites<input name="public_addresses"></label>
|
{hosting}
|
||||||
<label>Nameservers for new DNS zones<input name="nameservers"></label>
|
|
||||||
<label>Public sending IPs for hosted email
|
|
||||||
<input name="mail_sending_addresses"></label>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<button type="submit">Review installation</button></form>"""
|
<button type="submit">Review installation</button></form>"""
|
||||||
STYLE = """:root{color-scheme:light}
|
STYLE = """:root{color-scheme:light}
|
||||||
@@ -51,6 +58,8 @@ h1 img{width:1.9rem;height:1.9rem;flex:none}
|
|||||||
body{font:1rem system-ui,sans-serif;max-width:46rem;margin:auto;
|
body{font:1rem system-ui,sans-serif;max-width:46rem;margin:auto;
|
||||||
padding:1rem;color:#14372e} fieldset{margin:1rem 0;border:1px solid #a9beb2;
|
padding:1rem;color:#14372e} fieldset{margin:1rem 0;border:1px solid #a9beb2;
|
||||||
border-radius:.4rem;padding:1rem} label{display:block;margin-bottom:.75rem}
|
border-radius:.4rem;padding:1rem} label{display:block;margin-bottom:.75rem}
|
||||||
|
label:has(+.field-hint){margin-bottom:.25rem}
|
||||||
|
.field-hint{display:block;margin-bottom:.75rem;color:#3f5c52}
|
||||||
input,select{display:block;box-sizing:border-box;width:100%;padding:.45rem;
|
input,select{display:block;box-sizing:border-box;width:100%;padding:.45rem;
|
||||||
margin-top:.25rem} button{background:#195a46;color:white;border:0;
|
margin-top:.25rem} button{background:#195a46;color:white;border:0;
|
||||||
border-radius:.3rem;padding:.75rem 1.1rem;font:inherit} summary{cursor:pointer}
|
border-radius:.3rem;padding:.75rem 1.1rem;font:inherit} summary{cursor:pointer}
|
||||||
@@ -58,15 +67,26 @@ border-radius:.3rem;padding:.75rem 1.1rem;font:inherit} summary{cursor:pointer}
|
|||||||
[role=alert]{color:#8c2828}"""
|
[role=alert]{color:#8c2828}"""
|
||||||
|
|
||||||
|
|
||||||
|
def field_hint(name, message):
|
||||||
|
return (
|
||||||
|
f'<small class="field-hint" id="{name}-hint">{escape(message)}</small>'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def role_form(name):
|
def role_form(name):
|
||||||
title = name.upper() if name == "dns" else "Mail"
|
title = name.upper() if name == "dns" else "Mail"
|
||||||
local = (
|
local = (
|
||||||
"<label>Public mail hostname"
|
"<label>Public mail hostname"
|
||||||
'<input name="mail_local_host"></label>'
|
'<input name="mail_local_host" '
|
||||||
'<label>Mail TLS<select name="mail_tls">'
|
'aria-describedby="mail_local_host-hint">'
|
||||||
|
"</label>"
|
||||||
|
f"{field_hint('mail_local_host', guidance.MAIL_HOSTNAME)}"
|
||||||
|
'<label>Mail TLS<select name="mail_tls" '
|
||||||
|
'aria-describedby="mail_tls-hint">'
|
||||||
'<option value="acme">Let's Encrypt</option>'
|
'<option value="acme">Let's Encrypt</option>'
|
||||||
'<option value="provided">Existing certificate</option>'
|
'<option value="provided">Existing certificate</option>'
|
||||||
"</select></label>"
|
"</select></label>"
|
||||||
|
f"{field_hint('mail_tls', guidance.MAIL_TLS)}"
|
||||||
"<label>Certificate path on the mail host"
|
"<label>Certificate path on the mail host"
|
||||||
'<input name="mail_certificate"></label>'
|
'<input name="mail_certificate"></label>'
|
||||||
"<label>Private key path on the mail host"
|
"<label>Private key path on the mail host"
|
||||||
@@ -74,22 +94,28 @@ def role_form(name):
|
|||||||
if name == "mail"
|
if name == "mail"
|
||||||
else ""
|
else ""
|
||||||
)
|
)
|
||||||
|
role_hint = guidance.DNS_ROLE if name == "dns" else guidance.MAIL_ROLE
|
||||||
return f"""<fieldset><legend>{title}</legend>
|
return f"""<fieldset><legend>{title}</legend>
|
||||||
<label>Role<select name="{name}_mode">
|
<label>Role<select name="{name}_mode" aria-describedby="{name}_mode-hint">
|
||||||
<option value="local">Local service</option>
|
<option value="local">Local service</option>
|
||||||
<option value="off">Disabled</option>
|
<option value="off">Disabled</option>
|
||||||
<option value="remote">Connect an existing Coulobre node</option>
|
<option value="remote">Connect an existing Coulobre node</option>
|
||||||
<option value="remote-install">Install and connect a Coulobre node</option>
|
<option value="remote-install">Install and connect a Coulobre node</option>
|
||||||
</select></label>
|
</select></label>
|
||||||
|
{field_hint(f"{name}_mode", role_hint)}
|
||||||
{local}
|
{local}
|
||||||
<details><summary>Separate node settings</summary>
|
<details><summary>Separate node settings</summary>
|
||||||
<label>SSH hostname or address<input name="{name}_host"></label>
|
<label>SSH hostname or address<input name="{name}_host"></label>
|
||||||
<label>SSH port<input name="{name}_port" type="number" value="22"></label>
|
<label>SSH port<input name="{name}_port" type="number" value="22"></label>
|
||||||
<label>Verified SSH host public key file<input name="{name}_host_key"></label>
|
<label>Verified SSH host public key file
|
||||||
|
<input name="{name}_host_key" aria-describedby="{name}_host_key-hint"></label>
|
||||||
|
{field_hint(f"{name}_host_key", guidance.SSH_HOST_KEY)}
|
||||||
<label>SSH administrator username for installation
|
<label>SSH administrator username for installation
|
||||||
<input name="{name}_ssh_user"></label>
|
<input name="{name}_ssh_user"></label>
|
||||||
<label>SSH administrator key file for installation
|
<label>SSH administrator key file for installation
|
||||||
<input name="{name}_ssh_identity"></label>
|
<input name="{name}_ssh_identity" aria-describedby="{name}_ssh_identity-hint">
|
||||||
|
</label>
|
||||||
|
{field_hint(f"{name}_ssh_identity", guidance.SSH_IDENTITY)}
|
||||||
</details></fieldset>"""
|
</details></fieldset>"""
|
||||||
|
|
||||||
|
|
||||||
@@ -155,7 +181,21 @@ def form_plan(fields):
|
|||||||
|
|
||||||
|
|
||||||
def installation_form(values):
|
def installation_form(values):
|
||||||
html = FORM.format(dns=role_form("dns"), mail=role_form("mail"))
|
hosting = "".join(
|
||||||
|
f'<label>{label}<input name="{name}" aria-describedby="{name}-hint">'
|
||||||
|
f"</label>{field_hint(name, hint)}"
|
||||||
|
for name, label, hint in guidance.HOSTING_FIELDS
|
||||||
|
)
|
||||||
|
html = FORM.format(
|
||||||
|
dns=role_form("dns"),
|
||||||
|
mail=role_form("mail"),
|
||||||
|
hosting=hosting,
|
||||||
|
hostname_hint=field_hint("hostname", guidance.PANEL_HOSTNAME),
|
||||||
|
access_hint=field_hint("access", guidance.PANEL_ACCESS),
|
||||||
|
origin_hint=field_hint("origin_ip", guidance.ORIGIN_ADDRESS),
|
||||||
|
proxy_hint=field_hint("proxy_ip", guidance.PROXY_ADDRESS),
|
||||||
|
email_hint=field_hint("email", guidance.ADMIN_EMAIL),
|
||||||
|
)
|
||||||
|
|
||||||
def restore_field(match):
|
def restore_field(match):
|
||||||
tag = match[0]
|
tag = match[0]
|
||||||
@@ -171,7 +211,7 @@ def installation_form(values):
|
|||||||
|
|
||||||
return re.sub(
|
return re.sub(
|
||||||
r'<input name="(?P<input>[a-z_]+)"[^>]*>|'
|
r'<input name="(?P<input>[a-z_]+)"[^>]*>|'
|
||||||
r'<select name="(?P<select>[a-z_]+)">.*?</select>',
|
r'<select name="(?P<select>[a-z_]+)"[^>]*>.*?</select>',
|
||||||
restore_field,
|
restore_field,
|
||||||
html,
|
html,
|
||||||
flags=re.DOTALL,
|
flags=re.DOTALL,
|
||||||
|
|||||||
+82
-24
@@ -55,6 +55,12 @@ sudo ./deploy/install-panel.py --interactive
|
|||||||
Review the hostname, network mode, administrator, and mail and DNS
|
Review the hostname, network mode, administrator, and mail and DNS
|
||||||
choices before confirming. Enter the password in the terminal or use
|
choices before confirming. Enter the password in the terminal or use
|
||||||
`--admin-password-file` to read it from a root-owned `0600` file.
|
`--admin-password-file` to read it from a root-owned `0600` file.
|
||||||
|
For hosted website DNS, enter the public IPv4 or IPv6 addresses that clients
|
||||||
|
use to reach hosted sites. Choosing `none` leaves the default A and AAAA
|
||||||
|
records unset until you configure hosting addresses.
|
||||||
|
For Coulobre-managed DNS, enter the hostnames of the authoritative
|
||||||
|
nameservers that will serve new zones. For a public domain, set the delegation
|
||||||
|
at its registrar as well.
|
||||||
|
|
||||||
### Automated command line
|
### Automated command line
|
||||||
|
|
||||||
@@ -138,31 +144,67 @@ sudo coulobre-install --interactive
|
|||||||
```
|
```
|
||||||
|
|
||||||
On a fresh server the package stages the release wheel, installer, and remote
|
On a fresh server the package stages the release wheel, installer, and remote
|
||||||
installation service. Run `coulobre-install` after APT exits. It accepts the
|
installation service. APT prints the setup command when the package is ready.
|
||||||
same `--interactive`, `--config`, and `--web` options as the source installer
|
Run `coulobre-install` after APT exits. It accepts the same `--interactive`,
|
||||||
and installs the selected operating system services and Python dependencies.
|
`--config`, and `--web` options as the source installer and installs the
|
||||||
|
selected operating system services and Python dependencies.
|
||||||
|
|
||||||
### Use the Gitea APT repository
|
### Use the Coulobre APT repository
|
||||||
|
|
||||||
Use the `resolute` suite on Ubuntu 26.04 or `trixie` on Debian 13. The `main`
|
Install the repository signing key, then use the source entry for your OS.
|
||||||
component carries final releases. Use `candidate` on a test host to opt in to
|
If you previously added a Coulobre entry to `gitea.list` or
|
||||||
release candidates. A version like `0.13.0~rc1` sorts before `0.13.0` in APT.
|
`hippogrief.list`, remove that entry before enabling `coulobre.sources`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
suite=resolute
|
|
||||||
component=main
|
|
||||||
registry=https://code.hosting.hippogrief.nl/api/packages/hippogrief/debian
|
|
||||||
sudo install -d -m 0755 /etc/apt/keyrings
|
sudo install -d -m 0755 /etc/apt/keyrings
|
||||||
sudo curl -fsS "$registry/repository.key" -o /etc/apt/keyrings/hippogrief.asc
|
sudo curl -fsS https://code.hosting.hippogrief.nl/api/packages/hippogrief/debian/repository.key \
|
||||||
sudo chmod 0644 /etc/apt/keyrings/hippogrief.asc
|
-o /etc/apt/keyrings/coulobre.asc
|
||||||
printf 'deb [signed-by=/etc/apt/keyrings/hippogrief.asc] %s %s %s\n' \
|
sudo chmod 0644 /etc/apt/keyrings/coulobre.asc
|
||||||
"$registry" "$suite" "$component" | sudo tee /etc/apt/sources.list.d/hippogrief.list
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install coulobre-panel
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Set `component=candidate` when testing a release candidate. Gitea adds the
|
#### Ubuntu 26.04 LTS
|
||||||
`main` component to each suite when its first final package is published.
|
|
||||||
|
```sh
|
||||||
|
sudo tee /etc/apt/sources.list.d/coulobre.sources >/dev/null <<'EOF'
|
||||||
|
Types: deb
|
||||||
|
URIs: https://code.hosting.hippogrief.nl/api/packages/hippogrief/debian
|
||||||
|
Suites: resolute
|
||||||
|
Components: main
|
||||||
|
Architectures: all
|
||||||
|
Signed-By: /etc/apt/keyrings/coulobre.asc
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Debian 13
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo tee /etc/apt/sources.list.d/coulobre.sources >/dev/null <<'EOF'
|
||||||
|
Types: deb
|
||||||
|
URIs: https://code.hosting.hippogrief.nl/api/packages/hippogrief/debian
|
||||||
|
Suites: trixie
|
||||||
|
Components: main
|
||||||
|
Architectures: all
|
||||||
|
Signed-By: /etc/apt/keyrings/coulobre.asc
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Install the package
|
||||||
|
|
||||||
|
The `main` component becomes available when the first final package is
|
||||||
|
published. For release candidates, run the following command before updating
|
||||||
|
APT. A candidate such as `0.13.0~rc1` sorts before `0.13.0`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo sed -i 's/^Components: main$/Components: candidate/' /etc/apt/sources.list.d/coulobre.sources
|
||||||
|
```
|
||||||
|
|
||||||
|
Install the package and start the installer on a fresh server.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install coulobre-panel
|
||||||
|
sudo coulobre-install --interactive
|
||||||
|
```
|
||||||
|
|
||||||
[Gitea Debian registry documentation](https://docs.gitea.com/usage/packages/debian/)
|
[Gitea Debian registry documentation](https://docs.gitea.com/usage/packages/debian/)
|
||||||
|
|
||||||
@@ -661,6 +703,12 @@ components, typography, and spacing. Override these values in `:root` and
|
|||||||
`:root[data-appearance="dark"]`. Keep theme assets self-contained and review
|
`:root[data-appearance="dark"]`. Keep theme assets self-contained and review
|
||||||
third-party styles before installing them.
|
third-party styles before installing them.
|
||||||
|
|
||||||
|
The same type scale applies to sign-in and all panel roles. Use
|
||||||
|
`--font-size-title` for page titles, `--font-size-heading` for section
|
||||||
|
headings, `--font-size-body` for content and controls, and
|
||||||
|
`--font-size-small` for secondary labels. Override `--font-family` and
|
||||||
|
`--font-family-mono` to customize the two font stacks.
|
||||||
|
|
||||||
## Upgrade an existing panel
|
## Upgrade an existing panel
|
||||||
|
|
||||||
Download and unpack the new source release. Back up the panel database and
|
Download and unpack the new source release. Back up the panel database and
|
||||||
@@ -2702,12 +2750,22 @@ changes to manager policy and account assignments made through the panel.
|
|||||||
|
|
||||||
### Onboard customers
|
### Onboard customers
|
||||||
|
|
||||||
Managers can open **Add User** to create a customer login and its first
|
Operators and managers can open **Add User** to create a customer login and
|
||||||
hosting account together. Choose an allowed hosting package and give the
|
its first hosting account together. Choose a hosting package and enter 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 password setup link.
|
||||||
password. Preview the email before creating the account. To add a login
|
Use **Preview** to review the email before creating the account. Operators
|
||||||
for an existing unassigned hosting account, open the account and choose
|
can assign a manager during setup or use **Create a login only** to stage
|
||||||
**Add customer login** or **Link existing customer**.
|
access separately. Managers choose from their assigned hosting packages.
|
||||||
|
To add a login for an existing unassigned hosting account, open the account
|
||||||
|
and choose **Add customer login** or **Link existing customer**.
|
||||||
|
|
||||||
|
**Getting started** on the hosting overview shows setup steps for the active
|
||||||
|
workspace. Dismiss or reopen the checklist independently in each workspace.
|
||||||
|
Operators and managers can use **Enable Customer workspace** to access their
|
||||||
|
own hosting through the same login. A server administrator verifies their
|
||||||
|
second factor before enabling the role. An operator can also select **For my
|
||||||
|
own hosting** when adding a hosting account. Coulobre uses the operator's
|
||||||
|
manager profile by default.
|
||||||
|
|
||||||
Operators can open **Contact and invitation** from **Show All Users** to
|
Operators can open **Contact and invitation** from **Show All Users** to
|
||||||
review the welcome email and send a fresh password setup link to a pending
|
review the welcome email and send a fresh password setup link to a pending
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "coulobre-panel"
|
name = "coulobre-panel"
|
||||||
version = "0.13.0rc2"
|
version = "0.13.0rc4"
|
||||||
description = "A web hosting control panel for hosting providers and resellers."
|
description = "A web hosting control panel for hosting providers and resellers."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ from .reseller_accounts import (
|
|||||||
from .resource_requests import lock_hosting_account, require_open_account
|
from .resource_requests import lock_hosting_account, require_open_account
|
||||||
|
|
||||||
|
|
||||||
class ManagerOnboardingForm(InviteLoginForm):
|
class CustomerOnboardingForm(InviteLoginForm):
|
||||||
primary_domain = HostingAccount._meta.get_field(
|
primary_domain = HostingAccount._meta.get_field(
|
||||||
"primary_domain"
|
"primary_domain"
|
||||||
).formfield(required=True)
|
).formfield(required=True)
|
||||||
@@ -77,14 +77,36 @@ class ManagerOnboardingForm(InviteLoginForm):
|
|||||||
help_text="Leave blank to use a password setup link.",
|
help_text="Leave blank to use a password setup link.",
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, *args, manager, defaults, **kwargs):
|
def __init__(
|
||||||
|
self,
|
||||||
|
*args,
|
||||||
|
manager,
|
||||||
|
defaults,
|
||||||
|
capabilities,
|
||||||
|
may_assign_manager,
|
||||||
|
**kwargs,
|
||||||
|
):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.fields["plan"].queryset = manager.hosting_plans.order_by("name")
|
plans = manager.hosting_plans if manager else HostingPlan.objects
|
||||||
self.fields["manage_dns"].disabled = not default_dns_zones_allowed(
|
self.fields["plan"].queryset = plans.order_by("name")
|
||||||
defaults
|
if may_assign_manager:
|
||||||
|
self.fields["manager"] = forms.ModelChoiceField(
|
||||||
|
queryset=Reseller.objects.filter(user__is_active=True)
|
||||||
|
.select_related("user")
|
||||||
|
.order_by("user__username"),
|
||||||
|
required=False,
|
||||||
|
empty_label="Direct customer",
|
||||||
|
help_text="Give this manager access to the new account.",
|
||||||
|
)
|
||||||
|
self.order_fields(
|
||||||
|
["username", "email", "primary_domain", "plan", "manager"]
|
||||||
|
)
|
||||||
|
self.fields["manage_dns"].disabled = not (
|
||||||
|
capabilities["manage_dns"] and default_dns_zones_allowed(defaults)
|
||||||
)
|
)
|
||||||
self.fields["manage_mail"].disabled = not panel_feature_allowed(
|
self.fields["manage_mail"].disabled = not (
|
||||||
"LOCAL_MAILBOX_PROVISIONING"
|
capabilities["manage_mail"]
|
||||||
|
and panel_feature_allowed("LOCAL_MAILBOX_PROVISIONING")
|
||||||
)
|
)
|
||||||
|
|
||||||
def clean_primary_domain(self):
|
def clean_primary_domain(self):
|
||||||
@@ -118,8 +140,8 @@ class ManagerOnboardingForm(InviteLoginForm):
|
|||||||
@method_decorator(
|
@method_decorator(
|
||||||
sensitive_post_parameters("initial_password"), name="dispatch"
|
sensitive_post_parameters("initial_password"), name="dispatch"
|
||||||
)
|
)
|
||||||
class ManagerOnboardingView(UserPassesTestMixin, FormView):
|
class CustomerOnboardingView(UserPassesTestMixin, FormView):
|
||||||
form_class = ManagerOnboardingForm
|
form_class = CustomerOnboardingForm
|
||||||
template_name = "hosting/workspace_form.html"
|
template_name = "hosting/workspace_form.html"
|
||||||
extra_context = {
|
extra_context = {
|
||||||
"title": "Add user",
|
"title": "Add user",
|
||||||
@@ -129,12 +151,38 @@ class ManagerOnboardingView(UserPassesTestMixin, FormView):
|
|||||||
|
|
||||||
def test_func(self):
|
def test_func(self):
|
||||||
self.manager = reseller_for_user(self.request.user)
|
self.manager = reseller_for_user(self.request.user)
|
||||||
return self.manager is not None
|
return self.manager is not None or can_onboard_customer(
|
||||||
|
self.request.user
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
return super().get_context_data(
|
||||||
|
login_only_url=reverse_lazy("panel:customer_create")
|
||||||
|
if self.manager is None
|
||||||
|
else None,
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
|
|
||||||
|
def capabilities(self):
|
||||||
|
from .views import ACTIVATE_WEB, PROVISION_MAILBOX, PUBLISH_DNS
|
||||||
|
|
||||||
|
actor = self.request.user
|
||||||
|
return {
|
||||||
|
key: self.manager is not None or actor.has_perms(required)
|
||||||
|
for key, required in (
|
||||||
|
("website", ACTIVATE_WEB),
|
||||||
|
("manage_dns", (*PUBLISH_DNS, "hosting.add_hostingdnszone")),
|
||||||
|
("manage_mail", PROVISION_MAILBOX),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
def get_form_kwargs(self):
|
def get_form_kwargs(self):
|
||||||
return super().get_form_kwargs() | {
|
return super().get_form_kwargs() | {
|
||||||
"manager": self.manager,
|
"manager": self.manager,
|
||||||
"defaults": zone_defaults(),
|
"defaults": zone_defaults(),
|
||||||
|
"capabilities": self.capabilities(),
|
||||||
|
"may_assign_manager": self.manager is None
|
||||||
|
and self.request.user.has_perm("hosting.view_reseller"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
@@ -156,21 +204,27 @@ class ManagerOnboardingView(UserPassesTestMixin, FormView):
|
|||||||
self.get_context_data(form=form, welcome_preview=preview)
|
self.get_context_data(form=form, welcome_preview=preview)
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
|
capabilities = self.capabilities()
|
||||||
|
manager = self.manager or data.get("manager")
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
user = form.save(commit=False)
|
user = form.save(commit=False)
|
||||||
if data["initial_password"]:
|
if data["initial_password"]:
|
||||||
user.set_password(data["initial_password"])
|
user.set_password(data["initial_password"])
|
||||||
user.save()
|
user.save()
|
||||||
customer = Customer.objects.create(
|
customer = Customer.objects.create(user=user, reseller=manager)
|
||||||
user=user, reseller=self.manager
|
|
||||||
)
|
|
||||||
account = HostingAccount(
|
account = HostingAccount(
|
||||||
name=user.get_username(),
|
name=user.get_username(),
|
||||||
primary_domain=data["primary_domain"],
|
primary_domain=data["primary_domain"],
|
||||||
customer=customer,
|
customer=customer,
|
||||||
hosting_plan=data["plan"],
|
hosting_plan=data["plan"],
|
||||||
|
reseller=manager,
|
||||||
)
|
)
|
||||||
create_reseller_account(self.manager, account)
|
if self.manager is not None:
|
||||||
|
create_reseller_account(self.manager, account)
|
||||||
|
else:
|
||||||
|
save_operator_account(
|
||||||
|
account, self.request.user.get_username()
|
||||||
|
)
|
||||||
DomainServicePolicy.objects.create(
|
DomainServicePolicy.objects.create(
|
||||||
account=account,
|
account=account,
|
||||||
domain=account.primary_domain,
|
domain=account.primary_domain,
|
||||||
@@ -181,9 +235,8 @@ class ManagerOnboardingView(UserPassesTestMixin, FormView):
|
|||||||
setup_new_account(
|
setup_new_account(
|
||||||
account,
|
account,
|
||||||
{
|
{
|
||||||
"setup_website": panel_feature_allowed(
|
"setup_website": capabilities["website"]
|
||||||
"LOCAL_WEB_ACTIVATION"
|
and panel_feature_allowed("LOCAL_WEB_ACTIVATION"),
|
||||||
),
|
|
||||||
"setup_dns": data["manage_dns"],
|
"setup_dns": data["manage_dns"],
|
||||||
"setup_email": data["manage_mail"],
|
"setup_email": data["manage_mail"],
|
||||||
"setup_www": defaults.include_www,
|
"setup_www": defaults.include_www,
|
||||||
@@ -215,6 +268,18 @@ class ManagerOnboardingView(UserPassesTestMixin, FormView):
|
|||||||
return redirect(account)
|
return redirect(account)
|
||||||
|
|
||||||
|
|
||||||
|
def can_onboard_customer(user):
|
||||||
|
return user.has_perms(
|
||||||
|
(
|
||||||
|
"hosting.view_customer",
|
||||||
|
"hosting.add_customer",
|
||||||
|
"hosting.view_hostingaccount",
|
||||||
|
"hosting.add_hostingaccount",
|
||||||
|
"hosting.view_hostingplan",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class ManagerPackagesView(UserPassesTestMixin, ListView):
|
class ManagerPackagesView(UserPassesTestMixin, ListView):
|
||||||
template_name = "hosting/manager_packages.html"
|
template_name = "hosting/manager_packages.html"
|
||||||
context_object_name = "plans"
|
context_object_name = "plans"
|
||||||
@@ -265,6 +330,9 @@ class AllUsersView(OperatorOnlyMixin, PermissionRequiredMixin, ListView):
|
|||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
context["has_combined_onboarding"] = can_onboard_customer(
|
||||||
|
self.request.user
|
||||||
|
)
|
||||||
profiles = [
|
profiles = [
|
||||||
getattr(user, "hosting_customer", None)
|
getattr(user, "hosting_customer", None)
|
||||||
for user in context["logins"]
|
for user in context["logins"]
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Generated by Django 5.2.19 on 2026-11-24 11:58
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("hosting", "0078_manager_labels"),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="OnboardingDismissal",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("role", models.CharField(max_length=16)),
|
||||||
|
(
|
||||||
|
"user",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to=settings.AUTH_USER_MODEL,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"constraints": [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=("user", "role"),
|
||||||
|
name="hosting_onboarding_dismissal",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -1540,6 +1540,20 @@ class PanelFactorEnrollment(models.Model):
|
|||||||
expires_at = models.DateTimeField(db_index=True)
|
expires_at = models.DateTimeField(db_index=True)
|
||||||
|
|
||||||
|
|
||||||
|
class OnboardingDismissal(models.Model):
|
||||||
|
user = models.ForeignKey(
|
||||||
|
settings.AUTH_USER_MODEL, on_delete=models.CASCADE
|
||||||
|
)
|
||||||
|
role = models.CharField(max_length=16)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
constraints = [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=("user", "role"), name="hosting_onboarding_dismissal"
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class PanelRecoveryCode(models.Model):
|
class PanelRecoveryCode(models.Model):
|
||||||
user = models.ForeignKey(
|
user = models.ForeignKey(
|
||||||
settings.AUTH_USER_MODEL, on_delete=models.CASCADE
|
settings.AUTH_USER_MODEL, on_delete=models.CASCADE
|
||||||
|
|||||||
@@ -38,11 +38,18 @@ def assigned_roles(user):
|
|||||||
roles = {}
|
roles = {}
|
||||||
if user.is_superuser:
|
if user.is_superuser:
|
||||||
roles[PanelRole.ADMIN] = user.pk
|
roles[PanelRole.ADMIN] = user.pk
|
||||||
|
manager = getattr(user, "hosting_reseller", None)
|
||||||
customer = getattr(user, "hosting_customer", None)
|
customer = getattr(user, "hosting_customer", None)
|
||||||
|
own_customer = (
|
||||||
|
customer is not None
|
||||||
|
and manager is not None
|
||||||
|
and customer.reseller_id == manager.pk
|
||||||
|
)
|
||||||
|
if manager is not None and own_customer:
|
||||||
|
roles[PanelRole.MANAGER] = manager.pk
|
||||||
if customer is not None:
|
if customer is not None:
|
||||||
roles[PanelRole.CUSTOMER] = customer.pk
|
roles[PanelRole.CUSTOMER] = customer.pk
|
||||||
manager = getattr(user, "hosting_reseller", None)
|
if manager is not None and not own_customer:
|
||||||
if manager is not None:
|
|
||||||
roles[PanelRole.MANAGER] = manager.pk
|
roles[PanelRole.MANAGER] = manager.pk
|
||||||
return roles
|
return roles
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,15 @@
|
|||||||
--row-padding: 0.55rem 0.85rem;
|
--row-padding: 0.55rem 0.85rem;
|
||||||
--section-gap: 0.9rem;
|
--section-gap: 0.9rem;
|
||||||
--font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
--font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||||
font: 100%/1.45 var(--font-family);
|
--font-family-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
|
||||||
|
--font-size-small: 0.75rem;
|
||||||
|
--font-size-body: 0.875rem;
|
||||||
|
--font-size-heading: 1rem;
|
||||||
|
--font-size-title: clamp(1.55rem, 2.5vw, 2rem);
|
||||||
|
--font-weight-semibold: 600;
|
||||||
|
--font-weight-bold: 700;
|
||||||
|
font-family: var(--font-family);
|
||||||
|
line-height: 1.45;
|
||||||
}
|
}
|
||||||
|
|
||||||
:root[data-appearance="dark"] {
|
:root[data-appearance="dark"] {
|
||||||
@@ -91,6 +99,7 @@ body {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
background: var(--page);
|
background: var(--page);
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
|
font-size: var(--font-size-body);
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
@@ -102,6 +111,35 @@ button, input, select, textarea {
|
|||||||
font: inherit;
|
font: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input, select, textarea {
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
input::file-selector-button {
|
||||||
|
font: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
small, dt, thead th {
|
||||||
|
font-size: var(--font-size-small);
|
||||||
|
}
|
||||||
|
|
||||||
|
strong, b {
|
||||||
|
font-weight: var(--font-weight-bold);
|
||||||
|
}
|
||||||
|
|
||||||
|
pre, code, kbd, samp, .domain, .recovery-codes {
|
||||||
|
font-family: var(--font-family-mono);
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.domain, code {
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
:focus-visible {
|
:focus-visible {
|
||||||
outline: 3px solid var(--focus);
|
outline: 3px solid var(--focus);
|
||||||
outline-offset: 3px;
|
outline-offset: 3px;
|
||||||
@@ -153,8 +191,8 @@ button, input, select, textarea {
|
|||||||
gap: 0.65rem;
|
gap: 0.65rem;
|
||||||
padding: 0.25rem 0.45rem;
|
padding: 0.25rem 0.45rem;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
font-size: 1.06rem;
|
font-size: var(--font-size-heading);
|
||||||
font-weight: 750;
|
font-weight: var(--font-weight-bold);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
@@ -186,7 +224,7 @@ button, input, select, textarea {
|
|||||||
|
|
||||||
.brand-product {
|
.brand-product {
|
||||||
color: var(--brand-muted);
|
color: var(--brand-muted);
|
||||||
font-weight: 500;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navigation {
|
.navigation {
|
||||||
@@ -214,7 +252,6 @@ button, input, select, textarea {
|
|||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
color: var(--sidebar-link);
|
color: var(--sidebar-link);
|
||||||
font-size: 0.9rem;
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +263,7 @@ button, input, select, textarea {
|
|||||||
|
|
||||||
.navigation a[aria-current] {
|
.navigation a[aria-current] {
|
||||||
box-shadow: inset 3px 0 var(--sidebar-highlight);
|
box-shadow: inset 3px 0 var(--sidebar-highlight);
|
||||||
font-weight: 650;
|
font-weight: var(--font-weight-semibold);
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-toggle {
|
.menu-toggle {
|
||||||
@@ -240,8 +277,7 @@ button, input, select, textarea {
|
|||||||
background: var(--sidebar-active);
|
background: var(--sidebar-active);
|
||||||
color: var(--sidebar-text);
|
color: var(--sidebar-text);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 0.85rem;
|
font-weight: var(--font-weight-semibold);
|
||||||
font-weight: 650;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-icon {
|
.menu-icon {
|
||||||
@@ -285,7 +321,6 @@ button, input, select, textarea {
|
|||||||
margin-top: auto;
|
margin-top: auto;
|
||||||
padding-top: 0.7rem;
|
padding-top: 0.7rem;
|
||||||
border-top: 1px solid var(--sidebar-divider);
|
border-top: 1px solid var(--sidebar-divider);
|
||||||
font-size: 0.88rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-account-controls {
|
.sidebar-account-controls {
|
||||||
@@ -303,7 +338,7 @@ button, input, select, textarea {
|
|||||||
min-height: 2.2rem;
|
min-height: 2.2rem;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
color: var(--sidebar-text);
|
color: var(--sidebar-text);
|
||||||
font-weight: 650;
|
font-weight: var(--font-weight-semibold);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,7 +365,6 @@ a.sidebar-identity:hover {
|
|||||||
|
|
||||||
.panel-role-switch {
|
.panel-role-switch {
|
||||||
position: relative;
|
position: relative;
|
||||||
font-size: 0.82rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-role-switch summary {
|
.panel-role-switch summary {
|
||||||
@@ -344,7 +378,8 @@ a.sidebar-identity:hover {
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
padding: 0.35rem 0.55rem;
|
padding: 0.35rem 0.55rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-weight: 650;
|
font-size: var(--font-size-small);
|
||||||
|
font-weight: var(--font-weight-semibold);
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,13 +453,12 @@ a.sidebar-identity:hover {
|
|||||||
|
|
||||||
.panel-role-option small {
|
.panel-role-option small {
|
||||||
color: var(--sidebar-account);
|
color: var(--sidebar-account);
|
||||||
font-size: 0.75rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-role-current {
|
.panel-role-current {
|
||||||
color: var(--sidebar-highlight);
|
color: var(--sidebar-highlight);
|
||||||
font-size: 0.75rem;
|
font-size: var(--font-size-small);
|
||||||
font-weight: 650;
|
font-weight: var(--font-weight-semibold);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-action {
|
.sidebar-action {
|
||||||
@@ -435,7 +469,6 @@ a.sidebar-identity:hover {
|
|||||||
background: transparent;
|
background: transparent;
|
||||||
color: var(--sidebar-account);
|
color: var(--sidebar-account);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 0.82rem;
|
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +487,7 @@ a.sidebar-identity:hover {
|
|||||||
|
|
||||||
.appearance-control {
|
.appearance-control {
|
||||||
min-width: 2.2rem;
|
min-width: 2.2rem;
|
||||||
font-size: 1rem;
|
font-size: var(--font-size-heading);
|
||||||
}
|
}
|
||||||
|
|
||||||
.main {
|
.main {
|
||||||
@@ -480,27 +513,32 @@ a.sidebar-identity:hover {
|
|||||||
margin-top: 0.2rem;
|
margin-top: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, h2, p, dl {
|
h1, h2, h3, h4, h5, h6, p, dl {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-weight: var(--font-weight-bold);
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
font-size: clamp(1.55rem, 3vw, 2.35rem);
|
font-size: var(--font-size-title);
|
||||||
font-weight: 760;
|
letter-spacing: -0.03em;
|
||||||
letter-spacing: -0.045em;
|
|
||||||
line-height: 1.12;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
font-size: 1.12rem;
|
font-size: var(--font-size-heading);
|
||||||
font-weight: 700;
|
}
|
||||||
|
|
||||||
|
h3, h4, h5, h6 {
|
||||||
|
font-size: var(--font-size-body);
|
||||||
}
|
}
|
||||||
|
|
||||||
.heading-meta {
|
.heading-meta {
|
||||||
margin-top: 0.5rem;
|
margin-top: 0.5rem;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
font-size: 0.92rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.surface {
|
.surface {
|
||||||
@@ -530,8 +568,7 @@ h2 {
|
|||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 0.9rem;
|
font-weight: var(--font-weight-semibold);
|
||||||
font-weight: 650;
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,7 +624,7 @@ h2 {
|
|||||||
|
|
||||||
.update-release > summary {
|
.update-release > summary {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-weight: 680;
|
font-weight: var(--font-weight-semibold);
|
||||||
}
|
}
|
||||||
|
|
||||||
.release-notes {
|
.release-notes {
|
||||||
@@ -597,8 +634,11 @@ h2 {
|
|||||||
|
|
||||||
.release-notes :is(h1, h2, h3, h4, h5, h6) {
|
.release-notes :is(h1, h2, h3, h4, h5, h6) {
|
||||||
margin: 1rem 0 0.25rem;
|
margin: 1rem 0 0.25rem;
|
||||||
font-size: 1rem;
|
}
|
||||||
line-height: 1.3;
|
|
||||||
|
.release-notes h1 {
|
||||||
|
font-size: var(--font-size-heading);
|
||||||
|
letter-spacing: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.release-notes :is(p, ul, ol, pre, blockquote) {
|
.release-notes :is(p, ul, ol, pre, blockquote) {
|
||||||
@@ -614,7 +654,6 @@ h2 {
|
|||||||
border-radius: 0.4rem;
|
border-radius: 0.4rem;
|
||||||
background: var(--code-bg);
|
background: var(--code-bg);
|
||||||
color: var(--code-text);
|
color: var(--code-text);
|
||||||
font-size: 0.85rem;
|
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,8 +716,7 @@ h2 {
|
|||||||
min-height: 2.5rem;
|
min-height: 2.5rem;
|
||||||
padding: 0.5rem 0.75rem;
|
padding: 0.5rem 0.75rem;
|
||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
font-size: 0.9rem;
|
font-weight: var(--font-weight-semibold);
|
||||||
font-weight: 680;
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -711,7 +749,6 @@ h2 {
|
|||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
border-top: 1px solid var(--line);
|
border-top: 1px solid var(--line);
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
font-size: 0.88rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input:not([type="hidden"], [type="checkbox"], [type="radio"]),
|
input:not([type="hidden"], [type="checkbox"], [type="radio"]),
|
||||||
@@ -741,8 +778,7 @@ input::placeholder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.quiet-link, .back-link {
|
.quiet-link, .back-link {
|
||||||
font-size: 0.88rem;
|
font-weight: var(--font-weight-semibold);
|
||||||
font-weight: 600;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.back-link {
|
.back-link {
|
||||||
@@ -763,19 +799,14 @@ table {
|
|||||||
th, td {
|
th, td {
|
||||||
padding: var(--row-padding);
|
padding: var(--row-padding);
|
||||||
border-top: 1px solid var(--line);
|
border-top: 1px solid var(--line);
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: break-word;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
|
||||||
th {
|
th {
|
||||||
background: var(--table-heading);
|
background: var(--table-heading);
|
||||||
color: var(--table-heading-text);
|
color: var(--table-heading-text);
|
||||||
font-size: 0.78rem;
|
font-weight: var(--font-weight-semibold);
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
|
||||||
font-size: 0.93rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tbody tr:hover {
|
tbody tr:hover {
|
||||||
@@ -801,16 +832,7 @@ tbody tr:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.record-link {
|
.record-link {
|
||||||
font-weight: 650;
|
font-weight: var(--font-weight-semibold);
|
||||||
}
|
|
||||||
|
|
||||||
.domain, code {
|
|
||||||
font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
|
|
||||||
overflow-wrap: anywhere;
|
|
||||||
}
|
|
||||||
|
|
||||||
.domain {
|
|
||||||
font-size: 0.88rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.muted, .empty {
|
.muted, .empty {
|
||||||
@@ -819,7 +841,6 @@ tbody tr:hover {
|
|||||||
|
|
||||||
.empty, .notice {
|
.empty, .notice {
|
||||||
padding: 1.1rem 1.2rem;
|
padding: 1.1rem 1.2rem;
|
||||||
font-size: 0.94rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.details {
|
.details {
|
||||||
@@ -836,8 +857,7 @@ tbody tr:hover {
|
|||||||
|
|
||||||
dt {
|
dt {
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
font-size: 0.8rem;
|
font-weight: var(--font-weight-semibold);
|
||||||
font-weight: 650;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dd {
|
dd {
|
||||||
@@ -875,8 +895,8 @@ dd {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0.18rem 0.62rem;
|
padding: 0.18rem 0.62rem;
|
||||||
border-radius: 0.75rem;
|
border-radius: 0.75rem;
|
||||||
font-size: 0.78rem;
|
font-size: var(--font-size-small);
|
||||||
font-weight: 680;
|
font-weight: var(--font-weight-semibold);
|
||||||
}
|
}
|
||||||
|
|
||||||
.status::before {
|
.status::before {
|
||||||
@@ -907,13 +927,10 @@ dd {
|
|||||||
|
|
||||||
.configuration {
|
.configuration {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
overflow-x: auto;
|
|
||||||
padding: 1.2rem;
|
padding: 1.2rem;
|
||||||
border-radius: 0 0 var(--radius) var(--radius);
|
border-radius: 0 0 var(--radius) var(--radius);
|
||||||
background: var(--code-bg);
|
background: var(--code-bg);
|
||||||
color: var(--code-text);
|
color: var(--code-text);
|
||||||
font-size: 0.88rem;
|
|
||||||
line-height: 1.6;
|
|
||||||
tab-size: 4;
|
tab-size: 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -930,8 +947,7 @@ dd {
|
|||||||
.editor label {
|
.editor label {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 0.35rem;
|
margin-bottom: 0.35rem;
|
||||||
font-size: 0.88rem;
|
font-weight: var(--font-weight-semibold);
|
||||||
font-weight: 680;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor input:not([type="hidden"], [type="checkbox"], [type="radio"]),
|
.editor input:not([type="hidden"], [type="checkbox"], [type="radio"]),
|
||||||
@@ -963,8 +979,8 @@ dd {
|
|||||||
border: 1px solid var(--control-line);
|
border: 1px solid var(--control-line);
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
color: var(--accent);
|
color: var(--accent);
|
||||||
font-size: 0.8rem;
|
font-size: var(--font-size-small);
|
||||||
font-weight: 700;
|
font-weight: var(--font-weight-bold);
|
||||||
list-style: none;
|
list-style: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
@@ -990,7 +1006,6 @@ dd {
|
|||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
background: var(--surface);
|
background: var(--surface);
|
||||||
box-shadow: 0 4px 12px var(--surface-shadow);
|
box-shadow: 0 4px 12px var(--surface-shadow);
|
||||||
font-size: 0.88rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.dns-surface {
|
.dns-surface {
|
||||||
@@ -1032,7 +1047,7 @@ dd {
|
|||||||
|
|
||||||
.reseller-editor legend {
|
.reseller-editor legend {
|
||||||
margin-bottom: 0.65rem;
|
margin-bottom: 0.65rem;
|
||||||
font-weight: 680;
|
font-weight: var(--font-weight-semibold);
|
||||||
}
|
}
|
||||||
|
|
||||||
.reseller-editor input[type="checkbox"] {
|
.reseller-editor input[type="checkbox"] {
|
||||||
@@ -1043,7 +1058,6 @@ dd {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0 0 0 1.1rem;
|
padding: 0 0 0 1.1rem;
|
||||||
color: var(--invalid);
|
color: var(--invalid);
|
||||||
font-size: 0.87rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor [aria-invalid="true"] {
|
.editor [aria-invalid="true"] {
|
||||||
@@ -1076,7 +1090,6 @@ dd {
|
|||||||
|
|
||||||
.sign-in-card h1 {
|
.sign-in-card h1 {
|
||||||
margin-bottom: 1.25rem;
|
margin-bottom: 1.25rem;
|
||||||
font-size: 2rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.authenticator-setup {
|
.authenticator-setup {
|
||||||
@@ -1094,7 +1107,6 @@ dd {
|
|||||||
.recovery-codes {
|
.recovery-codes {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-block: 0.75rem;
|
margin-block: 0.75rem;
|
||||||
font-family: monospace;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 780px) {
|
@media (max-width: 780px) {
|
||||||
@@ -1111,10 +1123,6 @@ dd {
|
|||||||
padding: 0.65rem 0.75rem;
|
padding: 0.65rem 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand {
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.brand-mark {
|
.brand-mark {
|
||||||
width: 1.95rem;
|
width: 1.95rem;
|
||||||
height: 1.95rem;
|
height: 1.95rem;
|
||||||
@@ -1290,7 +1298,7 @@ dd {
|
|||||||
.account-navigation [aria-current] {
|
.account-navigation [aria-current] {
|
||||||
border-bottom: 2px solid var(--accent);
|
border-bottom: 2px solid var(--accent);
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
font-weight: 700;
|
font-weight: var(--font-weight-bold);
|
||||||
}
|
}
|
||||||
|
|
||||||
.account-readiness {
|
.account-readiness {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<header class="page-heading">
|
<header class="page-heading">
|
||||||
<div>
|
<div>
|
||||||
<h1>{% if is_customer %}My hosting{% elif is_reseller %}Customer hosting{% else %}Hosting accounts{% endif %}</h1>
|
<h1>{% if is_customer %}My hosting{% elif is_reseller %}Customer hosting{% else %}Hosting accounts{% endif %}</h1>
|
||||||
{% if is_operator %}<p class="heading-meta">Manage domains and their hosting services. Link a customer to give them access.</p>{% endif %}
|
{% if is_operator %}<p class="heading-meta">Manage domains and their hosting services. A linked customer login can manage them in the panel.</p>{% endif %}
|
||||||
<p class="heading-meta">{{ paginator.count }} account{{ paginator.count|pluralize }}{% if search %} matching your search{% endif %}</p>
|
<p class="heading-meta">{{ paginator.count }} account{{ paginator.count|pluralize }}{% if search %} matching your search{% endif %}</p>
|
||||||
{% if account_allowance %}<p class="heading-meta">{{ account_allowance.used }} of {{ account_allowance.limit }} accounts allocated</p>{% endif %}
|
{% if account_allowance %}<p class="heading-meta">{{ account_allowance.used }} of {{ account_allowance.limit }} accounts allocated</p>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block page_content %}
|
{% block page_content %}
|
||||||
|
{% include "hosting/workspace_onboarding.html" %}
|
||||||
{% if is_reseller %}
|
{% if is_reseller %}
|
||||||
<section class="surface section-heading" aria-label="Customer access">
|
<section class="surface section-heading" aria-label="Customer access">
|
||||||
<p>Manage the logins for your assigned customers.</p>
|
<p>Manage the logins for your assigned customers.</p>
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
{% 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 %}
|
{% block page_actions %}
|
||||||
{% if perms.hosting.add_customer %}
|
{% if has_combined_onboarding %}
|
||||||
|
<a class="button primary" href="{% url 'panel:customer_onboarding' %}">Add user</a>
|
||||||
|
{% elif perms.hosting.add_customer %}
|
||||||
<a class="button primary" href="{% url 'panel:customer_create' %}">Add user</a>
|
<a class="button primary" href="{% url 'panel:customer_create' %}">Add user</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -24,7 +26,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{{ login.get_username }}</th>
|
<th scope="row">{{ login.get_username }}</th>
|
||||||
<td>{% if login.is_superuser %}Operator{% elif login.hosting_reseller %}Manager{% else %}Customer{% endif %}</td>
|
<td>{% if login.is_superuser %}Operator{% elif login.hosting_reseller %}Manager{% else %}Customer{% endif %}</td>
|
||||||
<td>{{ login.hosting_customer.reseller|default:"Unassigned" }}</td>
|
<td>{% if login.hosting_customer %}{{ login.hosting_customer.reseller|default_if_none:"Unassigned" }}{% else %}<span class="muted" aria-label="No customer profile">—</span>{% endif %}</td>
|
||||||
<td>{{ login.account_count }}</td>
|
<td>{{ login.account_count }}</td>
|
||||||
{% include "hosting/account_metrics_cells.html" %}
|
{% include "hosting/account_metrics_cells.html" %}
|
||||||
<td>{{ login.date_joined|date:"j M Y" }}</td>
|
<td>{{ login.date_joined|date:"j M Y" }}</td>
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{% extends "hosting/update_workspace.html" %}
|
||||||
|
{% load release_notes %}
|
||||||
|
|
||||||
|
{% block title %}Changelog · Coulobre Panel{% endblock %}
|
||||||
|
|
||||||
|
{% block page_content %}
|
||||||
|
<section class="surface" aria-labelledby="release-history">
|
||||||
|
<header class="section-heading">
|
||||||
|
<h2 id="release-history">Release history</h2>
|
||||||
|
<a class="button secondary" href="{{ releases_url }}">All releases on Gitea</a>
|
||||||
|
</header>
|
||||||
|
{% if catalog_unavailable %}
|
||||||
|
<p class="empty">The release history is temporarily unavailable. Try again later or open Gitea.</p>
|
||||||
|
{% else %}
|
||||||
|
{% for entry in entries %}
|
||||||
|
<details class="section-text update-release"{% if forloop.first %} open{% endif %}>
|
||||||
|
<summary>
|
||||||
|
{{ entry.version }}{% if entry.prerelease %} · Prerelease{% endif %}
|
||||||
|
{% if entry.published_at %} · <time datetime="{{ entry.published_at|date:'c' }}">{{ entry.published_at|date:"j M Y" }}</time>{% endif %}
|
||||||
|
</summary>
|
||||||
|
{% if entry.notes %}
|
||||||
|
<div class="release-notes">{{ entry.notes|release_notes_html }}</div>
|
||||||
|
{% else %}
|
||||||
|
<p class="muted">No release notes were published.</p>
|
||||||
|
{% endif %}
|
||||||
|
<p><a href="{{ entry.url }}">View {{ entry.version }} on Gitea</a></p>
|
||||||
|
</details>
|
||||||
|
{% empty %}
|
||||||
|
<p class="empty">No Coulobre releases have been published yet.</p>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
@@ -8,6 +8,9 @@
|
|||||||
<header class="section-heading"><h2 id="installation-heading">Installation</h2></header>
|
<header class="section-heading"><h2 id="installation-heading">Installation</h2></header>
|
||||||
<dl class="details">
|
<dl class="details">
|
||||||
<div><dt>Installed version</dt><dd>{{ installed_version }}</dd></div>
|
<div><dt>Installed version</dt><dd>{{ installed_version }}</dd></div>
|
||||||
|
{% if request.user.is_superuser %}
|
||||||
|
<div><dt>Release history</dt><dd><a href="{% url 'panel:changelog' %}">Changelog</a></dd></div>
|
||||||
|
{% endif %}
|
||||||
<div><dt>Core software license</dt><dd>Apache License 2.0</dd></div>
|
<div><dt>Core software license</dt><dd>Apache License 2.0</dd></div>
|
||||||
<div><dt>Project</dt><dd><a href="https://code.hosting.hippogrief.nl/hippogrief/coulobre">Source repository</a> · <a href="https://code.hosting.hippogrief.nl/hippogrief/coulobre/issues">Issue tracker</a></dd></div>
|
<div><dt>Project</dt><dd><a href="https://code.hosting.hippogrief.nl/hippogrief/coulobre">Source repository</a> · <a href="https://code.hosting.hippogrief.nl/hippogrief/coulobre/issues">Issue tracker</a></dd></div>
|
||||||
</dl>
|
</dl>
|
||||||
|
|||||||
@@ -11,18 +11,20 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block page_content %}
|
{% block page_content %}
|
||||||
<section class="surface">
|
<section class="surface">
|
||||||
<table>
|
<div class="table-scroll">
|
||||||
<thead><tr><th scope="col">Package</th><th scope="col">Account limit</th></tr></thead>
|
<table>
|
||||||
<tbody>
|
<thead><tr><th scope="col">Package</th><th scope="col">Account limit</th></tr></thead>
|
||||||
{% for profile in object_list %}
|
<tbody>
|
||||||
<tr>
|
{% for profile in object_list %}
|
||||||
<td><a href="{% url 'panel:reseller_profile_edit' profile.pk %}">{{ profile.name }}</a>{% if profile.default_slot %} · Default{% endif %}</td>
|
<tr>
|
||||||
<td>{% if profile.account_limit %}{{ profile.account_limit }}{% else %}Manage existing accounts only{% endif %}</td>
|
<td><a href="{% url 'panel:reseller_profile_edit' profile.pk %}">{{ profile.name }}</a>{% if profile.default_slot %} · Default{% endif %}</td>
|
||||||
</tr>
|
<td>{% if profile.account_limit %}{{ profile.account_limit }}{% else %}Manage existing accounts only{% endif %}</td>
|
||||||
{% empty %}
|
</tr>
|
||||||
<tr><td colspan="2">No manager packages yet. Add one to reuse account limits and a set of hosting packages.</td></tr>
|
{% empty %}
|
||||||
{% endfor %}
|
<tr><td colspan="2">No manager packages yet. Add one to reuse account limits and a set of hosting packages.</td></tr>
|
||||||
</tbody>
|
{% endfor %}
|
||||||
</table>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
{% extends "hosting/workspace_page.html" %}
|
{% extends "hosting/workspace_page.html" %}
|
||||||
{% block page_title %}Updates{% endblock %}
|
{% block page_title %}Updates{% endblock %}
|
||||||
{% block page_tabs %}
|
{% block page_tabs %}
|
||||||
<nav class="account-navigation" aria-label="Update types">
|
<nav class="account-navigation" aria-label="Updates">
|
||||||
<a href="{% url 'panel:updates' %}"{% if request.resolver_match.url_name == 'updates' %} aria-current="page"{% endif %}>Coulobre</a>
|
<a href="{% url 'panel:updates' %}"{% if request.resolver_match.url_name == 'updates' %} aria-current="page"{% endif %}>Coulobre</a>
|
||||||
<a href="{% url 'panel:server_updates' %}"{% if request.resolver_match.url_name == 'server_updates' %} aria-current="page"{% endif %}>Server packages</a>
|
<a href="{% url 'panel:server_updates' %}"{% if request.resolver_match.url_name == 'server_updates' %} aria-current="page"{% endif %}>Server packages</a>
|
||||||
|
<a href="{% url 'panel:changelog' %}"{% if request.resolver_match.url_name == 'changelog' %} aria-current="page"{% endif %}>Changelog</a>
|
||||||
</nav>
|
</nav>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -2,6 +2,9 @@
|
|||||||
{% block title %}{{ title }} · Coulobre Panel{% endblock %}
|
{% block title %}{{ title }} · Coulobre Panel{% endblock %}
|
||||||
{% block page_title %}{{ title }}{% endblock %}
|
{% block page_title %}{{ title }}{% endblock %}
|
||||||
{% block page_content %}
|
{% block page_content %}
|
||||||
|
{% if login_only_url %}
|
||||||
|
<p class="heading-meta">Create a panel login and set up the customer’s first domain on a hosting package. <a href="{{ login_only_url }}">Create a login only</a></p>
|
||||||
|
{% endif %}
|
||||||
<div class="surface editor-surface">
|
<div class="surface editor-surface">
|
||||||
<form method="post" class="editor">
|
<form method="post" class="editor">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{% if onboarding.dismissed %}
|
||||||
|
<form method="post" action="{% url 'panel:onboarding_preference' %}" class="form-actions">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button class="button secondary" name="action" value="show">Getting started</button>
|
||||||
|
</form>
|
||||||
|
{% elif onboarding.steps or onboarding.enable_customer %}
|
||||||
|
<section class="surface" aria-labelledby="onboarding-heading">
|
||||||
|
<header class="section-heading">
|
||||||
|
<h2 id="onboarding-heading">{{ onboarding.title }}</h2>
|
||||||
|
<form method="post" action="{% url 'panel:onboarding_preference' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button class="button secondary" name="action" value="dismiss">Dismiss checklist</button>
|
||||||
|
</form>
|
||||||
|
</header>
|
||||||
|
<ul>
|
||||||
|
{% for label, url, complete in onboarding.steps %}
|
||||||
|
<li>
|
||||||
|
{% if complete %}<span class="muted">Done · </span>{% endif %}
|
||||||
|
{% if url %}<a href="{{ url }}">{{ label }}</a>{% else %}{{ label }}{% endif %}
|
||||||
|
{% if not url and not complete %}
|
||||||
|
<span class="muted">{% if onboarding.role == "manager" %} · Ask your operator for an assigned package and available account allocation.{% else %} · Ask your hosting provider to link your hosting account.{% endif %}</span>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
{% if onboarding.enable_customer %}
|
||||||
|
<form method="post" action="{% url 'panel:enable_customer_workspace' %}" class="form-actions">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button class="button secondary" type="submit">Enable Customer workspace</button>
|
||||||
|
<span class="muted">Use this login to manage your own hosting.</span>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
@@ -143,6 +143,10 @@ class OperatorOwnHostingTests(TestCase):
|
|||||||
account = HostingAccount.objects.get(primary_domain=domain)
|
account = HostingAccount.objects.get(primary_domain=domain)
|
||||||
self.assertRedirects(response, account.get_absolute_url())
|
self.assertRedirects(response, account.get_absolute_url())
|
||||||
self.assertEqual(account.customer.user_id, self.operator.pk)
|
self.assertEqual(account.customer.user_id, self.operator.pk)
|
||||||
|
self.assertEqual(
|
||||||
|
account.customer.reseller.user_id, self.operator.pk
|
||||||
|
)
|
||||||
|
self.assertEqual(account.reseller_id, account.customer.reseller_id)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
Customer.objects.filter(user=self.operator).count(), 1
|
Customer.objects.filter(user=self.operator).count(), 1
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ class PanelRoleTests(TestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.client.get(reverse("panel:updates")).status_code, 403
|
self.client.get(reverse("panel:updates")).status_code, 403
|
||||||
)
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
self.client.get(reverse("panel:changelog")).status_code, 403
|
||||||
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.client.get(self.private_site.get_absolute_url()).status_code,
|
self.client.get(self.private_site.get_absolute_url()).status_code,
|
||||||
404,
|
404,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from django.core.cache import cache
|
|||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from coulobre.release_updates import Release
|
from coulobre.release_updates import RELEASES_URL, Release, UpdateError
|
||||||
|
|
||||||
|
|
||||||
class UpdateViewTests(TestCase):
|
class UpdateViewTests(TestCase):
|
||||||
@@ -54,3 +54,56 @@ class UpdateViewTests(TestCase):
|
|||||||
self.assertNotContains(response, 'href="javascript:')
|
self.assertNotContains(response, 'href="javascript:')
|
||||||
self.assertNotContains(response, 'href="/updates/">Local action')
|
self.assertNotContains(response, 'href="/updates/">Local action')
|
||||||
self.assertNotContains(response, '<img src="https://example.test/')
|
self.assertNotContains(response, '<img src="https://example.test/')
|
||||||
|
|
||||||
|
def test_changelog_renders_and_caches_public_notes_without_updater(self):
|
||||||
|
self.client.force_login(self.admin)
|
||||||
|
cache.clear()
|
||||||
|
self.addCleanup(cache.clear)
|
||||||
|
url = reverse("panel:changelog")
|
||||||
|
path = "coulobre.release_updates.read_json"
|
||||||
|
with patch(
|
||||||
|
path,
|
||||||
|
return_value=[
|
||||||
|
{
|
||||||
|
"tag_name": "v0.13.0-rc.2",
|
||||||
|
"draft": False,
|
||||||
|
"published_at": "2026-11-24T09:59:53+01:00",
|
||||||
|
"body": "## Changes\n\n<script>Untrusted</script>",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag_name": "v0.12.0",
|
||||||
|
"draft": False,
|
||||||
|
"body": "Previous release",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
) as catalog:
|
||||||
|
response = self.client.get(url)
|
||||||
|
cached_response = self.client.get(url)
|
||||||
|
catalog.assert_called_once()
|
||||||
|
|
||||||
|
self.assertContains(response, "<h2>Changes</h2>", html=True)
|
||||||
|
self.assertContains(response, "0.13.0rc2 · Prerelease")
|
||||||
|
self.assertContains(response, ">24 Nov 2026</time>")
|
||||||
|
self.assertContains(response, "<script>Untrusted")
|
||||||
|
self.assertNotContains(response, "<script>Untrusted")
|
||||||
|
self.assertContains(response, 'aria-current="page">Changelog')
|
||||||
|
self.assertContains(response, f'href="{RELEASES_URL}/tag/v0.12.0"')
|
||||||
|
self.assertContains(cached_response, "Previous release")
|
||||||
|
self.assertContains(
|
||||||
|
self.client.get(reverse("panel:installation")),
|
||||||
|
f'href="{url}">Changelog',
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_changelog_links_to_gitea_when_the_catalog_is_unavailable(self):
|
||||||
|
self.client.force_login(self.admin)
|
||||||
|
cache.clear()
|
||||||
|
self.addCleanup(cache.clear)
|
||||||
|
with patch(
|
||||||
|
"coulobre.hosting.update_views.changelog",
|
||||||
|
side_effect=UpdateError("Could not read releases."),
|
||||||
|
):
|
||||||
|
response = self.client.get(reverse("panel:changelog"))
|
||||||
|
self.assertContains(
|
||||||
|
response, "The release history is temporarily unavailable"
|
||||||
|
)
|
||||||
|
self.assertContains(response, f'href="{RELEASES_URL}"')
|
||||||
@@ -5,6 +5,7 @@ from django.contrib.auth.models import Permission
|
|||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django_otp.plugins.otp_totp.models import TOTPDevice
|
||||||
|
|
||||||
from .models import (
|
from .models import (
|
||||||
Customer,
|
Customer,
|
||||||
@@ -17,6 +18,120 @@ from .models import (
|
|||||||
|
|
||||||
|
|
||||||
class WorkspaceTests(TestCase):
|
class WorkspaceTests(TestCase):
|
||||||
|
def test_operator_creates_and_links_the_first_hosting_account(self):
|
||||||
|
users = get_user_model().objects
|
||||||
|
operator = users.create_superuser("operator")
|
||||||
|
manager = Reseller.objects.create(user=users.create_user("manager"))
|
||||||
|
plan = HostingPlan.objects.create(name="Shared")
|
||||||
|
self.client.force_login(operator)
|
||||||
|
url = reverse("panel:customer_onboarding")
|
||||||
|
self.assertContains(self.client.get(url), "Create a login only")
|
||||||
|
data = {
|
||||||
|
"username": "new-customer",
|
||||||
|
"email": "customer@example.test",
|
||||||
|
"primary_domain": "first.example.test",
|
||||||
|
"plan": plan.pk,
|
||||||
|
"manager": manager.pk,
|
||||||
|
"send_invitation": "on",
|
||||||
|
}
|
||||||
|
with patch(
|
||||||
|
"coulobre.hosting.account_administration.queue_invitation"
|
||||||
|
) as invite:
|
||||||
|
preview = self.client.post(url, data | {"action": "preview"})
|
||||||
|
self.assertContains(preview, "first.example.test")
|
||||||
|
self.assertFalse(Customer.objects.exists())
|
||||||
|
response = self.client.post(url, data)
|
||||||
|
account = HostingAccount.objects.get(
|
||||||
|
primary_domain="first.example.test"
|
||||||
|
)
|
||||||
|
self.assertRedirects(response, account.get_absolute_url())
|
||||||
|
self.assertEqual(account.hosting_plan, plan)
|
||||||
|
self.assertEqual(account.reseller, manager)
|
||||||
|
self.assertEqual(account.customer.reseller, manager)
|
||||||
|
self.assertEqual(
|
||||||
|
account.customer.user.get_username(), "new-customer"
|
||||||
|
)
|
||||||
|
invite.assert_called_once_with(
|
||||||
|
account.customer.user, welcome_message=""
|
||||||
|
)
|
||||||
|
self.client.force_login(account.customer.user)
|
||||||
|
self.assertEqual(self.client.get(url).status_code, 403)
|
||||||
|
|
||||||
|
def test_onboarding_follows_the_current_workspace_across_sign_ins(self):
|
||||||
|
operator = get_user_model().objects.create_superuser("operator")
|
||||||
|
device = TOTPDevice.objects.create(user=operator, name="Panel")
|
||||||
|
home = reverse("panel:accounts")
|
||||||
|
preference = reverse("panel:onboarding_preference")
|
||||||
|
enable = reverse("panel:enable_customer_workspace")
|
||||||
|
switch = reverse("panel:switch_panel_role")
|
||||||
|
self.client.force_login(operator)
|
||||||
|
self.assertEqual(self.client.post(enable).status_code, 403)
|
||||||
|
session = self.client.session
|
||||||
|
session["otp_device_id"] = device.persistent_id
|
||||||
|
session.save()
|
||||||
|
self.assertContains(
|
||||||
|
self.client.get(home), "Getting started as server administrator"
|
||||||
|
)
|
||||||
|
self.assertRedirects(self.client.post(enable), home)
|
||||||
|
self.assertRedirects(self.client.post(enable), home)
|
||||||
|
customer = Customer.objects.get(user=operator)
|
||||||
|
self.assertEqual(customer.reseller.user_id, operator.pk)
|
||||||
|
self.assertRedirects(
|
||||||
|
self.client.post(preference, {"action": "dismiss"}), home
|
||||||
|
)
|
||||||
|
self.assertTrue(
|
||||||
|
self.client.get(home).context["onboarding"]["dismissed"]
|
||||||
|
)
|
||||||
|
for role in ("manager", "customer"):
|
||||||
|
self.assertRedirects(
|
||||||
|
self.client.post(switch, {"role": role}), home
|
||||||
|
)
|
||||||
|
self.assertContains(
|
||||||
|
self.client.get(home), f"Getting started as {role}"
|
||||||
|
)
|
||||||
|
self.assertEqual(self.client.post(enable).status_code, 403)
|
||||||
|
self.client.logout()
|
||||||
|
self.client.force_login(operator)
|
||||||
|
self.assertTrue(
|
||||||
|
self.client.get(home).context["onboarding"]["dismissed"]
|
||||||
|
)
|
||||||
|
self.assertRedirects(
|
||||||
|
self.client.post(preference, {"action": "show"}), home
|
||||||
|
)
|
||||||
|
self.assertContains(
|
||||||
|
self.client.get(home), "Getting started as server administrator"
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_manager_can_enable_customer_workspace_and_keeps_manager_default(
|
||||||
|
self,
|
||||||
|
):
|
||||||
|
user = get_user_model().objects.create_user("manager")
|
||||||
|
manager = Reseller.objects.create(user=user)
|
||||||
|
self.client.force_login(user)
|
||||||
|
home = reverse("panel:accounts")
|
||||||
|
self.assertContains(
|
||||||
|
self.client.get(home), "Getting started as manager"
|
||||||
|
)
|
||||||
|
self.assertRedirects(
|
||||||
|
self.client.post(reverse("panel:enable_customer_workspace")), home
|
||||||
|
)
|
||||||
|
self.assertEqual(Customer.objects.get(user=user).reseller, manager)
|
||||||
|
self.assertContains(
|
||||||
|
self.client.get(home), "Getting started as manager"
|
||||||
|
)
|
||||||
|
self.assertRedirects(
|
||||||
|
self.client.post(
|
||||||
|
reverse("panel:switch_panel_role"), {"role": "customer"}
|
||||||
|
),
|
||||||
|
home,
|
||||||
|
)
|
||||||
|
self.assertContains(
|
||||||
|
self.client.get(home), "Getting started as customer"
|
||||||
|
)
|
||||||
|
self.assertNotContains(
|
||||||
|
self.client.get(home), "Get an assigned hosting package"
|
||||||
|
)
|
||||||
|
|
||||||
def test_operator_navigation_keeps_creation_and_package_links_together(
|
def test_operator_navigation_keeps_creation_and_package_links_together(
|
||||||
self,
|
self,
|
||||||
):
|
):
|
||||||
@@ -25,7 +140,7 @@ class WorkspaceTests(TestCase):
|
|||||||
landing = self.client.get(reverse("panel:accounts"))
|
landing = self.client.get(reverse("panel:accounts"))
|
||||||
links = dict(landing.context["navigation_groups"])["Account Manager"]
|
links = dict(landing.context["navigation_groups"])["Account Manager"]
|
||||||
actions = [
|
actions = [
|
||||||
(reverse("panel:customer_create"), "Add User"),
|
(reverse("panel:customer_onboarding"), "Add User"),
|
||||||
(reverse("panel:reseller_create"), "Add Manager"),
|
(reverse("panel:reseller_create"), "Add Manager"),
|
||||||
(reverse("panel:operator_create"), "Add Operator"),
|
(reverse("panel:operator_create"), "Add Operator"),
|
||||||
(reverse("panel:hosting_plans"), "Hosting Packages"),
|
(reverse("panel:hosting_plans"), "Hosting Packages"),
|
||||||
@@ -214,8 +329,6 @@ class WorkspaceTests(TestCase):
|
|||||||
)
|
)
|
||||||
for label in ("first", "second")
|
for label in ("first", "second")
|
||||||
]
|
]
|
||||||
from django_otp.plugins.otp_totp.models import TOTPDevice
|
|
||||||
|
|
||||||
device = TOTPDevice.objects.create(user=operator, name="test")
|
device = TOTPDevice.objects.create(user=operator, name="test")
|
||||||
self.client.force_login(operator)
|
self.client.force_login(operator)
|
||||||
session = self.client.session
|
session = self.client.session
|
||||||
|
|||||||
@@ -10,13 +10,15 @@ from django.core.exceptions import PermissionDenied
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.views.decorators.cache import never_cache
|
from django.views.decorators.cache import never_cache
|
||||||
from django.views.generic import FormView
|
from django.views.generic import FormView, TemplateView
|
||||||
|
|
||||||
from coulobre.linked_updates import staged_for_release
|
from coulobre.linked_updates import staged_for_release
|
||||||
from coulobre.local_update import SOCKET
|
from coulobre.local_update import SOCKET
|
||||||
from coulobre.release_updates import (
|
from coulobre.release_updates import (
|
||||||
|
RELEASES_URL,
|
||||||
UpdateError,
|
UpdateError,
|
||||||
available_releases,
|
available_releases,
|
||||||
|
changelog,
|
||||||
version_key,
|
version_key,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -56,14 +58,30 @@ def inspect_linked_nodes():
|
|||||||
|
|
||||||
|
|
||||||
@method_decorator(never_cache, name="dispatch")
|
@method_decorator(never_cache, name="dispatch")
|
||||||
class UpdateView(UserPassesTestMixin, FormView):
|
class OperatorUpdatesAccess(UserPassesTestMixin):
|
||||||
|
def test_func(self):
|
||||||
|
return self.request.user.is_superuser
|
||||||
|
|
||||||
|
|
||||||
|
class ChangelogView(OperatorUpdatesAccess, TemplateView):
|
||||||
|
template_name = "hosting/changelog.html"
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(releases_url=RELEASES_URL, **kwargs)
|
||||||
|
try:
|
||||||
|
context["entries"] = cache.get_or_set(
|
||||||
|
"coulobre-changelog", changelog, timeout=300
|
||||||
|
)
|
||||||
|
except UpdateError:
|
||||||
|
context["catalog_unavailable"] = True
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
class UpdateView(OperatorUpdatesAccess, FormView):
|
||||||
form_class = UpdateForm
|
form_class = UpdateForm
|
||||||
template_name = "hosting/updates.html"
|
template_name = "hosting/updates.html"
|
||||||
success_url = reverse_lazy("panel:updates")
|
success_url = reverse_lazy("panel:updates")
|
||||||
|
|
||||||
def test_func(self):
|
|
||||||
return self.request.user.is_superuser
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context["updater_enabled"] = SOCKET.is_socket()
|
context["updater_enabled"] = SOCKET.is_socket()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from django.urls import path
|
|||||||
from . import themes, views
|
from . import themes, views
|
||||||
from .account_administration import (
|
from .account_administration import (
|
||||||
AllUsersView,
|
AllUsersView,
|
||||||
ManagerOnboardingView,
|
CustomerOnboardingView,
|
||||||
ManagerPackagesView,
|
ManagerPackagesView,
|
||||||
MoveHostingView,
|
MoveHostingView,
|
||||||
OperatorCreateView,
|
OperatorCreateView,
|
||||||
@@ -102,10 +102,14 @@ from .sign_in import (
|
|||||||
VerifyFactorView,
|
VerifyFactorView,
|
||||||
)
|
)
|
||||||
from .system_backup_views import SystemBackupView
|
from .system_backup_views import SystemBackupView
|
||||||
from .update_views import UpdateView
|
from .update_views import ChangelogView, UpdateView
|
||||||
from .website_file_views import WebsiteFilesView
|
from .website_file_views import WebsiteFilesView
|
||||||
from .website_job_views import WebsiteJobEditor, WebsiteJobList
|
from .website_job_views import WebsiteJobEditor, WebsiteJobList
|
||||||
from .website_usage_views import WebsiteUsageView
|
from .website_usage_views import WebsiteUsageView
|
||||||
|
from .workspace_onboarding import (
|
||||||
|
enable_customer_workspace,
|
||||||
|
onboarding_preference,
|
||||||
|
)
|
||||||
from .workspaces import customer_workspace, system_workspace
|
from .workspaces import customer_workspace, system_workspace
|
||||||
|
|
||||||
app_name = "panel"
|
app_name = "panel"
|
||||||
@@ -236,7 +240,7 @@ urlpatterns = [
|
|||||||
path("users/", AllUsersView.as_view(), name="all_users"),
|
path("users/", AllUsersView.as_view(), name="all_users"),
|
||||||
path(
|
path(
|
||||||
"users/new/",
|
"users/new/",
|
||||||
ManagerOnboardingView.as_view(),
|
CustomerOnboardingView.as_view(),
|
||||||
name="customer_onboarding",
|
name="customer_onboarding",
|
||||||
),
|
),
|
||||||
path("users/move/", MoveHostingView.as_view(), name="move_accounts"),
|
path("users/move/", MoveHostingView.as_view(), name="move_accounts"),
|
||||||
@@ -260,6 +264,7 @@ urlpatterns = [
|
|||||||
),
|
),
|
||||||
path("panel-theme.css", themes.stylesheet, name="theme_stylesheet"),
|
path("panel-theme.css", themes.stylesheet, name="theme_stylesheet"),
|
||||||
path("updates/", UpdateView.as_view(), name="updates"),
|
path("updates/", UpdateView.as_view(), name="updates"),
|
||||||
|
path("updates/changelog/", ChangelogView.as_view(), name="changelog"),
|
||||||
path("dns-template/", DnsDefaultsView.as_view(), name="dns_defaults"),
|
path("dns-template/", DnsDefaultsView.as_view(), name="dns_defaults"),
|
||||||
path(
|
path(
|
||||||
"accounts/<int:pk>/setup/",
|
"accounts/<int:pk>/setup/",
|
||||||
@@ -292,6 +297,16 @@ urlpatterns = [
|
|||||||
name="operator_settings",
|
name="operator_settings",
|
||||||
),
|
),
|
||||||
path("account/role/", switch_panel_role, name="switch_panel_role"),
|
path("account/role/", switch_panel_role, name="switch_panel_role"),
|
||||||
|
path(
|
||||||
|
"account/getting-started/",
|
||||||
|
onboarding_preference,
|
||||||
|
name="onboarding_preference",
|
||||||
|
),
|
||||||
|
path(
|
||||||
|
"account/customer-workspace/",
|
||||||
|
enable_customer_workspace,
|
||||||
|
name="enable_customer_workspace",
|
||||||
|
),
|
||||||
path(
|
path(
|
||||||
"logins/assign-role/",
|
"logins/assign-role/",
|
||||||
AssignPanelRoleView.as_view(),
|
AssignPanelRoleView.as_view(),
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ from .website_aliases import (
|
|||||||
from .website_file_views import can_manage_website_files
|
from .website_file_views import can_manage_website_files
|
||||||
from .website_job_views import can_manage_website_jobs
|
from .website_job_views import can_manage_website_jobs
|
||||||
from .website_jobs import website_job_limit
|
from .website_jobs import website_job_limit
|
||||||
|
from .workspace_onboarding import onboarding_context
|
||||||
|
|
||||||
VIEW_ACCOUNTS = "hosting.view_hostingaccount"
|
VIEW_ACCOUNTS = "hosting.view_hostingaccount"
|
||||||
CHANGE_ACCOUNTS = "hosting.change_hostingaccount"
|
CHANGE_ACCOUNTS = "hosting.change_hostingaccount"
|
||||||
@@ -390,6 +391,8 @@ class AccountList(TenantScopeMixin, PermissionRequiredMixin, ListView):
|
|||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(search=self.search, **kwargs)
|
context = super().get_context_data(search=self.search, **kwargs)
|
||||||
|
if not self.search and not self.request.GET.get("customer"):
|
||||||
|
context["onboarding"] = onboarding_context(self.request)
|
||||||
context["show_customer_website_link"] = settings.WEBSITE_USAGE
|
context["show_customer_website_link"] = settings.WEBSITE_USAGE
|
||||||
reseller = reseller_for_user(self.request.user)
|
reseller = reseller_for_user(self.request.user)
|
||||||
if reseller is not None:
|
if reseller is not None:
|
||||||
@@ -468,6 +471,7 @@ class AccountCreate(PermissionRequiredMixin, AccountEditor, CreateView):
|
|||||||
"in the Customer workspace."
|
"in the Customer workspace."
|
||||||
),
|
),
|
||||||
required=False,
|
required=False,
|
||||||
|
initial=self.request.GET.get("own") == "1",
|
||||||
)
|
)
|
||||||
reseller = reseller_for_user(actor) is not None
|
reseller = reseller_for_user(actor) is not None
|
||||||
defaults = zone_defaults()
|
defaults = zone_defaults()
|
||||||
@@ -543,9 +547,18 @@ class AccountCreate(PermissionRequiredMixin, AccountEditor, CreateView):
|
|||||||
try:
|
try:
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
if own_hosting:
|
if own_hosting:
|
||||||
customer, created = Customer.objects.get_or_create(
|
manager = self.object.reseller or actor.hosting_reseller
|
||||||
user_id=actor.pk
|
customer, created = (
|
||||||
|
Customer.objects.select_for_update().get_or_create(
|
||||||
|
user_id=actor.pk,
|
||||||
|
defaults={"reseller": manager},
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
if customer.reseller_id is None:
|
||||||
|
customer.reseller = manager
|
||||||
|
customer.save(update_fields=["reseller"])
|
||||||
|
if self.object.reseller_id is None:
|
||||||
|
self.object.reseller_id = customer.reseller_id
|
||||||
self.object.customer = customer
|
self.object.customer = customer
|
||||||
if created:
|
if created:
|
||||||
LogEntry.objects.log_actions(
|
LogEntry.objects.log_actions(
|
||||||
|
|||||||
@@ -0,0 +1,179 @@
|
|||||||
|
from django.contrib.admin.models import ADDITION, LogEntry
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.core.exceptions import PermissionDenied
|
||||||
|
from django.db import transaction
|
||||||
|
from django.http import HttpResponseBadRequest
|
||||||
|
from django.shortcuts import redirect
|
||||||
|
from django.urls import reverse
|
||||||
|
from django.views.decorators.http import require_POST
|
||||||
|
|
||||||
|
from .access import PanelRole, customer_for_user, reseller_for_user
|
||||||
|
from .account_administration import can_onboard_customer
|
||||||
|
from .models import (
|
||||||
|
Customer,
|
||||||
|
HostingAccount,
|
||||||
|
HostingPlan,
|
||||||
|
OnboardingDismissal,
|
||||||
|
PanelRecoveryCode,
|
||||||
|
ServiceHealth,
|
||||||
|
)
|
||||||
|
from .panel_roles import ROLE_LABELS
|
||||||
|
|
||||||
|
|
||||||
|
def workspace_role(request):
|
||||||
|
if getattr(request, "impersonation", None):
|
||||||
|
return None
|
||||||
|
if customer_for_user(request.user):
|
||||||
|
return PanelRole.CUSTOMER
|
||||||
|
if reseller_for_user(request.user):
|
||||||
|
return PanelRole.MANAGER
|
||||||
|
if request.user.has_perm("hosting.view_hostingaccount"):
|
||||||
|
return PanelRole.ADMIN
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def customer_workspace_manager(user):
|
||||||
|
if user.is_superuser and user.is_verified():
|
||||||
|
return getattr(user, "hosting_reseller", None)
|
||||||
|
return reseller_for_user(user)
|
||||||
|
|
||||||
|
|
||||||
|
def onboarding_context(request):
|
||||||
|
role = workspace_role(request)
|
||||||
|
if role is None:
|
||||||
|
return None
|
||||||
|
user = request.user
|
||||||
|
title = f"Getting started as {ROLE_LABELS[role].lower()}"
|
||||||
|
if OnboardingDismissal.objects.filter(user_id=user.pk, role=role).exists():
|
||||||
|
return {"title": title, "dismissed": True}
|
||||||
|
|
||||||
|
active = HostingAccount.objects.filter(retired_at__isnull=True)
|
||||||
|
steps = []
|
||||||
|
if role == PanelRole.ADMIN:
|
||||||
|
if user.has_perm("hosting.view_servicehealth"):
|
||||||
|
steps.append(
|
||||||
|
(
|
||||||
|
"Check that services report their status",
|
||||||
|
reverse("panel:service_health"),
|
||||||
|
ServiceHealth.objects.exists(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if user.has_perms(
|
||||||
|
("hosting.view_hostingplan", "hosting.add_hostingplan")
|
||||||
|
):
|
||||||
|
steps.append(
|
||||||
|
(
|
||||||
|
"Create a hosting package",
|
||||||
|
reverse("panel:hosting_plan_create"),
|
||||||
|
HostingPlan.objects.exists(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if can_onboard_customer(user):
|
||||||
|
steps.append(
|
||||||
|
(
|
||||||
|
"Create a customer login and hosting account",
|
||||||
|
reverse("panel:customer_onboarding"),
|
||||||
|
active.filter(customer__user__is_superuser=False).exists(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if user.is_superuser and user.is_verified():
|
||||||
|
steps.append(
|
||||||
|
(
|
||||||
|
"Set up hosting for your own login",
|
||||||
|
reverse("panel:account_create", query={"own": "1"}),
|
||||||
|
active.filter(customer__user_id=user.pk).exists(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
elif role == PanelRole.MANAGER:
|
||||||
|
manager = reseller_for_user(user)
|
||||||
|
has_packages = manager.hosting_plans.exists()
|
||||||
|
accounts = active.filter(reseller=manager)
|
||||||
|
may_create = (
|
||||||
|
has_packages
|
||||||
|
and manager.hostingaccount_set.count() < manager.account_limit
|
||||||
|
)
|
||||||
|
steps.extend(
|
||||||
|
(
|
||||||
|
(
|
||||||
|
"Get an assigned hosting package",
|
||||||
|
reverse("panel:manager_packages"),
|
||||||
|
has_packages,
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"Create a customer login and hosting account",
|
||||||
|
reverse("panel:customer_onboarding") if may_create else "",
|
||||||
|
accounts.exclude(customer__user_id=user.pk)
|
||||||
|
.filter(customer__isnull=False)
|
||||||
|
.exists(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
customer = customer_for_user(user)
|
||||||
|
account = active.filter(customer=customer).order_by("pk").first()
|
||||||
|
steps.extend(
|
||||||
|
(
|
||||||
|
(
|
||||||
|
"Set up recovery codes",
|
||||||
|
reverse("panel:account_security"),
|
||||||
|
PanelRecoveryCode.objects.filter(user_id=user.pk).exists(),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"Get a hosting account",
|
||||||
|
account.get_absolute_url() if account else "",
|
||||||
|
account is not None,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
enable_customer = (
|
||||||
|
role != PanelRole.CUSTOMER
|
||||||
|
and not hasattr(user, "hosting_customer")
|
||||||
|
and customer_workspace_manager(user) is not None
|
||||||
|
)
|
||||||
|
return {
|
||||||
|
"title": title,
|
||||||
|
"steps": steps,
|
||||||
|
"enable_customer": enable_customer,
|
||||||
|
"role": role,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
@require_POST
|
||||||
|
def onboarding_preference(request):
|
||||||
|
role = workspace_role(request)
|
||||||
|
if role is None:
|
||||||
|
raise PermissionDenied
|
||||||
|
action = request.POST.get("action")
|
||||||
|
if action == "dismiss":
|
||||||
|
OnboardingDismissal.objects.get_or_create(
|
||||||
|
user_id=request.user.pk, role=role
|
||||||
|
)
|
||||||
|
elif action == "show":
|
||||||
|
OnboardingDismissal.objects.filter(
|
||||||
|
user_id=request.user.pk, role=role
|
||||||
|
).delete()
|
||||||
|
else:
|
||||||
|
return HttpResponseBadRequest()
|
||||||
|
return redirect("panel:accounts")
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
@require_POST
|
||||||
|
@transaction.atomic
|
||||||
|
def enable_customer_workspace(request):
|
||||||
|
if getattr(request, "impersonation", None):
|
||||||
|
raise PermissionDenied
|
||||||
|
user = request.user
|
||||||
|
manager = customer_workspace_manager(user)
|
||||||
|
if manager is None:
|
||||||
|
raise PermissionDenied
|
||||||
|
customer, created = Customer.objects.get_or_create(
|
||||||
|
user_id=user.pk, defaults={"reseller": manager}
|
||||||
|
)
|
||||||
|
if created:
|
||||||
|
LogEntry.objects.log_actions(
|
||||||
|
user.pk, [customer], ADDITION, "Enabled own Customer workspace."
|
||||||
|
)
|
||||||
|
return redirect("panel:accounts")
|
||||||
@@ -72,6 +72,7 @@ WORKSPACE_PARENT_ROUTES = {
|
|||||||
"operator_settings": ("operator_settings", ("general",)),
|
"operator_settings": ("operator_settings", ("general",)),
|
||||||
"http_defaults": ("http_defaults", ("apache",)),
|
"http_defaults": ("http_defaults", ("apache",)),
|
||||||
"server_updates": ("updates", ()),
|
"server_updates": ("updates", ()),
|
||||||
|
"changelog": ("updates", ()),
|
||||||
"operator_service_actions": ("service_health", ()),
|
"operator_service_actions": ("service_health", ()),
|
||||||
"mail_queue": ("mail_queue_index", ()),
|
"mail_queue": ("mail_queue_index", ()),
|
||||||
"reseller": ("resellers", ()),
|
"reseller": ("resellers", ()),
|
||||||
@@ -368,12 +369,20 @@ def groups_for(request, *, customer, manager):
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
|
from .account_administration import can_onboard_customer
|
||||||
|
|
||||||
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"),
|
||||||
(("view_customer", "add_customer"), "customer_create", "Add User"),
|
(
|
||||||
|
("view_customer", "add_customer"),
|
||||||
|
"customer_onboarding"
|
||||||
|
if can_onboard_customer(user)
|
||||||
|
else "customer_create",
|
||||||
|
"Add User",
|
||||||
|
),
|
||||||
(
|
(
|
||||||
("view_reseller", "add_reseller"),
|
("view_reseller", "add_reseller"),
|
||||||
"reseller_create",
|
"reseller_create",
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ import hashlib
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from urllib.request import HTTPRedirectHandler, Request, build_opener
|
from urllib.request import HTTPRedirectHandler, Request, build_opener
|
||||||
|
|
||||||
ORIGIN = "https://code.hosting.hippogrief.nl"
|
ORIGIN = "https://code.hosting.hippogrief.nl"
|
||||||
REPOSITORY = "hippogrief/coulobre"
|
REPOSITORY = "hippogrief/coulobre"
|
||||||
|
RELEASES_URL = f"{ORIGIN}/{REPOSITORY}/releases"
|
||||||
MANIFEST = "web-update.json"
|
MANIFEST = "web-update.json"
|
||||||
VERSION = re.compile(
|
VERSION = re.compile(
|
||||||
r"(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})(?:rc([1-9][0-9]{0,5}))?"
|
r"(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})\.(0|[1-9][0-9]{0,5})(?:rc([1-9][0-9]{0,5}))?"
|
||||||
@@ -74,14 +76,27 @@ def release_asset_path(version, name):
|
|||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class Release:
|
class ReleaseNotes:
|
||||||
version: str
|
version: str
|
||||||
notes: str
|
notes: str
|
||||||
prerelease: bool
|
prerelease: bool
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class Release(ReleaseNotes):
|
||||||
sha256: str
|
sha256: str
|
||||||
|
|
||||||
|
|
||||||
def compatible_release(item, installed):
|
@dataclass(frozen=True)
|
||||||
|
class ChangelogEntry(ReleaseNotes):
|
||||||
|
published_at: datetime | None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def url(self):
|
||||||
|
return f"{RELEASES_URL}/tag/{release_tag(self.version)}"
|
||||||
|
|
||||||
|
|
||||||
|
def published_release_notes(item):
|
||||||
if not isinstance(item, dict) or item.get("draft") is not False:
|
if not isinstance(item, dict) or item.get("draft") is not False:
|
||||||
return None
|
return None
|
||||||
tag = item.get("tag_name")
|
tag = item.get("tag_name")
|
||||||
@@ -89,9 +104,24 @@ def compatible_release(item, installed):
|
|||||||
return None
|
return None
|
||||||
version = tag[1:].replace("-rc.", "rc")
|
version = tag[1:].replace("-rc.", "rc")
|
||||||
try:
|
try:
|
||||||
if release_tag(version) != tag or version_key(version) <= version_key(
|
if release_tag(version) != tag:
|
||||||
installed
|
return None
|
||||||
):
|
except UpdateError:
|
||||||
|
return None
|
||||||
|
return ReleaseNotes(
|
||||||
|
version,
|
||||||
|
str(item.get("body") or "")[:12000],
|
||||||
|
"rc" in version or bool(item.get("prerelease")),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def compatible_release(item, installed):
|
||||||
|
summary = published_release_notes(item)
|
||||||
|
if summary is None:
|
||||||
|
return None
|
||||||
|
version = summary.version
|
||||||
|
try:
|
||||||
|
if version_key(version) <= version_key(installed):
|
||||||
return None
|
return None
|
||||||
except UpdateError:
|
except UpdateError:
|
||||||
return None
|
return None
|
||||||
@@ -119,20 +149,47 @@ def compatible_release(item, installed):
|
|||||||
return None
|
return None
|
||||||
return Release(
|
return Release(
|
||||||
version,
|
version,
|
||||||
str(item.get("body") or "")[:12000],
|
summary.notes,
|
||||||
"rc" in version or bool(item.get("prerelease")),
|
summary.prerelease,
|
||||||
manifest["sha256"],
|
manifest["sha256"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def release_catalog(*, limit):
|
||||||
|
items = read_json(f"/api/v1/repos/{REPOSITORY}/releases?limit={limit}")
|
||||||
|
if not isinstance(items, list):
|
||||||
|
raise UpdateError("The release catalog is invalid.")
|
||||||
|
return items
|
||||||
|
|
||||||
|
|
||||||
|
def changelog():
|
||||||
|
entries = []
|
||||||
|
for item in release_catalog(limit=20):
|
||||||
|
summary = published_release_notes(item)
|
||||||
|
if summary is None:
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
published_at = datetime.fromisoformat(item["published_at"])
|
||||||
|
except (KeyError, TypeError, ValueError):
|
||||||
|
published_at = None
|
||||||
|
entries.append(
|
||||||
|
ChangelogEntry(
|
||||||
|
summary.version,
|
||||||
|
summary.notes,
|
||||||
|
summary.prerelease,
|
||||||
|
published_at,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return sorted(
|
||||||
|
entries, key=lambda entry: version_key(entry.version), reverse=True
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def available_releases(installed):
|
def available_releases(installed):
|
||||||
version_key(installed)
|
version_key(installed)
|
||||||
items = read_json(f"/api/v1/repos/{REPOSITORY}/releases?limit=10")
|
|
||||||
if not isinstance(items, list):
|
|
||||||
raise UpdateError("The release catalog is invalid.")
|
|
||||||
releases = [
|
releases = [
|
||||||
release
|
release
|
||||||
for item in items
|
for item in release_catalog(limit=10)
|
||||||
if (release := compatible_release(item, installed))
|
if (release := compatible_release(item, installed))
|
||||||
]
|
]
|
||||||
return sorted(
|
return sorted(
|
||||||
|
|||||||
@@ -10,6 +10,42 @@ from .release_updates import Release, UpdateError
|
|||||||
|
|
||||||
|
|
||||||
class ReleaseCatalogTests(TestCase):
|
class ReleaseCatalogTests(TestCase):
|
||||||
|
def test_changelog_lists_published_versions_without_update_manifests(self):
|
||||||
|
def item(tag, **fields):
|
||||||
|
return {"draft": False, "tag_name": tag, "body": "Notes"} | fields
|
||||||
|
|
||||||
|
with patch(
|
||||||
|
"coulobre.release_updates.read_json",
|
||||||
|
return_value=[
|
||||||
|
item("v0.12.0", html_url="https://invalid.test"),
|
||||||
|
item(
|
||||||
|
"v0.13.0-rc.2",
|
||||||
|
prerelease=False,
|
||||||
|
published_at="2026-11-24T09:59:53+01:00",
|
||||||
|
),
|
||||||
|
item("v0.13.0", published_at="invalid date"),
|
||||||
|
item("v0.14.0", draft=True),
|
||||||
|
item("v0.15.0rc1"),
|
||||||
|
],
|
||||||
|
) as read_json:
|
||||||
|
final, candidate, older = release_updates.changelog()
|
||||||
|
|
||||||
|
read_json.assert_called_once_with(
|
||||||
|
f"/api/v1/repos/{release_updates.REPOSITORY}/releases?limit=20"
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
[final.version, candidate.version, older.version],
|
||||||
|
["0.13.0", "0.13.0rc2", "0.12.0"],
|
||||||
|
)
|
||||||
|
self.assertIsNone(final.published_at)
|
||||||
|
self.assertFalse(final.prerelease)
|
||||||
|
self.assertTrue(candidate.prerelease)
|
||||||
|
self.assertEqual(candidate.published_at.day, 24)
|
||||||
|
self.assertEqual(older.notes, "Notes")
|
||||||
|
self.assertEqual(
|
||||||
|
older.url, f"{release_updates.RELEASES_URL}/tag/v0.12.0"
|
||||||
|
)
|
||||||
|
|
||||||
def test_requires_compatible_published_manifest_and_marks_candidates(self):
|
def test_requires_compatible_published_manifest_and_marks_candidates(self):
|
||||||
target = "0.10.1rc2"
|
target = "0.10.1rc2"
|
||||||
installed = "0.10.1rc1"
|
installed = "0.10.1rc1"
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ import shlex
|
|||||||
import stat
|
import stat
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
from contextlib import redirect_stdout
|
||||||
|
from io import StringIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
from unittest.mock import Mock, patch
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
from deploy.panel_installer.cli import save_interactive_plan
|
from deploy.panel_installer.cli import interactive_plan, save_interactive_plan
|
||||||
from deploy.panel_installer.config import (
|
from deploy.panel_installer.config import (
|
||||||
InstallError,
|
InstallError,
|
||||||
parse_plan,
|
parse_plan,
|
||||||
@@ -15,7 +17,12 @@ from deploy.panel_installer.config import (
|
|||||||
read_plan,
|
read_plan,
|
||||||
)
|
)
|
||||||
from deploy.panel_installer.engine import Installer, install_worker
|
from deploy.panel_installer.engine import Installer, install_worker
|
||||||
from deploy.panel_installer.web import Wizard, WizardHandler, form_plan
|
from deploy.panel_installer.web import (
|
||||||
|
Wizard,
|
||||||
|
WizardHandler,
|
||||||
|
form_plan,
|
||||||
|
installation_form,
|
||||||
|
)
|
||||||
|
|
||||||
PROXY = {
|
PROXY = {
|
||||||
"hostname": "Panel.Example.NET",
|
"hostname": "Panel.Example.NET",
|
||||||
@@ -139,6 +146,39 @@ class InstallerParametersTests(unittest.TestCase):
|
|||||||
self.assertEqual(stat.S_IMODE(path.stat().st_mode), 0o600)
|
self.assertEqual(stat.S_IMODE(path.stat().st_mode), 0o600)
|
||||||
self.assertEqual(parse_plan(read_plan(path)), plan)
|
self.assertEqual(parse_plan(read_plan(path)), plan)
|
||||||
|
|
||||||
|
def test_interactive_hosting_hints_explain_dns_and_keep_defaults(self):
|
||||||
|
replies = [
|
||||||
|
"",
|
||||||
|
"panel.example.net",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"ops@example.net",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"192.0.2.21",
|
||||||
|
"ns1.example.net",
|
||||||
|
"",
|
||||||
|
]
|
||||||
|
output = StringIO()
|
||||||
|
with (
|
||||||
|
patch("builtins.input", side_effect=replies),
|
||||||
|
redirect_stdout(output),
|
||||||
|
):
|
||||||
|
plan = interactive_plan()
|
||||||
|
|
||||||
|
self.assertEqual(plan.dns.mode, "local")
|
||||||
|
self.assertEqual(plan.mail.mode, "local")
|
||||||
|
self.assertEqual(plan.hosting.public_addresses, ("192.0.2.21",))
|
||||||
|
self.assertEqual(plan.hosting.nameservers, ("ns1.example.net",))
|
||||||
|
self.assertEqual(plan.hosting.mail_sending_addresses, ())
|
||||||
|
self.assertIn("default A and AAAA records", output.getvalue())
|
||||||
|
self.assertIn(
|
||||||
|
"delegation separately at the registrar", output.getvalue()
|
||||||
|
)
|
||||||
|
self.assertIn("SPF and managed mail DNS", output.getvalue())
|
||||||
|
|
||||||
def test_browser_and_parameter_file_share_the_same_plan(self):
|
def test_browser_and_parameter_file_share_the_same_plan(self):
|
||||||
with tempfile.TemporaryDirectory() as folder:
|
with tempfile.TemporaryDirectory() as folder:
|
||||||
params = Path(folder) / "panel.toml"
|
params = Path(folder) / "panel.toml"
|
||||||
@@ -260,6 +300,22 @@ class InstallerParametersTests(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class SetupWizardTests(unittest.TestCase):
|
class SetupWizardTests(unittest.TestCase):
|
||||||
|
def test_form_hints_are_linked_and_saved_choices_are_restored(self):
|
||||||
|
html = installation_form(
|
||||||
|
{
|
||||||
|
"access": "proxy",
|
||||||
|
"dns_mode": "off",
|
||||||
|
"mail_tls": "provided",
|
||||||
|
"public_addresses": "192.0.2.21",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
for name in ("access", "dns_mode", "mail_tls", "public_addresses"):
|
||||||
|
self.assertIn(f'aria-describedby="{name}-hint"', html)
|
||||||
|
self.assertIn(f'id="{name}-hint"', html)
|
||||||
|
for value in ("proxy", "off", "provided"):
|
||||||
|
self.assertIn(f'<option value="{value}" selected>', html)
|
||||||
|
self.assertIn('value="192.0.2.21"', html)
|
||||||
|
|
||||||
def handler(self):
|
def handler(self):
|
||||||
handler = WizardHandler.__new__(WizardHandler)
|
handler = WizardHandler.__new__(WizardHandler)
|
||||||
handler.server = SimpleNamespace(
|
handler.server = SimpleNamespace(
|
||||||
|
|||||||
+5
-1
@@ -58,10 +58,14 @@ def build_package(source, wheel, ref, output):
|
|||||||
f"Package: coulobre-panel\nVersion: {version}\n"
|
f"Package: coulobre-panel\nVersion: {version}\n"
|
||||||
"Architecture: all\nSection: web\nPriority: optional\n"
|
"Architecture: all\nSection: web\nPriority: optional\n"
|
||||||
"Maintainer: Hippogrief <info@hippogrief.nl>\n"
|
"Maintainer: Hippogrief <info@hippogrief.nl>\n"
|
||||||
|
"Homepage: https://code.hosting.hippogrief.nl/hippogrief/coulobre\n"
|
||||||
"Depends: python3 (>= 3.12), python3-venv, ca-certificates, "
|
"Depends: python3 (>= 3.12), python3-venv, ca-certificates, "
|
||||||
"openssh-client\n"
|
"openssh-client\n"
|
||||||
"Description: Coulobre web hosting control panel\n"
|
"Description: Coulobre web hosting control panel\n"
|
||||||
" Deployment assets for supported Ubuntu and Debian systems.\n"
|
" Deployment package for Ubuntu 26.04 LTS (resolute) and "
|
||||||
|
"Debian 13 (trixie).\n"
|
||||||
|
" On a fresh host, run sudo coulobre-install --interactive "
|
||||||
|
"after APT exits.\n"
|
||||||
)
|
)
|
||||||
metadata.chmod(0o644)
|
metadata.chmod(0o644)
|
||||||
sbin = root / "usr/sbin"
|
sbin = root / "usr/sbin"
|
||||||
|
|||||||
Reference in new issue
Block a user