mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-05 19:27:57 -05:00
Ask before a plugin calls OrcaSlicer's tools
Any plugin could call OrcaSlicer's tools through orca.host.tools without a permission, so it could change your project, run post-processing scripts and answer permission prompts. It now needs the OrcaSlicer tools permission or full access, which it can declare as it loads or is asked for the first time it calls, like its other permissions. The Plugins dialog's Permissions tab has a switch for it, and turning it off ends what the plugin's calls left in force.
This commit is contained in:
1 parent
6609ca0503
commit
b3dcf0ac7d
39 files changed
+1395
-168
No files matched your search
@@ -1116,6 +1116,9 @@ InstallStateReadStatus read_install_state_status(const boost::filesystem::path&
|
||||
// key, a "true" string, a number or any other type leaves it off.
|
||||
if (permissions.contains("full_access") && permissions["full_access"].is_boolean())
|
||||
parsed.permissions.full_access = permissions["full_access"].get<bool>();
|
||||
// As full_access: only a JSON boolean counts.
|
||||
if (permissions.contains("tools") && permissions["tools"].is_boolean())
|
||||
parsed.permissions.tools = permissions["tools"].get<bool>();
|
||||
}
|
||||
|
||||
if (state.contains("enabled") && state["enabled"].is_boolean())
|
||||
@@ -1278,6 +1281,7 @@ bool write_install_state(const boost::filesystem::path& plugin_dir, const Plugin
|
||||
{"threading", state.permissions.threading},
|
||||
{"events", state.permissions.events},
|
||||
{"full_access", state.permissions.full_access},
|
||||
{"tools", state.permissions.tools},
|
||||
};
|
||||
|
||||
nlohmann::json capabilities = nlohmann::json::array();
|
||||
|
||||
Reference in new issue
Block a user