check_authorization


Description:

public async AuthorizationResult check_authorization (Subject subject, string action_id, Details? details, CheckAuthorizationFlags flags, Cancellable? cancellable = null) throws Error

Asynchronously checks if subject is authorized to perform the action represented by action_id.

Note that polkit_check_authorization_flags_allow_user_interaction <emphasis>SHOULD</emphasis > be passed <emphasis>ONLY</emphasis> 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.

When the operation is finished, callback will be invoked in the <link linkend="g-main-context-push-thread-default"> thread-default main loop</link> of the thread you are calling this method from. You can then call check_authorization.end to get the result of the operation.

Known keys in details include <literal>polkit.message</literal> and <literal>polkit.gettext_domain< /literal> that can be used to override the message shown to the user. See the documentation for the <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.CheckAuthorization">D-Bus method</link> for more details.

If details is non-empty then the request will fail with FAILED unless the process doing the check itsef is sufficiently authorized (e.g. running as uid 0).

Parameters:

this

A Authority.

subject

A Subject.

action_id

The action to check for.

details

Details about the action or null.

flags

A set of CheckAuthorizationFlags.

cancellable

A Cancellable or null.

callback

A TaskReadyCallback to call when the request is satisfied.

user_data

The data to pass to callback.