| Top |
To implement an authority backend, simply subclass PolkitBackendAuthority and implement the required VFuncs.
const gchar *
polkit_backend_authority_get_name (PolkitBackendAuthority *authority);
Gets the name of the authority backend.
const gchar *
polkit_backend_authority_get_version (PolkitBackendAuthority *authority);
Gets the version of the authority backend.
PolkitAuthorityFeatures
polkit_backend_authority_get_features (PolkitBackendAuthority *authority);
Gets the features supported by the authority backend.
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.
authority |
||
caller |
The system bus name that initiated the query. |
|
subject |
||
action_id |
The action to check for. |
|
details |
Details about the action or |
|
flags |
A set of PolkitCheckAuthorizationFlags. |
|
cancellable |
A GCancellable. |
|
callback |
A GAsyncReadyCallback to call when the request is satisfied. |
|
user_data |
The data to pass to |
PolkitAuthorizationResult * polkit_backend_authority_check_authorization_finish (PolkitBackendAuthority *authority,GAsyncResult *res,GError **error);
Finishes checking if a subject is authorized for an action.
authority |
||
res |
A GAsyncResult obtained from the callback. |
|
error |
Return location for error or |
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.
authority |
||
caller |
The system bus name that initiated the query. |
|
subject |
The subject the authentication agent wants to register for. |
|
locale |
The locale of the authentication agent. |
|
object_path |
The object path for the authentication agent. |
|
options |
||
error |
Return location for error or |
gboolean polkit_backend_authority_unregister_authentication_agent (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,const gchar *object_path,GError **error);
Unregisters an authentication agent.
authority |
||
caller |
The system bus name that initiated the query. |
|
subject |
The subject the agent claims to be registered at. |
|
object_path |
The object path that the authentication agent is registered at. |
|
error |
Return location for error or |
gboolean polkit_backend_authority_authentication_agent_response (PolkitBackendAuthority *authority,PolkitSubject *caller,uid_t uid,const gchar *cookie,PolkitIdentity *identity,GError **error);
Provide response that identity
successfully authenticated for the
authentication request identified by cookie
.
authority |
||
caller |
The system bus name that initiated the query. |
|
uid |
The real UID of the registered agent, or (uid_t)-1 if unknown. |
|
cookie |
The cookie passed to the authentication agent from the authority. |
|
identity |
The identity that was authenticated. |
|
error |
Return location for error or |
GList * polkit_backend_authority_enumerate_actions (PolkitBackendAuthority *authority,PolkitSubject *caller,const gchar *locale,GError **error);
Retrieves all registered actions.
authority |
||
caller |
The system bus name that initiated the query. |
|
locale |
The locale to retrieve descriptions for. |
|
error |
Return location for error or |
A list of PolkitActionDescription objects or NULL if error
is set. The returned list
should be freed with g_list_free() after each element have been freed with g_object_unref().
GList * polkit_backend_authority_enumerate_temporary_authorizations (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,GError **error);
Gets temporary authorizations for subject
.
authority |
||
caller |
The system bus name that initiated the query. |
|
subject |
The subject to get temporary authorizations for. |
|
error |
Return location for error. |
A list of PolkitTemporaryAuthorization objects or NULL if error
is set. The returned list
should be freed with g_list_free() after each element have been freed with g_object_unref().
gboolean polkit_backend_authority_revoke_temporary_authorizations (PolkitBackendAuthority *authority,PolkitSubject *caller,PolkitSubject *subject,GError **error);
Revokes temporary authorizations for subject
.
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
.
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.
gpointer polkit_backend_authority_register (PolkitBackendAuthority *authority,GDBusConnection *connection,const gchar *object_path,GError **error);
Registers authority
on a GDBusConnection.
connection |
The GDBusConnection to register the authority on. |
|
authority |
||
object_path |
Object path of the authority. |
|
error |
Return location for error. |
A gpointer that can be used with polkit_backend_authority_unregister() or NULL if error
is set.
void
polkit_backend_authority_unregister (gpointer registration_id);
Unregisters a PolkitBackendAuthority registered with polkit_backend_authority_register().
#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,
uid_t uid,
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 |
||
Function pointer for the |
||
Function pointer for the |
||
Enumerates registered actions on the
system. See |
||
Called to initiate an asynchronous
authorization check. See
|
||
Called when finishing an authorization
check. See |
||
Called when an authentication agent
is attempting to register or |
||
Called when an authentication
agent is attempting to unregister or |
||
Called by an authentication agent
when the user successfully authenticates or |
||
Called to enumerate temporary
authorizations or |
||
Called to revoke temporary
authorizations or |
||
Called to revoke a temporary
authorization identified by id or |
“changed” signalvoid user_function (PolkitBackendAuthority *authority, gpointer user_data)
Emitted when actions and/or authorizations change.
Flags: Run Last