Polkit.AuthorizationResult

g GObject.Object GObject.Object Polkit.AuthorizationResult Polkit.AuthorizationResult GObject.Object->Polkit.AuthorizationResult

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (is_authorized, is_challenge, details)

get_details ()

get_dismissed ()

get_is_authorized ()

get_is_challenge ()

get_retains_authorization ()

get_temporary_authorization_id ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Polkit.AuthorizationResult(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Polkit.AuthorizationResultClass

This class represents the result you get when checking for an authorization.

classmethod new(is_authorized, is_challenge, details)
Parameters:
  • is_authorized (bool) – Whether the subject is authorized.

  • is_challenge (bool) – Whether the subject is authorized if more information is provided. Must be False unless is_authorized is True.

  • details (Polkit.Details or None) – Must be None unless is_authorized is True

Returns:

A Polkit.AuthorizationResult object. Free with GObject.Object.unref().

Return type:

Polkit.AuthorizationResult

Creates a new Polkit.AuthorizationResult object.

get_details()
Returns:

A Polkit.Details object or None if there are no details. This object is owned by self and should not be freed by the caller.

Return type:

Polkit.Details or None

Gets the details about the result.

get_dismissed()
Returns:

True if the authentication request was dismissed, False otherwise.

Return type:

bool

Gets whether the authentication request was dismissed / canceled by the user.

This method simply reads the value of the key/value pair in details with the key polkit.dismissed.

New in version 0.101.

get_is_authorized()
Returns:

Whether the subject is authorized.

Return type:

bool

Gets whether the subject is authorized.

If the authorization is temporary, use Polkit.AuthorizationResult.get_temporary_authorization_id() to get the opaque identifier for the temporary authorization.

get_is_challenge()
Returns:

Whether the subject is authorized if more information is provided.

Return type:

bool

Gets whether the subject is authorized if more information is provided.

get_retains_authorization()
Returns:

True if the authorization is or will be temporary.

Return type:

bool

Gets whether authorization is retained if obtained via authentication. This can only be the case if self indicates that the subject can obtain authorization after challenge (cf. Polkit.AuthorizationResult.get_is_challenge()), e.g. when the subject is not already authorized (cf. Polkit.AuthorizationResult.get_is_authorized()).

If the subject is already authorized, use Polkit.AuthorizationResult.get_temporary_authorization_id() to check if the authorization is temporary.

This method simply reads the value of the key/value pair in details with the key polkit.retains_authorization_after_challenge.

get_temporary_authorization_id()
Returns:

The opaque temporary authorization id for self or None if not available. Do not free this string, it is owned by self.

Return type:

str or None

Gets the opaque temporary authorization id for self if self indicates the subject is authorized and the authorization is temporary rather than one-shot or permanent.

You can use this string together with the result from Polkit.Authority.enumerate_temporary_authorizations() to get more details about the temporary authorization or Polkit.Authority.revoke_temporary_authorization_by_id() to revoke the temporary authorization.

If the subject is not authorized, use Polkit.AuthorizationResult.get_retains_authorization() to check if the authorization will be retained if obtained via authentication.

This method simply reads the value of the key/value pair in details with the key polkit.temporary_authorization_id.