Struct zbus_polkit::policykit1::AuthorityProxyBlocking
source · pub struct AuthorityProxyBlocking<'p>(/* private fields */);
Expand description
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§
source§impl<'p> AuthorityProxyBlocking<'p>
impl<'p> AuthorityProxyBlocking<'p>
sourcepub fn new(conn: &Connection) -> Result<AuthorityProxyBlocking<'p>>
pub fn new(conn: &Connection) -> Result<AuthorityProxyBlocking<'p>>
Creates a new proxy with the default service and path.
sourcepub fn builder(conn: &Connection) -> Builder<'p, Self>
pub fn builder(conn: &Connection) -> Builder<'p, Self>
Returns a customizable builder for this proxy.
sourcepub fn into_inner(self) -> Proxy<'p>
pub fn into_inner(self) -> Proxy<'p>
Consumes self
, returning the underlying zbus::Proxy
.
sourcepub fn inner_mut(&mut self) -> &mut Proxy<'p>
pub fn inner_mut(&mut self) -> &mut Proxy<'p>
The mutable reference to the underlying zbus::Proxy
.
sourcepub fn authentication_agent_response(
&self,
cookie: &str,
identity: &Identity<'_>
) -> Result<()>
pub fn authentication_agent_response( &self, cookie: &str, identity: &Identity<'_> ) -> Result<()>
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()
.
sourcepub fn authentication_agent_response2(
&self,
uid: u32,
cookie: &str,
identity: &Identity<'_>
) -> Result<()>
pub fn authentication_agent_response2( &self, uid: u32, cookie: &str, identity: &Identity<'_> ) -> Result<()>
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.
Cancels an authorization check.
§Arguments
cancellation_id
- The cancellation_id passed toCheckAuthorization()
.
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 withpolkit.
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 itself is sufficiently authorized (e.g. running as uid
0).
-
flags
- A set ofCheckAuthorizationFlags
. -
cancellation_id
- A unique id used to cancel the the authentication check viaCancelCheckAuthorization()
or the empty string if cancellation is not needed.
Returns: An AuthorizationResult
structure.
sourcepub fn enumerate_actions(&self, locale: &str) -> Result<Vec<ActionDescription>>
pub fn enumerate_actions(&self, locale: &str) -> Result<Vec<ActionDescription>>
Enumerates all registered PolicyKit actions.
§Arguments:
locale
- The locale to get descriptions in or the blank string to use the system locale.
Retrieves all temporary authorizations that applies to subject.
sourcepub fn register_authentication_agent(
&self,
subject: &Subject,
locale: &str,
object_path: &str
) -> Result<()>
pub fn register_authentication_agent( &self, subject: &Subject, locale: &str, object_path: &str ) -> Result<()>
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.
sourcepub fn register_authentication_agent_with_options(
&self,
subject: &Subject,
locale: &str,
object_path: &str,
options: &HashMap<&str, Value<'_>>
) -> Result<()>
pub fn register_authentication_agent_with_options( &self, subject: &Subject, locale: &str, object_path: &str, options: &HashMap<&str, Value<'_>> ) -> Result<()>
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.
Revokes all temporary authorizations that applies to id
.
Revokes all temporary authorizations that applies to subject
.
sourcepub fn unregister_authentication_agent(
&self,
subject: &Subject,
object_path: &str
) -> Result<()>
pub fn unregister_authentication_agent( &self, subject: &Subject, object_path: &str ) -> Result<()>
Unregister an authentication agent.
§Arguments
-
subject
- The subject passed toRegisterAuthenticationAgent()
. -
object_path
- The object_path passed toRegisterAuthenticationAgent()
.
sourcepub fn receive_changed(&self) -> Result<ChangedIterator<'static>>
pub fn receive_changed(&self) -> Result<ChangedIterator<'static>>
Create a stream that receives Changed
signals.
This a convenient wrapper around zbus::blocking::Proxy::receive_signal
.
This signal is emitted when actions and/or authorizations change
sourcepub fn backend_features(&self) -> Result<AuthorityFeatures>
pub fn backend_features(&self) -> Result<AuthorityFeatures>
The features supported by the currently used Authority backend.
sourcepub fn cached_backend_features(
&self
) -> Result<Option<<Result<AuthorityFeatures> as ResultAdapter>::Ok>, <Result<AuthorityFeatures> as ResultAdapter>::Err>
pub fn cached_backend_features( &self ) -> Result<Option<<Result<AuthorityFeatures> as ResultAdapter>::Ok>, <Result<AuthorityFeatures> as ResultAdapter>::Err>
Get the cached value of the BackendFeatures
property, or None
if the property is not cached.
sourcepub fn receive_backend_features_changed(
&self
) -> PropertyIterator<'p, <Result<AuthorityFeatures> as ResultAdapter>::Ok>
pub fn receive_backend_features_changed( &self ) -> PropertyIterator<'p, <Result<AuthorityFeatures> as ResultAdapter>::Ok>
Create a stream for the BackendFeatures
property changes. This is a convenient wrapper around zbus::blocking::Proxy::receive_property_changed
.
sourcepub fn backend_name(&self) -> Result<String>
pub fn backend_name(&self) -> Result<String>
The name of the currently used Authority backend.
sourcepub fn cached_backend_name(
&self
) -> Result<Option<<Result<String> as ResultAdapter>::Ok>, <Result<String> as ResultAdapter>::Err>
pub fn cached_backend_name( &self ) -> Result<Option<<Result<String> as ResultAdapter>::Ok>, <Result<String> as ResultAdapter>::Err>
Get the cached value of the BackendName
property, or None
if the property is not cached.
sourcepub fn receive_backend_name_changed(
&self
) -> PropertyIterator<'p, <Result<String> as ResultAdapter>::Ok>
pub fn receive_backend_name_changed( &self ) -> PropertyIterator<'p, <Result<String> as ResultAdapter>::Ok>
Create a stream for the BackendName
property changes. This is a convenient wrapper around zbus::blocking::Proxy::receive_property_changed
.
sourcepub fn backend_version(&self) -> Result<String>
pub fn backend_version(&self) -> Result<String>
The version of the currently used Authority backend.
sourcepub fn cached_backend_version(
&self
) -> Result<Option<<Result<String> as ResultAdapter>::Ok>, <Result<String> as ResultAdapter>::Err>
pub fn cached_backend_version( &self ) -> Result<Option<<Result<String> as ResultAdapter>::Ok>, <Result<String> as ResultAdapter>::Err>
Get the cached value of the BackendVersion
property, or None
if the property is not cached.
sourcepub fn receive_backend_version_changed(
&self
) -> PropertyIterator<'p, <Result<String> as ResultAdapter>::Ok>
pub fn receive_backend_version_changed( &self ) -> PropertyIterator<'p, <Result<String> as ResultAdapter>::Ok>
Create a stream for the BackendVersion
property changes. This is a convenient wrapper around zbus::blocking::Proxy::receive_property_changed
.
Trait Implementations§
source§impl<'p> AsMut<Proxy<'p>> for AuthorityProxyBlocking<'p>
impl<'p> AsMut<Proxy<'p>> for AuthorityProxyBlocking<'p>
source§impl<'p> AsRef<Proxy<'p>> for AuthorityProxyBlocking<'p>
impl<'p> AsRef<Proxy<'p>> for AuthorityProxyBlocking<'p>
source§impl<'p> Clone for AuthorityProxyBlocking<'p>
impl<'p> Clone for AuthorityProxyBlocking<'p>
source§fn clone(&self) -> AuthorityProxyBlocking<'p>
fn clone(&self) -> AuthorityProxyBlocking<'p>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more