feat(portal): add Webmail (Sam), Web Restrict (Sam/Jo), and School Portal (Sam/Jo/Finn/Harry)
This commit is contained in:
@@ -39,6 +39,7 @@ class Tool:
|
|||||||
togglable: bool = False # only True if in the controller allowlist
|
togglable: bool = False # only True if in the controller allowlist
|
||||||
logs_url: str | None = None # deep link for the failed state (dozzle)
|
logs_url: str | None = None # deep link for the failed state (dozzle)
|
||||||
admin_service: bool = False # toggle strip visible to admins only
|
admin_service: bool = False # toggle strip visible to admins only
|
||||||
|
who: tuple[str, ...] | None = None # explicit allowed usernames (e.g. ("sam", "jo"))
|
||||||
|
|
||||||
|
|
||||||
def section_label(category: str) -> str:
|
def section_label(category: str) -> str:
|
||||||
@@ -200,12 +201,20 @@ def _cat() -> list[Tool]:
|
|||||||
"Personal finance", "https://firefly.lab.audasmedia.com.au", login=True, admin=True),
|
"Personal finance", "https://firefly.lab.audasmedia.com.au", login=True, admin=True),
|
||||||
Tool("vaultwarden", "Vaultwarden", "data",
|
Tool("vaultwarden", "Vaultwarden", "data",
|
||||||
"Password manager", "https://vaultwarden.lab.audasmedia.com.au", login=True, admin=True),
|
"Password manager", "https://vaultwarden.lab.audasmedia.com.au", login=True, admin=True),
|
||||||
|
Tool("webmail", "Webmail", "data",
|
||||||
|
"Home webmail", "https://mail.lab.audasmedia.com.au", login=True, admin=True, who=("sam",)),
|
||||||
|
|
||||||
# ---- Home Management ----------------------------------------------
|
# ---- Home Management ----------------------------------------------
|
||||||
Tool("homebox", "Homebox", "home-mgmt",
|
Tool("homebox", "Homebox", "home-mgmt",
|
||||||
"Home inventory & items", "https://homebox.lab.audasmedia.com.au", login=True),
|
"Home inventory & items", "https://homebox.lab.audasmedia.com.au", login=True),
|
||||||
Tool("toora", "Toora Wiki", "home-mgmt",
|
Tool("toora", "Toora Wiki", "home-mgmt",
|
||||||
"Home wiki", "https://toora.lab.audasmedia.com.au", login=True),
|
"Home wiki", "https://toora.lab.audasmedia.com.au", login=True),
|
||||||
|
Tool("webrestrict", "Web Restrict", "home-mgmt",
|
||||||
|
"Web filtering & restriction controls", "https://webrestrict.lab.audasmedia.com.au",
|
||||||
|
login=True, who=("sam", "jo")),
|
||||||
|
Tool("school", "School Portal", "home-mgmt",
|
||||||
|
"School portal & learning resources", "https://school.lab.audasmedia.com.au",
|
||||||
|
login=True, who=("sam", "jo", "finn", "harry")),
|
||||||
Tool("sams", "Sams Files", "home-mgmt",
|
Tool("sams", "Sams Files", "home-mgmt",
|
||||||
"Home file server (LAN)", "http://sams.home.lab", lan=True),
|
"Home file server (LAN)", "http://sams.home.lab", lan=True),
|
||||||
|
|
||||||
@@ -333,6 +342,8 @@ def tools_for_user(user) -> list[tuple[str, list[Tool]]]:
|
|||||||
continue
|
continue
|
||||||
if tool.admin_service and not user.is_admin:
|
if tool.admin_service and not user.is_admin:
|
||||||
continue
|
continue
|
||||||
|
if tool.who is not None and user.username.strip().lower() not in tool.who:
|
||||||
|
continue
|
||||||
if not allowed.get(tool.category, True):
|
if not allowed.get(tool.category, True):
|
||||||
continue
|
continue
|
||||||
# Specialise the dsh chat link to the logged-in user's own instance.
|
# Specialise the dsh chat link to the logged-in user's own instance.
|
||||||
|
|||||||
Reference in New Issue
Block a user