Bläddra i källkod

fix(build): app ACL should be empty if no permissions are defined (#9024)

Lucas Fernandes Nogueira 1 år sedan
förälder
incheckning
f5e7f3843e

+ 11 - 8
core/tauri-build/src/lib.rs

@@ -492,14 +492,17 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
   manifest::check(&config, &mut manifest)?;
 
   let mut acl_manifests = acl::get_manifests_from_plugins()?;
-  acl_manifests.insert(
-    APP_ACL_KEY.into(),
-    acl::app_manifest_permissions(
-      &out_dir,
-      attributes.app_manifest,
-      &attributes.inlined_plugins,
-    )?,
-  );
+  let app_manifest = acl::app_manifest_permissions(
+    &out_dir,
+    attributes.app_manifest,
+    &attributes.inlined_plugins,
+  )?;
+  if app_manifest.default_permission.is_some()
+    || !app_manifest.permission_sets.is_empty()
+    || !app_manifest.permissions.is_empty()
+  {
+    acl_manifests.insert(APP_ACL_KEY.into(), app_manifest);
+  }
   acl_manifests.extend(acl::inline_plugins(&out_dir, attributes.inlined_plugins)?);
 
   std::fs::write(

+ 6 - 18
examples/api/src-tauri/tauri-plugin-sample/permissions/autogenerated/reference.md

@@ -1,18 +1,6 @@
-# Permissions
-
-## allow-ping
-
-Enables the ping command without any pre-configured scope.
-
-## deny-ping
-
-Denies the ping command without any pre-configured scope.
-
-## global-scope
-
-Sets a global scope.
-
-## allow-ping-scoped
-
-Enables the ping command with a test scope.
-
+| Permission | Description |
+|------|-----|
+|`allow-ping`|Enables the ping command without any pre-configured scope.|
+|`deny-ping`|Denies the ping command without any pre-configured scope.|
+|`global-scope`|Sets a global scope.|
+|`allow-ping-scoped`|Enables the ping command with a test scope.|