mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-06 11:47:58 -05:00
* feat: permissions tab in plugin dialog ui draft * feat: allow full access, make threading a boolean * fix: clang-tidy * feat: save changes button * fix: clang-tidy * fix: only allow permission editing when plugin not loaded * fix: plugin permission drafts, target validation, and sidecar synchronization * fix: minor html/css changes * fix: Make plugin permission edits immediate and thread-safe * refactor: rehaul UI * fix: add don't show again to request permission dialog * fix: permission request dialog ui * fix: clean up plugin permission dialog and mutation APIs * fix: retry Windows plugin permission file replacement * test: extract and cover plugin permission validators * fix: show clear denial for worker plugin file operations * fix: clang-tidy * docs: clarify plugin filesystem permissions and clean up declaration * fix: handle the 3 states of install state read * fix: match equivalent paths for exact filesystem grants * fix: preserve unreadable plugin state and allow socket grant editing * Recover plugins whose install-state file cannot be parsed --------- Co-authored-by: SoftFever <103989404+SoftFever@users.noreply.github.com> Co-authored-by: SoftFever <softfeverever@gmail.com>
44 lines
2.1 KiB
C++
44 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <wx/string.h>
|
|
|
|
namespace Slic3r { namespace GUI {
|
|
|
|
// Selects the path rules a filesystem permission is validated against. Native follows the
|
|
// platform that will match the grant; Posix and Windows exist so tests can pin both rule sets
|
|
// on any host.
|
|
enum class PermissionPathStyle
|
|
{
|
|
Native,
|
|
Posix,
|
|
Windows
|
|
};
|
|
|
|
std::string trim_permission_target(const std::string& value);
|
|
|
|
// A tree wildcard may only be the final "/*"; "*" anywhere else is a literal character to the
|
|
// matcher, so accepting it here would promise a scope the grant does not have. Relative roots and
|
|
// ".." are refused for the same reason: they move the effective scope to the process working
|
|
// directory at match time.
|
|
bool normalize_filesystem_permission(const std::string& raw, std::string& normalized, wxString& error,
|
|
PermissionPathStyle style = PermissionPathStyle::Native);
|
|
|
|
// Validates the authority before handing the URL to the shared matcher normalizer. This catches
|
|
// malformed ports, unbracketed IPv6, userinfo and backslashes, which host_from_authority would
|
|
// otherwise silently turn into a different host. The canonical result drops port, path, query and
|
|
// fragment and lowercases scheme and host, exactly as the audit matcher stores and compares
|
|
// network grants.
|
|
bool normalize_network_permission(const std::string& raw, std::string& normalized, wxString& error);
|
|
|
|
// Validates a grant for the network_socket list. The audit matcher compares socket grants by host,
|
|
// and earlier releases saved either a bare address ("host", "host:443", "[::1]:443", a bare IPv6
|
|
// literal) or a Python address tuple such as "('host', 443)". Those saved shapes stay valid and are
|
|
// kept verbatim, because rewriting a bare address into an http(s) URL would add an HTTP grant the
|
|
// plugin never had. A full http:// or https:// URL is still validated and canonicalized exactly like
|
|
// normalize_network_permission, so the URL rules are unchanged.
|
|
bool normalize_socket_permission(const std::string& raw, std::string& normalized, wxString& error);
|
|
|
|
}} // namespace Slic3r::GUI
|