polkit-result

polkit-result — Result of PolicyKit queries

Synopsis




enum                PolKitResult;
const char*         polkit_result_to_string_representation
                                                        (PolKitResult result);
polkit_bool_t       polkit_result_from_string_representation
                                                        (const char *string,
                                                         PolKitResult *out_result);

Description

These functions are used to manipulate PolicyKit results.

Details

enum PolKitResult

typedef enum
{
        POLKIT_RESULT_UNKNOWN_ACTION,
        POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW,
        POLKIT_RESULT_NO,

        POLKIT_RESULT_ONLY_VIA_ROOT_AUTH,
        POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION,
        POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS,

        POLKIT_RESULT_ONLY_VIA_SELF_AUTH,
        POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION,
        POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS,

        POLKIT_RESULT_YES,
        POLKIT_RESULT_N_RESULTS
} PolKitResult;

Result codes from queries to PolicyKit. These are ordered and we say that a result A is "more strict" than a result B, if A has a lower numerical value. (e.g. POLKIT_RESULT_NO is more strict than POLKIT_RESULT_YES).

POLKIT_RESULT_UNKNOWN_ACTION The passed action is unknown.
POLKIT_RESULT_NOT_AUTHORIZED_TO_KNOW The caller of polkit is not sufficiently privilege to know the answer.
POLKIT_RESULT_NO Access denied.
POLKIT_RESULT_ONLY_VIA_ROOT_AUTH Access denied, but authentication of the caller as root will grant access to the resource... but the access isn't permanent
POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_SESSION Access denied, but authentication of the caller as root will grant access to the resource for the remainder of the session
POLKIT_RESULT_ONLY_VIA_ROOT_AUTH_KEEP_ALWAYS Access denied, but authentication of the caller as root will grant access to the resource in the future.
POLKIT_RESULT_ONLY_VIA_SELF_AUTH Access denied, but authentication of the caller as himself will grant access to the resource... but the access isn't permanent
POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION Access denied, but authentication of the caller as himself will grant access to the resource for the remainder of the session
POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS Access denied, but authentication of the caller as himself will grant access to the resource in the future.
POLKIT_RESULT_YES Access granted.
POLKIT_RESULT_N_RESULTS Number of result codes

polkit_result_to_string_representation ()

const char*         polkit_result_to_string_representation
                                                        (PolKitResult result);

Gives a textual representation of a PolKitResult object.

result : the given result to get a textual representation of
Returns : string representing the result (do not free) or NULL if the given result is invalid

polkit_result_from_string_representation ()

polkit_bool_t       polkit_result_from_string_representation
                                                        (const char *string,
                                                         PolKitResult *out_result);

Given a textual representation of a PolKitResult object, find the PolKitResult value.

string : textual representation of a PolKitResult object
out_result : return location for PolKitResult
Returns : TRUE if the textual representation was valid, otherwise FALSE