|  |  |  | polkit Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Signals | ||||
#define POLKIT_BACKEND_AUTHORITY_EXTENSION_POINT_NAME PolkitBackendAuthority; struct PolkitBackendAuthorityClass; const gchar * polkit_backend_authority_get_name (PolkitBackendAuthority *authority); const gchar * polkit_backend_authority_get_version (PolkitBackendAuthority *authority); PolkitAuthorityFeatures polkit_backend_authority_get_features (PolkitBackendAuthority *authority); void polkit_backend_authority_check_authorization (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,const gchar *action_id,PolkitDetails *details,PolkitCheckAuthorizationFlags flags,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer user_data); PolkitAuthorizationResult * polkit_backend_authority_check_authorization_finish (PolkitBackendAuthority *authority,GAsyncResult *res,GError **error); gboolean polkit_backend_authority_register_authentication_agent (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,const gchar *locale,const gchar *object_path,GVariant *options,GError **error); gboolean polkit_backend_authority_unregister_authentication_agent (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,const gchar *object_path,GError **error); gboolean polkit_backend_authority_authentication_agent_response (PolkitBackendAuthority *authority,PolkitSubject *caller,const gchar *cookie,PolkitIdentity *identity,GError **error); GList * polkit_backend_authority_enumerate_actions (PolkitBackendAuthority *authority,PolkitSubject *caller,const gchar *locale,GError **error); GList * polkit_backend_authority_enumerate_temporary_authorizations (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,GError **error); gboolean polkit_backend_authority_revoke_temporary_authorizations (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,GError **error); gboolean polkit_backend_authority_revoke_temporary_authorization_by_id (PolkitBackendAuthority *authority,PolkitSubject *caller,const gchar *id,GError **error); PolkitBackendAuthority * polkit_backend_authority_get (void); gpointer polkit_backend_authority_register (PolkitBackendAuthority *authority,GDBusConnection *connection,const gchar *object_path,GError **error); void polkit_backend_authority_unregister (gpointer registration_id);
To implement an authority backend, simply subclass PolkitBackendAuthority and implement the required VFuncs.
#define POLKIT_BACKEND_AUTHORITY_EXTENSION_POINT_NAME "polkit-backend-authority-1"
Extension point name for authority backend implementations.
typedef struct _PolkitBackendAuthority PolkitBackendAuthority;
The PolkitBackendAuthority struct should not be accessed directly.
struct PolkitBackendAuthorityClass {
  GObjectClass parent_class;
  /* Signals */
  void (*changed)  (PolkitBackendAuthority   *authority);
  /* VTable */
  const gchar             *(*get_name)     (PolkitBackendAuthority *authority);
  const gchar             *(*get_version)  (PolkitBackendAuthority *authority);
  PolkitAuthorityFeatures  (*get_features) (PolkitBackendAuthority *authority);
  GList *(*enumerate_actions)  (PolkitBackendAuthority   *authority,
                                PolkitSubject            *caller,
                                const gchar              *locale,
                                GError                  **error);
  void (*check_authorization) (PolkitBackendAuthority        *authority,
                               PolkitSubject                 *caller,
                               PolkitSubject                 *subject,
                               const gchar                   *action_id,
                               PolkitDetails                 *details,
                               PolkitCheckAuthorizationFlags  flags,
                               GCancellable                  *cancellable,
                               GAsyncReadyCallback            callback,
                               gpointer                       user_data);
  PolkitAuthorizationResult * (*check_authorization_finish) (PolkitBackendAuthority  *authority,
                                                             GAsyncResult            *res,
                                                             GError                 **error);
  gboolean (*register_authentication_agent) (PolkitBackendAuthority   *authority,
                                             PolkitSubject            *caller,
                                             PolkitSubject            *subject,
                                             const gchar              *locale,
                                             const gchar              *object_path,
                                             GVariant                 *options,
                                             GError                  **error);
  gboolean (*unregister_authentication_agent) (PolkitBackendAuthority   *authority,
                                               PolkitSubject            *caller,
                                               PolkitSubject            *subject,
                                               const gchar              *object_path,
                                               GError                  **error);
  gboolean (*authentication_agent_response) (PolkitBackendAuthority   *authority,
                                             PolkitSubject            *caller,
                                             const gchar              *cookie,
                                             PolkitIdentity           *identity,
                                             GError                  **error);
  GList *(*enumerate_temporary_authorizations) (PolkitBackendAuthority   *authority,
                                                PolkitSubject            *caller,
                                                PolkitSubject            *subject,
                                                GError                  **error);
  gboolean (*revoke_temporary_authorizations) (PolkitBackendAuthority   *authority,
                                               PolkitSubject            *caller,
                                               PolkitSubject            *subject,
                                               GError                  **error);
  gboolean (*revoke_temporary_authorization_by_id) (PolkitBackendAuthority   *authority,
                                                    PolkitSubject            *caller,
                                                    const gchar              *id,
                                                    GError                  **error);
};
Class structure for PolkitBackendAuthority.
| GObjectClass  | The parent class. | 
| Function pointer for "changed" signal. | |
| Function pointer for the polkit_backend_authority_get_name()function. | |
| Function pointer for the polkit_backend_authority_get_version()function. | |
| Function pointer for the polkit_backend_authority_get_features()function. | |
| Enumerates registered actions on the
system. See polkit_backend_authority_enumerate_actions()for
details. | |
| Called to initiate an asynchronous
authorization check. See polkit_backend_authority_check_authorization()for details. | |
| Called when finishing an authorization
check. See polkit_backend_authority_check_authorization_finish()for details. | |
| Called when an authentication agent
is attempting to register or NULLif the backend doesn't support
the operation. Seepolkit_backend_authority_register_authentication_agent()for
details. | |
| Called when an authentication
agent is attempting to unregister or NULLif the backend doesn't
support the operation. Seepolkit_backend_authority_unregister_authentication_agent()for
details. | |
| Called by an authentication agent
when the user successfully authenticates or NULLif the backend
doesn't support the operation. Seepolkit_backend_authority_authentication_agent_response()for
details. | |
| Called to enumerate temporary
authorizations or NULLif the backend doesn't support the operation.
Seepolkit_backend_authority_enumerate_temporary_authorizations()for details. | |
| Called to revoke temporary
authorizations or NULLif the backend doesn't support the operation.
Seepolkit_backend_authority_revoke_temporary_authorizations()for details. | |
| Called to revoke a temporary
authorization identified by id or NULLif the backend doesn't support
the operation. Seepolkit_backend_authority_revoke_temporary_authorization_by_id()for details. | 
const gchar *       polkit_backend_authority_get_name   (PolkitBackendAuthority *authority);
Gets the name of the authority backend.
| 
 | A PolkitBackendAuthority. | 
