[][src]Struct zbus_polkit::policykit1::AuthorityProxy

pub struct AuthorityProxy<'c>(_);

This D-Bus interface is implemented by the /org/freedesktop/PolicyKit1/Authority object on the well-known name org.freedesktop.PolicyKit1 on the system message bus.

Implementations

impl<'c> AuthorityProxy<'c>[src]

pub fn new(conn: &Connection) -> Result<Self>[src]

Creates a new proxy with the default service & path.

pub fn new_for(
    conn: &Connection,
    destination: &'c str,
    path: &'c str
) -> Result<Self>
[src]

Creates a new proxy for the given destination and path.

pub fn new_for_owned(
    conn: Connection,
    destination: String,
    path: String
) -> Result<Self>
[src]

Same as new_for but takes ownership of the passed arguments.

pub fn into_inner(self) -> Proxy<'c>[src]

Consumes self, returning the underlying zbus::Proxy.

pub fn inner(&self) -> &Proxy<'_>[src]

The reference to the underlying zbus::Proxy.

pub fn authentication_agent_response(
    &self,
    cookie: &str,
    identity: &Identity<'_>
) -> Result<()>
[src]

Method for authentication agents to invoke on successful authentication, intended only for use by a privileged helper process internal to polkit. This method will fail unless a sufficiently privileged +caller invokes it. Deprecated in favor of AuthenticationAgentResponse2().

pub fn authentication_agent_response2(
    &self,
    uid: u32,
    cookie: &str,
    identity: &Identity<'_>
) -> Result<()>
[src]

Method for authentication agents to invoke on successful authentication, intended only for use by a privileged helper process internal to polkit. This method will fail unless a sufficiently privileged caller invokes it. Note this method was introduced in 0.114 and should be preferred over AuthenticationAgentResponse() as it fixes a security issue.

pub fn cancel_check_authorization(&self, cancellation_id: &str) -> Result<()>[src]

Cancels an authorization check.

Arguments

  • cancellation_id - The cancellation_id passed to CheckAuthorization().

pub fn check_authorization(
    &self,
    subject: &Subject,
    action_id: &str,
    details: HashMap<&str, &str>,
    flags: BitFlags<CheckAuthorizationFlags>,
    cancellation_id: &str
) -> Result<AuthorizationResult>
[src]

Checks if subject is authorized to perform the action with identifier action_id

If cancellation_id is non-empty and already in use for the caller, the org.freedesktop.PolicyKit1.Error.CancellationIdNotUnique error is returned.

Note that CheckAuthorizationFlags::AllowUserInteraction SHOULD be passed ONLY if the event that triggered the authorization check is stemming from an user action, e.g. the user pressing a button or attaching a device.

Arguments

  • subject - A Subject struct.

  • action_id - Identifier for the action that subject is attempting to do.

  • details - Details describing the action. Keys starting with polkit. can only be set if defined in this document.

Known keys include polkit.message and polkit.gettext_domain that can be used to override the message shown to the user. This latter is needed because the user could be running an authentication agent in another locale than the calling process.

The (translated version of) polkit.message may include references to other keys that are expanded with their respective values. For example if the key device_file has the value /dev/sda then the message "Authenticate to format $(device_file)" is expanded to "Authenticate to format /dev/sda".

The key polkit.icon_name is used to override the icon shown in the authentication dialog.

If non-empty, then the request will fail with org.freedesktop.PolicyKit1.Error.Failed unless the process doing the check itsef is sufficiently authorized (e.g. running as uid 0).

  • flags - A set of CheckAuthorizationFlags.

  • cancellation_id - A unique id used to cancel the the authentication check via CancelCheckAuthorization() or the empty string if cancellation is not needed.

Returns: An AuthorizationResult structure.

pub fn enumerate_actions(&self, locale: &str) -> Result<Vec<ActionDescription>>[src]

Enumerates all registered PolicyKit actions.

Arguments:

  • locale - The locale to get descriptions in or the blank string to use the system locale.

pub fn enumerate_temporary_authorizations(
    &self,
    subject: &Subject
) -> Result<Vec<TemporaryAuthorization>>
[src]

Retrieves all temporary authorizations that applies to subject.

pub fn register_authentication_agent(
    &self,
    subject: &Subject,
    locale: &str,
    object_path: &str
) -> Result<()>
[src]

Register an authentication agent.

Note that this should be called by same effective UID which will be passed to AuthenticationAgentResponse2().

Arguments

  • subject - The subject to register the authentication agent for, typically a session subject.

  • locale - The locale of the authentication agent.

  • object_path - The object path of authentication agent object on the unique name of the caller.

pub fn register_authentication_agent_with_options(
    &self,
    subject: &Subject,
    locale: &str,
    object_path: &str,
    options: HashMap<&str, Value<'_>>
) -> Result<()>
[src]

Like RegisterAuthenticationAgent but takes additional options. If the option fallback (of type Boolean) is TRUE, then the authentcation agent will only be used as a fallback, e.g. if another agent (without the fallback option set TRUE) is available, it will be used instead.

pub fn revoke_temporary_authorization_by_id(&self, id: &str) -> Result<()>[src]

Revokes all temporary authorizations that applies to id.

pub fn revoke_temporary_authorizations(&self, subject: &Subject) -> Result<()>[src]

Revokes all temporary authorizations that applies to subject.

pub fn unregister_authentication_agent(
    &self,
    subject: &Subject,
    object_path: &str
) -> Result<()>
[src]

Unregister an authentication agent.

Arguments

  • subject - The subject passed to RegisterAuthenticationAgent().

  • object_path - The object_path passed to RegisterAuthenticationAgent().

pub fn backend_features(&self) -> Result<AuthorityFeatures>[src]

This signal is emitted when actions and/or authorizations change The features supported by the currently used Authority backend.

pub fn backend_name(&self) -> Result<String>[src]

The name of the currently used Authority backend.

pub fn backend_version(&self) -> Result<String>[src]

The version of the currently used Authority backend.

pub fn introspect(&self) -> Result<String>[src]

Trait Implementations

impl<'c> Deref for AuthorityProxy<'c>[src]

type Target = Proxy<'c>

The resulting type after dereferencing.

Auto Trait Implementations

impl<'c> !RefUnwindSafe for AuthorityProxy<'c>

impl<'c> !Send for AuthorityProxy<'c>

impl<'c> !Sync for AuthorityProxy<'c>

impl<'c> Unpin for AuthorityProxy<'c>

impl<'c> !UnwindSafe for AuthorityProxy<'c>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.