mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-25 23:01:09 -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
@@ -721,6 +721,12 @@ bool PluginManager::get_install_state(const std::string& plugin_key, PluginInsta
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PluginManager::plugin_may_call_tools(const std::string& plugin_key)
|
||||
{
|
||||
PluginInstallState state;
|
||||
return get_install_state(plugin_key, state) && state.permissions.allows_tools();
|
||||
}
|
||||
|
||||
// ── Lifecycle ───────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
bool PluginManager::is_plugin_loaded(const std::string& plugin_key) const
|
||||
@@ -1457,6 +1463,8 @@ bool PluginManager::mutate_plugin_permissions(const std::string& plugin_key, con
|
||||
state.permissions.threading = *mutation.threading;
|
||||
if (mutation.full_access)
|
||||
state.permissions.full_access = *mutation.full_access;
|
||||
if (mutation.tools)
|
||||
state.permissions.tools = *mutation.tools;
|
||||
|
||||
if (!write_install_state(root, state)) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": Failed to write install state for " << plugin_key;
|
||||
|
||||
Reference in new issue
Block a user