| Returns : | The name of the backend. | 
const gchar *       polkit_backend_authority_get_version
                                                        (PolkitBackendAuthority *authority);
Gets the version of the authority backend.
| 
 | A PolkitBackendAuthority. | 
| Returns : | The name of the backend. | 
PolkitAuthorityFeatures polkit_backend_authority_get_features
                                                        (PolkitBackendAuthority *authority);
Gets the features supported by the authority backend.
| 
 | A PolkitBackendAuthority. | 
| Returns : | Flags from PolkitAuthorityFeatures. | 
void polkit_backend_authority_check_authorization (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,const gchar *action_id,PolkitDetails *details,PolkitCheckAuthorizationFlags flags,GCancellable *cancellable,GAsyncReadyCallback callback,gpointer user_data);
Asynchronously checks if subject is authorized to perform the action represented
by action_id.
When the operation is finished, callback will be invoked. You can then
call polkit_backend_authority_check_authorization_finish() to get the result of
the operation.
| 
 | A PolkitBackendAuthority. | 
| 
 | The system bus name that initiated the query. | 
| 
 | A PolkitSubject. | 
| 
 | The action to check for. | 
| 
 | Details about the action or NULL. | 
| 
 | A set of PolkitCheckAuthorizationFlags. | 
| 
 | A GCancellable. | 
| 
 | A GAsyncReadyCallback to call when the request is satisfied. | 
| 
 | The data to pass to callback. | 
PolkitAuthorizationResult * polkit_backend_authority_check_authorization_finish (PolkitBackendAuthority *authority,GAsyncResult *res,GError **error);
Finishes checking if a subject is authorized for an action.
| 
 | A PolkitBackendAuthority. | 
| 
 | A GAsyncResult obtained from the callback. | 
| 
 | Return location for error or NULL. | 
| Returns : | A PolkitAuthorizationResult or NULLiferroris set. Free withg_object_unref(). | 
gboolean polkit_backend_authority_register_authentication_agent (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,const gchar *locale,const gchar *object_path,GVariant *options,GError **error);
Registers an authentication agent.
| 
 | A PolkitBackendAuthority. | 
| 
 | The system bus name that initiated the query. | 
| 
 | The subject the authentication agent wants to register for. | 
| 
 | The locale of the authentication agent. | 
| 
 | The object path for the authentication agent. | 
