sftpgo-mirror/templates/webadmin/base.html
Nicola Murino 3dd412f6e3
WebAdmin and REST API: remove too granular permissions
Our permissions system for admin users is too granular and some
permissions overlap. For example, you can define an administrator
with the "manage_system" permission and not with the "manage_admins"
or "manage_user" permission, but the "manage_system" permission
allows you to restore a backup and then create users and
administrators. The following permissions will be removed:
"manage_admins", "manage_apikeys", "manage_system", "retention_checks",
"manage_event_rules", "manage_roles", "manage_ip_lists". Now you
need to add the "*" permission to replace the removed granular
permissions because the removed permissions allow actions that
should only be allowed to super administrators.
There is no point in having separate, overlapping permissions.

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
2024-11-10 10:46:28 +01:00

276 lines
No EOL
11 KiB
HTML

<!--
Copyright (C) 2024 Nicola Murino
This WebUI uses the KeenThemes Mega Bundle, a proprietary theme:
https://keenthemes.com/products/templates-mega-bundle
KeenThemes HTML/CSS/JS components are allowed for use only within the
SFTPGo product and restricted to be used in a resealable HTML template
that can compete with KeenThemes products anyhow.
This WebUI is allowed for use only within the SFTPGo product and
therefore cannot be used in derivative works/products without an
explicit grant from the SFTPGo Team (support@sftpgo.com).
-->
{{- define "navitems"}}
{{- block "additionalnavitems" .}}{{- end}}
{{- template "theme-switcher"}}
<div class="d-flex align-items-center ms-2 ms-lg-3">
<div class="btn btn-icon btn-active-light-primary w-35px h-35px w-md-40px h-md-40px" data-kt-menu-trigger="{default:'click', lg: 'hover'}" data-kt-menu-attach="parent" data-kt-menu-placement="bottom-end">
<i class="ki-duotone ki-user fs-2">
<i class="path1"></i>
<i class="path2"></i>
</i>
</div>
<div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-title-gray-700 menu-icon-gray-500 menu-active-bg menu-state-color fw-semibold py-4 w-250px" data-kt-menu="true">
<div class="menu-item px-3 my-0">
<div class="menu-content d-flex align-items-center px-3 py-2">
<div class="me-5">
<i class="ki-duotone ki-user fs-2">
<i class="path1"></i>
<i class="path2"></i>
</i>
</div>
<div class="d-flex flex-column">
<div class="fw-semibold d-flex align-items-center fs-5">
<span class="w-175px wrap-word">{{.LoggedUser.Username}}</span>
</div>
</div>
</div>
</div>
<div class="separator my-2"></div>
{{if not .HasExternalLogin}}
<div class="menu-item px-3 my-0">
<a href="{{.ProfileURL}}" class="menu-link px-3 py-2">
<span data-i18n="title.profile" class="menu-title">Profile</span>
</a>
</div>
<div class="menu-item px-3 my-0">
<a href="{{.ChangePwdURL}}" class="menu-link px-3 py-2">
<span data-i18n="title.change_password" class="menu-title">Change password</span>
</a>
</div>
{{if .LoggedUser.CanManageMFA}}
<div class="menu-item px-3 my-0">
<a href="{{.MFAURL}}" class="menu-link px-3 py-2">
<span data-i18n="title.two_factor_auth" class="menu-title">Two-factor authentication</span>
</a>
</div>
{{- end}}
{{- end}}
<div class="menu-item px-3 my-0">
<a id="id_logout_link" href="#" class="menu-link px-3 py-2">
<span data-i18n="login.signout" class="menu-title">Sign out</span>
</a>
</div>
</div>
</div>
{{- end}}
{{- define "sidebaritems"}}
{{- if .LoggedUser.HasPermission "view_users"}}
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .UsersURL}} active{{- end}}" href="{{.UsersURL}}">
<span class="menu-icon">
<i class="ki-duotone ki-people fs-1">
<span class="path1"></span>
<span class="path2"></span>
<span class="path3"></span>
<span class="path4"></span>
<span class="path5"></span>
</i>
</span>
<span data-i18n="title.users" class="menu-title">Users</span>
</a>
</div>
{{- end}}
{{- if .LoggedUser.HasPermission "manage_groups"}}
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .GroupsURL}} active{{- end}}" href="{{.GroupsURL}}">
<span class="menu-icon">
<i class="ki-duotone ki-profile-user fs-1">
<span class="path1"></span>
<span class="path2"></span>
<span class="path3"></span>
<span class="path4"></span>
</i>
</span>
<span data-i18n="title.groups" class="menu-title">Groups</span>
</a>
</div>
{{- end}}
{{- if .LoggedUser.HasPermission "manage_folders"}}
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .FoldersURL}} active{{- end}}" href="{{.FoldersURL}}">
<span class="menu-icon">
<i class="ki-duotone ki-folder fs-1">
<span class="path1"></span>
<span class="path2"></span>
</i>
</span>
<span data-i18n="title.folders" class="menu-title">Folders</span>
</a>
</div>
{{- end}}
{{- if .LoggedUser.HasPermission "view_conns"}}
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .ConnectionsURL}} active{{- end}}" href="{{.ConnectionsURL}}">
<span class="menu-icon">
<i class="ki-duotone ki-arrow-up-down fs-1">
<span class="path1"></span>
<span class="path2"></span>
</i>
</span>
<span data-i18n="title.connections" class="menu-title">Connections</span>
</a>
</div>
{{- end}}
{{ if .LoggedUser.HasPermission "*"}}
<div data-kt-menu-trigger="click" class="menu-item menu-accordion {{- if .IsEventManagerPage}} here show{{- end}}">
<span class="menu-link">
<span class="menu-icon">
<i class="ki-duotone ki-calendar fs-1">
<span class="path1"></span>
<span class="path2"></span>
</i>
</span>
<span data-i18n="title.event_manager" class="menu-title">Event Manager</span>
<span class="menu-arrow"></span>
</span>
<div class="menu-sub menu-sub-accordion">
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .EventRulesURL}} active{{- end}}" href="{{.EventRulesURL}}">
<span class="menu-bullet">
<span class="bullet bullet-dot"></span>
</span>
<span data-i18n="title.event_rules" class="menu-title fs-5 fw-semibold">Rules</span>
</a>
</div>
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .EventActionsURL}} active{{- end}}" href="{{.EventActionsURL}}">
<span class="menu-bullet">
<span class="bullet bullet-dot"></span>
</span>
<span data-i18n="title.event_actions" class="menu-title fs-5 fw-semibold">Actions</span>
</a>
</div>
</div>
</div>
{{- end}}
{{- if or (.LoggedUser.HasPermission "*") (and .HasDefender (.LoggedUser.HasPermission "view_defender"))}}
<div data-kt-menu-trigger="click" class="menu-item menu-accordion {{- if .IsIPManagerPage}} here show{{- end}}">
<span class="menu-link">
<span class="menu-icon">
<i class="ki-solid ki-shield fs-1"></i>
</span>
<span data-i18n="title.ip_manager" class="menu-title">IP Manager</span>
<span class="menu-arrow"></span>
</span>
<div class="menu-sub menu-sub-accordion">
{{- if .LoggedUser.HasPermission "*"}}
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .IPListsURL}} active{{- end}}" href="{{.IPListsURL}}">
<span class="menu-bullet">
<span class="bullet bullet-dot"></span>
</span>
<span data-i18n="title.ip_lists" class="menu-title fs-5 fw-semibold">IP lists</span>
</a>
</div>
{{- end}}
{{- if and .HasDefender (.LoggedUser.HasPermission "view_defender")}}
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .DefenderURL}} active{{- end}}" href="{{.DefenderURL}}">
<span class="menu-bullet">
<span class="bullet bullet-dot"></span>
</span>
<span data-i18n="title.defender" class="menu-title fs-5 fw-semibold">Auto Blocklist</span>
</a>
</div>
{{- end}}
</div>
</div>
{{- end}}
{{- if or (.LoggedUser.HasPermission "*") (.LoggedUser.HasPermission "view_status") (and .HasSearcher (.LoggedUser.HasPermission "view_events"))}}
<div data-kt-menu-trigger="click" class="menu-item menu-accordion {{- if .IsServerManagerPage}} here show{{- end}}">
<span class="menu-link">
<span class="menu-icon">
<i class="ki-duotone ki-setting-3 fs-1">
<span class="path1"></span>
<span class="path2"></span>
<span class="path3"></span>
<span class="path4"></span>
<span class="path5"></span>
</i>
</span>
<span data-i18n="title.server_manager" class="menu-title">Server Manager</span>
<span class="menu-arrow"></span>
</span>
<div class="menu-sub menu-sub-accordion">
{{- if .LoggedUser.HasPermission "*"}}
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .ConfigsURL}} active{{- end}}" href="{{.ConfigsURL}}">
<span class="menu-bullet">
<span class="bullet bullet-dot"></span>
</span>
<span data-i18n="title.configs" class="menu-title fs-5 fw-semibold">Configurations</span>
</a>
</div>
{{- end}}
{{ if and .HasSearcher (.LoggedUser.HasPermission "view_events")}}
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .EventsURL}} active{{- end}}" href="{{.EventsURL}}">
<span class="menu-bullet">
<span class="bullet bullet-dot"></span>
</span>
<span data-i18n="title.logs" class="menu-title fs-5 fw-semibold">Logs</span>
</a>
</div>
{{- end}}
{{- if .LoggedUser.HasPermission "*"}}
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .MaintenanceURL}} active{{- end}}" href="{{.MaintenanceURL}}">
<span class="menu-bullet">
<span class="bullet bullet-dot"></span>
</span>
<span data-i18n="title.maintenance" class="menu-title fs-5 fw-semibold">Maintenance</span>
</a>
</div>
{{- end}}
{{- if .LoggedUser.HasPermission "view_status"}}
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .StatusURL}} active{{- end}}" href="{{.StatusURL}}">
<span class="menu-bullet">
<span class="bullet bullet-dot"></span>
</span>
<span data-i18n="title.status" class="menu-title fs-5 fw-semibold">Status</span>
</a>
</div>
{{- end}}
</div>
</div>
{{- end}}
{{- if .LoggedUser.HasPermission "*"}}
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .AdminsURL}} active{{- end}}" href="{{.AdminsURL}}">
<span class="menu-icon">
<i class="ki-solid ki-security-user fs-1"></i>
</span>
<span data-i18n="title.admins" class="menu-title">Admins</span>
</a>
</div>
<div class="menu-item">
<a class="menu-link {{- if eq .CurrentURL .RolesURL}} active{{- end}}" href="{{.RolesURL}}">
<span class="menu-icon">
<i class="ki-duotone ki-user-tick fs-1">
<span class="path1"></span>
<span class="path2"></span>
<span class="path3"></span>
</i>
</span>
<span data-i18n="title.roles" class="menu-title">Roles</span>
</a>
</div>
{{- end}}
{{- end}}