https://github.com/dbus2/zbus_polkit
PolicyKit zbus proxy
https://github.com/dbus2/zbus_polkit
policykit security unix zbus
Last synced: 8 months ago
JSON representation
PolicyKit zbus proxy
- Host: GitHub
- URL: https://github.com/dbus2/zbus_polkit
- Owner: dbus2
- License: mit
- Created: 2023-07-29T21:18:45.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-09-21T08:43:11.000Z (9 months ago)
- Last Synced: 2025-09-27T15:43:59.444Z (9 months ago)
- Topics: policykit, security, unix, zbus
- Language: Rust
- Homepage:
- Size: 241 KB
- Stars: 9
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zbus_polkit
[](https://github.com/dbus2/zbus/actions/workflows/rust.yml)
[](https://docs.rs/zbus_polkit/)
[](https://crates.io/crates/zbus_polkit)
A crate to interact with [PolicyKit], a toolkit for defining and handling authorizations. It is used
for allowing unprivileged processes to speak to privileged processes.
**Status:** Stable.
## Example code
```rust,no_run
use zbus::Connection;
use zbus_polkit::policykit1::*;
// Although we use `tokio` here, you can use any async runtime of choice.
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box> {
let connection = Connection::system().await?;
let proxy = AuthorityProxy::new(&connection).await?;
let subject = Subject::new_for_owner(std::process::id(), None, None)?;
let result = proxy.check_authorization(
&subject,
"org.zbus.BeAwesome",
&std::collections::HashMap::new(),
CheckAuthorizationFlags::AllowUserInteraction.into(),
"",
).await?;
Ok(())
}
```
[PolicyKit]: https://gitlab.freedesktop.org/polkit/polkit/