Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dbus2/zbus_polkit
PolicyKit zbus proxy
https://github.com/dbus2/zbus_polkit
policykit security unix zbus
Last synced: about 2 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 (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-20T16:27:54.000Z (8 months ago)
- Last Synced: 2024-05-20T19:42:05.387Z (8 months ago)
- Topics: policykit, security, unix, zbus
- Language: Rust
- Homepage:
- Size: 93.8 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zbus_polkit
[![CI Pipeline Status](https://github.com/dbus2/zbus/actions/workflows/rust.yml/badge.svg)](https://github.com/dbus2/zbus/actions/workflows/rust.yml)
[![Documentation](https://docs.rs/zbus_polkit/badge.svg)](https://docs.rs/zbus_polkit/)
[![crates.io](https://img.shields.io/crates/v/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 `async-std` here, you can use any async runtime of choice.
#[async_std::main]
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/