12 releases (7 stable)

2.0.2 May 10, 2022
2.0.1 Jan 12, 2022
2.0.0-beta.8 Dec 27, 2021
2.0.0-beta.7 Sep 29, 2021
1.0.1 Jul 19, 2020

#163 in Unix APIs

Download history 7972/week @ 2022-04-20 8659/week @ 2022-04-27 8610/week @ 2022-05-04 7579/week @ 2022-05-11 7464/week @ 2022-05-18 7943/week @ 2022-05-25 7625/week @ 2022-06-01 7495/week @ 2022-06-08 6472/week @ 2022-06-15 8003/week @ 2022-06-22 6136/week @ 2022-06-29 8024/week @ 2022-07-06 9182/week @ 2022-07-13 11319/week @ 2022-07-20 8091/week @ 2022-07-27 7044/week @ 2022-08-03

37,096 downloads per month

MIT license

1MB
18K SLoC

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

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<dyn std::error::Error>> {
    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(())
}

Dependencies

~6–12MB
~234K SLoC