PolkitAuthorizationResult: polkit Reference Manual

## PolkitAuthorizationResult PolkitAuthorizationResult — Result for checking an authorization |

## Stability Level

Stable, unless otherwise indicated

## Functions

PolkitAuthorizationResult * | polkit_authorization_result_new ()
gboolean | polkit_authorization_result_get_is_authorized ()
gboolean | polkit_authorization_result_get_is_challenge ()
gboolean | polkit_authorization_result_get_retains_authorization ()
const gchar * | polkit_authorization_result_get_temporary_authorization_id ()
gboolean | polkit_authorization_result_get_dismissed ()
PolkitDetails * | polkit_authorization_result_get_details ()

## Types and Values

| PolkitAuthorizationResult

## Object Hierarchy

        GObject
        ╰── PolkitAuthorizationResult

## Description

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

## Functions

### polkit_authorization_result_new ()

    PolkitAuthorizationResult *
    polkit_authorization_result_new (gboolean is_authorized,
                                     gboolean is_challenge,
                                     PolkitDetails *details);

Creates a new PolkitAuthorizationResult object.

#### Parameters

is_authorized | Whether the subject is authorized. |
is_challenge | Whether the subject is authorized if more information is provided. Must be `FALSE` unless `is_authorized` is `TRUE`. |
details | Must be `NULL` unless `is_authorized` is `TRUE`. | [allow-none]

#### Returns

A PolkitAuthorizationResult object. Free with `g_object_unref()`.

### polkit_authorization_result_get_is_authorized ()

    gboolean
    polkit_authorization_result_get_is_authorized
                                   (PolkitAuthorizationResult *result);

Gets whether the subject is authorized.

If the authorization is temporary, use `polkit_authorization_result_get_temporary_authorization_id()` to get the opaque identifier for the temporary authorization.

#### Parameters

result | A PolkitAuthorizationResult. |

#### Returns

Whether the subject is authorized.

### polkit_authorization_result_get_is_challenge ()

    gboolean
    polkit_authorization_result_get_is_challenge
                                   (PolkitAuthorizationResult *result);

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

#### Parameters

result | A PolkitAuthorizationResult. |

#### Returns

Whether the subject is authorized if more information is provided.

### polkit_authorization_result_get_retains_authorization ()

    gboolean
    polkit_authorization_result_get_retains_authorization
                                   (PolkitAuthorizationResult *result);

Gets whether authorization is retained if obtained via authentication. This can only be the case if `result` indicates that the subject can obtain authorization after challenge (cf. `polkit_authorization_result_get_is_challenge()`), e.g. when the subject is not already authorized (cf. `polkit_authorization_result_get_is_authorized()`).

If the subject is already authorized, use `polkit_authorization_result_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`.

#### Parameters

result | A PolkitAuthorizationResult. |

#### Returns

`TRUE` if the authorization is or will be temporary.

### polkit_authorization_result_get_temporary_authorization_id ()

    const gchar *
    polkit_authorization_result_get_temporary_authorization_id
                                   (PolkitAuthorizationResult *result);

Gets the opaque temporary authorization id for `result` if `result` 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_authorization_result_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`.

#### Parameters

result | A PolkitAuthorizationResult. |

#### Returns

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

[allow-none]

### polkit_authorization_result_get_dismissed ()

    gboolean
    polkit_authorization_result_get_dismissed
                                   (PolkitAuthorizationResult *result);

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`.

#### Parameters

result | A PolkitAuthorizationResult. |

#### Returns

`TRUE` if the authentication request was dismissed, `FALSE` otherwise.

Since: 0.101

### polkit_authorization_result_get_details ()

    PolkitDetails *
    polkit_authorization_result_get_details
                                   (PolkitAuthorizationResult *result);

Gets the details about the result.

#### Parameters

result | A PolkitAuthorizationResult. |

#### Returns

A PolkitDetails object or `NULL` if there are no details. This object is owned by `result` and should not be freed by the caller.

[allow-none][transfer none]

## Types and Values

### PolkitAuthorizationResult

    typedef struct _PolkitAuthorizationResult PolkitAuthorizationResult;

The PolkitAuthorizationResult struct should not be accessed directly.