| 
 | A GVariant with options or NULL. | 
| 
 | Return location for error or NULL. | 
| Returns : | TRUEif the authentication agent was successfully registered,FALSEiferroris set. | 
gboolean polkit_backend_authority_unregister_authentication_agent (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,const gchar *object_path,GError **error);
Unregisters an authentication agent.
| 
 | A PolkitBackendAuthority. | 
| 
 | The system bus name that initiated the query. | 
| 
 | The subject the agent claims to be registered at. | 
| 
 | The object path that the authentication agent is registered at. | 
| 
 | Return location for error or NULL. | 
| Returns : | TRUEif the authentication agent was successfully unregistered,FALSEiferroris set. | 
gboolean polkit_backend_authority_authentication_agent_response (PolkitBackendAuthority *authority,PolkitSubject *caller,const gchar *cookie,PolkitIdentity *identity,GError **error);
Provide response that identity successfully authenticated for the
authentication request identified by cookie.
| 
 | A PolkitBackendAuthority. | 
| 
 | The system bus name that initiated the query. | 
| 
 | The cookie passed to the authentication agent from the authority. | 
| 
 | The identity that was authenticated. | 
| 
 | Return location for error or NULL. | 
| Returns : | TRUEifauthorityacknowledged the call,FALSEiferroris set. | 
GList * polkit_backend_authority_enumerate_actions (PolkitBackendAuthority *authority,PolkitSubject *caller,const gchar *locale,GError **error);
Retrieves all registered actions.
| 
 | A PolkitBackendAuthority. | 
| 
 | The system bus name that initiated the query. | 
| 
 | The locale to retrieve descriptions for. | 
| 
 | Return location for error or NULL. | 
| Returns : | A list of PolkitActionDescription objects or NULLiferroris set. The returned list
should be freed withg_list_free()after each element have been freed withg_object_unref(). | 
GList * polkit_backend_authority_enumerate_temporary_authorizations (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,GError **error);
Gets temporary authorizations for subject.
| 
 | A PolkitBackendAuthority. | 
| 
 | The system bus name that initiated the query. | 
| 
 | The subject to get temporary authorizations for. | 
| 
 | Return location for error. | 
| Returns : | A list of PolkitTemporaryAuthorization objects or NULLiferroris set. The returned list
should be freed withg_list_free()after each element have been freed withg_object_unref(). | 
gboolean polkit_backend_authority_revoke_temporary_authorizations (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,GError **error);
Revokes temporary authorizations for subject.
| 
 | A PolkitBackendAuthority. | 
| 
 | The system bus name that initiated the query. | 
| 
 | The subject to revoke temporary authorizations for. | 
| 
 | Return location for error. | 
| Returns : | TRUEif the operation succeeded,FALSEiferroris set. | 
gboolean polkit_backend_authority_revoke_temporary_authorization_by_id (PolkitBackendAuthority *authority,PolkitSubject *caller,const gchar *id,GError **error);
Revokes a temporary authorizations with opaque identifier id.
| 
 | A PolkitBackendAuthority. | 
| 
 | The system bus name that initiated the query. | 
| 
 | The opaque identifier of the temporary authorization. | 
| 
 | Return location for error. | 
| Returns : | TRUEif the operation succeeded,FALSEiferroris set. | 
PolkitBackendAuthority * polkit_backend_authority_get   (void);
Loads all GIOModules from $(libdir)/polkit-1/extensions to determine
what implementation of PolkitBackendAuthority to use. Then instantiates an object of the
implementation with the highest priority and unloads all other modules.
| Returns : | A PolkitBackendAuthority. Free with g_object_unref(). | 
gpointer polkit_backend_authority_register (PolkitBackendAuthority *authority,GDBusConnection *connection,const gchar *object_path,GError **error);
Registers authority on a GDBusConnection.
| 
 | The GDBusConnection to register the authority on. | 
| 
 | A PolkitBackendAuthority. | 
| 
 | Object path of the authority. | 
| 
 | Return location for error. | 
| Returns : | A gpointer that can be used with polkit_backend_authority_unregister()orNULLiferroris set. | 
void                polkit_backend_authority_unregister (gpointer registration_id);
Unregisters a PolkitBackendAuthority registered with polkit_backend_authority_register().
| 
 | A gpointer obtained from polkit_backend_authority_register(). | 
"changed" signalvoid                user_function                      (PolkitBackendAuthority *authority,
                                                        gpointer                user_data)      : Run Last
Emitted when actions and/or authorizations change.
| 
 | A PolkitBackendAuthority. | 
| 
 | user data set when the signal handler was connected. |