-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(codegen): allow defining additional capabilities, closes #8798 #8802
Conversation
RuntimeAuthority::add_capability implements the base API for #8799 |
@@ -84,6 +85,93 @@ impl RuntimeAuthority { | |||
} | |||
} | |||
|
|||
#[doc(hidden)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need to be hidden also? and have this internal name? why not just expose it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not stable yet.. maybe we move it under the unstable feature flag, but I don't like the idea of allowing devs to allow an specific command, they should go through the whole capabilities > permissions folow, this was just added for our examples which can't use a build script so they do not go through our ACL definitions
cc @tweidinger
Needs #8797 |
I would be ok with removing the option from the |
Can't we just provide an option to specify a capability file without #[cfg(not(beta))]
let context = tauri::generate_context!(capabilities = ["path/to/capability.json"]);
#[cfg(beta)]
let context = tauri::generate_context!(capabilities = ["path/to/capability-beta.json"]); |
Let's roll with that approach for now until Rust supports expanding cfg on the proc macro. |
Changes the
tauri::generate_context
proc macro to parse thecapabilities
attribute:In this case, the additional capabilities are parsed at runtime (limitation of proc-macro, cannot resolve the
#[cfg]
attributes :(Additionally, the tauri-build context codegen method now has a
capability
method:This API is more powerful since it can resolve the capability at compile time.