|
|
|
|
@ -105,16 +105,19 @@ class PluginService:
|
|
|
|
|
@staticmethod
|
|
|
|
|
def _check_plugin_installation_scope(plugin_verification: Optional[PluginVerification]):
|
|
|
|
|
"""
|
|
|
|
|
Check the verification of the plugin
|
|
|
|
|
Check the plugin installation scope
|
|
|
|
|
"""
|
|
|
|
|
features = FeatureService.get_system_features()
|
|
|
|
|
|
|
|
|
|
match features.plugin_installation_permission.plugin_installation_scope:
|
|
|
|
|
case PluginInstallationScope.OFFICIAL_ONLY:
|
|
|
|
|
if plugin_verification.authorized_category != PluginVerification.AuthorizedCategory.Langgenius:
|
|
|
|
|
if (
|
|
|
|
|
plugin_verification is None
|
|
|
|
|
or plugin_verification.authorized_category != PluginVerification.AuthorizedCategory.Langgenius
|
|
|
|
|
):
|
|
|
|
|
raise PluginInstallationForbiddenError("Plugin installation is restricted to official only")
|
|
|
|
|
case PluginInstallationScope.OFFICIAL_AND_SPECIFIC_PARTNERS:
|
|
|
|
|
if plugin_verification.authorized_category not in [
|
|
|
|
|
if plugin_verification is None or plugin_verification.authorized_category not in [
|
|
|
|
|
PluginVerification.AuthorizedCategory.Langgenius,
|
|
|
|
|
PluginVerification.AuthorizedCategory.Partner,
|
|
|
|
|
]:
|
|
|
|
|
|