feat(codegen): allow defining additional capabilities, closes #8798 - #8802
Conversation
|
RuntimeAuthority::add_capability implements the base API for #8799 |
| } | ||
| } | ||
|
|
||
| #[doc(hidden)] |
There was a problem hiding this comment.
does this need to be hidden also? and have this internal name? why not just expose it?
There was a problem hiding this comment.
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_contextproc macro to parse thecapabilitiesattribute: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
capabilitymethod:This API is more powerful since it can resolve the capability at compile time.