--- /dev/null
+<SECTION>
+<FILE>polkitunixuser</FILE>
+PolkitUnixUser
+polkit_unix_user_new
+polkit_unix_user_new_for_name
+polkit_unix_user_get_uid
+polkit_unix_user_set_uid
+<SUBSECTION Standard>
+PolkitUnixUserClass
+POLKIT_UNIX_USER
+POLKIT_IS_UNIX_USER
+POLKIT_TYPE_UNIX_USER
+polkit_unix_user_get_type
+POLKIT_UNIX_USER_CLASS
+POLKIT_IS_UNIX_USER_CLASS
+POLKIT_UNIX_USER_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>polkitauthoritymanager</FILE>
+PolkitAuthorityManager
+polkit_authority_manager_get
+polkit_authority_manager_enumerate_users_sync
+polkit_authority_manager_enumerate_groups_sync
+polkit_authority_manager_enumerate_authorizations_sync
+polkit_authority_manager_add_authorization_sync
+polkit_authority_manager_remove_authorization_sync
+polkit_authority_manager_enumerate_users
+polkit_authority_manager_enumerate_users_finish
+polkit_authority_manager_enumerate_groups
+polkit_authority_manager_enumerate_groups_finish
+polkit_authority_manager_enumerate_authorizations
+polkit_authority_manager_enumerate_authorizations_finish
+polkit_authority_manager_add_authorization
+polkit_authority_manager_add_authorization_finish
+polkit_authority_manager_remove_authorization
+polkit_authority_manager_remove_authorization_finish
+<SUBSECTION Standard>
+PolkitAuthorityManagerClass
+POLKIT_AUTHORITY_MANAGER
+POLKIT_IS_AUTHORITY_MANAGER
+POLKIT_TYPE_AUTHORITY_MANAGER
+polkit_authority_manager_get_type
+POLKIT_AUTHORITY_MANAGER_CLASS
+POLKIT_IS_AUTHORITY_MANAGER_CLASS
+POLKIT_AUTHORITY_MANAGER_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>polkitauthority</FILE>
+PolkitAuthority
+PolkitCheckAuthorizationFlags
+PolkitAuthorizationResult
+polkit_authority_get
+polkit_authority_enumerate_actions_sync
+polkit_authority_check_authorization_sync
+polkit_authority_register_authentication_agent_sync
+polkit_authority_unregister_authentication_agent_sync
+polkit_authority_authentication_agent_response_sync
+polkit_authority_enumerate_actions
+polkit_authority_enumerate_actions_finish
+polkit_authority_check_authorization
+polkit_authority_check_authorization_finish
+polkit_authority_register_authentication_agent
+polkit_authority_register_authentication_agent_finish
+polkit_authority_unregister_authentication_agent
+polkit_authority_unregister_authentication_agent_finish
+polkit_authority_authentication_agent_response
+polkit_authority_authentication_agent_response_finish
+<SUBSECTION Standard>
+PolkitAuthorityClass
+POLKIT_AUTHORITY
+POLKIT_IS_AUTHORITY
+POLKIT_TYPE_AUTHORITY
+polkit_authority_get_type
+POLKIT_AUTHORITY_CLASS
+POLKIT_IS_AUTHORITY_CLASS
+POLKIT_AUTHORITY_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>polkitsystembusname</FILE>
+PolkitSystemBusName
+polkit_system_bus_name_new
+polkit_system_bus_name_get_name
+polkit_system_bus_name_set_name
+<SUBSECTION Standard>
+PolkitSystemBusNameClass
+POLKIT_SYSTEM_BUS_NAME
+POLKIT_IS_SYSTEM_BUS_NAME
+POLKIT_TYPE_SYSTEM_BUS_NAME
+polkit_system_bus_name_get_type
+POLKIT_SYSTEM_BUS_NAME_CLASS
+POLKIT_IS_SYSTEM_BUS_NAME_CLASS
+POLKIT_SYSTEM_BUS_NAME_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>polkitunixgroup</FILE>
+PolkitUnixGroup
+polkit_unix_group_new
+polkit_unix_group_new_for_name
+polkit_unix_group_get_gid
+polkit_unix_group_set_gid
+<SUBSECTION Standard>
+PolkitUnixGroupClass
+POLKIT_UNIX_GROUP
+POLKIT_IS_UNIX_GROUP
+POLKIT_TYPE_UNIX_GROUP
+polkit_unix_group_get_type
+POLKIT_UNIX_GROUP_CLASS
+POLKIT_IS_UNIX_GROUP_CLASS
+POLKIT_UNIX_GROUP_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>polkitauthorization</FILE>
+PolkitAuthorization
+polkit_authorization_new
+polkit_authorization_get_action_id
+polkit_authorization_get_subject
+polkit_authorization_get_is_negative
+<SUBSECTION Standard>
+PolkitAuthorizationClass
+POLKIT_AUTHORIZATION
+POLKIT_IS_AUTHORIZATION
+POLKIT_TYPE_AUTHORIZATION
+polkit_authorization_get_type
+POLKIT_AUTHORIZATION_CLASS
+POLKIT_IS_AUTHORIZATION_CLASS
+POLKIT_AUTHORIZATION_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>polkitunixsession</FILE>
+PolkitUnixSession
+polkit_unix_session_new
+polkit_unix_session_get_session_id
+polkit_unix_session_set_session_id
+<SUBSECTION Standard>
+PolkitUnixSessionClass
+POLKIT_UNIX_SESSION
+POLKIT_IS_UNIX_SESSION
+POLKIT_TYPE_UNIX_SESSION
+polkit_unix_session_get_type
+POLKIT_UNIX_SESSION_CLASS
+POLKIT_IS_UNIX_SESSION_CLASS
+POLKIT_UNIX_SESSION_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>polkitunixprocess</FILE>
+PolkitUnixProcess
+polkit_unix_process_new
+polkit_unix_process_new_full
+polkit_unix_process_get_pid
+polkit_unix_process_get_start_time
+polkit_unix_process_set_pid
+<SUBSECTION Standard>
+PolkitUnixProcessClass
+POLKIT_UNIX_PROCESS
+POLKIT_IS_UNIX_PROCESS
+POLKIT_TYPE_UNIX_PROCESS
+polkit_unix_process_get_type
+POLKIT_UNIX_PROCESS_CLASS
+POLKIT_IS_UNIX_PROCESS_CLASS
+POLKIT_UNIX_PROCESS_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>polkitidentity</FILE>
+PolkitIdentity
+PolkitIdentityIface
+polkit_identity_hash
+polkit_identity_equal
+polkit_identity_to_string
+polkit_identity_from_string
+<SUBSECTION Standard>
+POLKIT_IDENTITY
+POLKIT_IS_IDENTITY
+POLKIT_TYPE_IDENTITY
+polkit_identity_get_type
+POLKIT_IDENTITY_GET_IFACE
+</SECTION>
+
+<SECTION>
+<FILE>polkitsubject</FILE>
+PolkitSubject
+PolkitSubjectIface
+polkit_subject_hash
+polkit_subject_equal
+polkit_subject_to_string
+polkit_subject_from_string
+<SUBSECTION Standard>
+POLKIT_SUBJECT
+POLKIT_IS_SUBJECT
+POLKIT_TYPE_SUBJECT
+polkit_subject_get_type
+POLKIT_SUBJECT_GET_IFACE
+</SECTION>
+
+<SECTION>
+<FILE>polkitactiondescription</FILE>
+PolkitActionDescription
+PolkitImplicitAuthorization
+polkit_action_description_get_action_id
+polkit_action_description_get_description
+polkit_action_description_get_message
+polkit_action_description_get_vendor_name
+polkit_action_description_get_vendor_url
+polkit_action_description_get_icon
+polkit_action_description_get_implicit_any
+polkit_action_description_get_implicit_inactive
+polkit_action_description_get_implicit_active
+polkit_action_description_get_annotation
+<SUBSECTION Standard>
+PolkitActionDescriptionClass
+POLKIT_ACTION_DESCRIPTION
+POLKIT_IS_ACTION_DESCRIPTION
+POLKIT_TYPE_ACTION_DESCRIPTION
+polkit_action_description_get_type
+POLKIT_ACTION_DESCRIPTION_CLASS
+POLKIT_IS_ACTION_DESCRIPTION_CLASS
+POLKIT_ACTION_DESCRIPTION_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>polkitcheckauthorizationflags</FILE>
+POLKIT_TYPE_CHECK_AUTHORIZATION_FLAGS
+PolkitCheckAuthorizationFlags
+<SUBSECTION Standard>
+polkit_check_authorization_flags_get_type
+</SECTION>
+
+<SECTION>
+<FILE>polkitimplicitauthorization</FILE>
+POLKIT_TYPE_IMPLICIT_AUTHORIZATION
+PolkitImplicitAuthorization
+polkit_implicit_authorization_to_string
+polkit_implicit_authorization_from_string
+<SUBSECTION Standard>
+polkit_implicit_authorization_get_type
+</SECTION>
+
+<SECTION>
+<FILE>polkiterror</FILE>
+POLKIT_ERROR
+POLKIT_TYPE_ERROR
+PolkitError
+<SUBSECTION Standard>
+polkit_error_quark
+polkit_error_get_type
+</SECTION>
+
+<SECTION>
+<FILE>polkitauthorizationresult</FILE>
+POLKIT_TYPE_AUTHORIZATION_RESULT
+PolkitAuthorizationResult
+<SUBSECTION Standard>
+polkit_authorization_result_get_type
+</SECTION>
+
* SECTION:polkitauthority
* @title: PolkitAuthority
* @short_description: Authority
+ * @stability: Stable
*
- * Checking claims.
+ * #PolkitAuthority is used for checking whether a given subject is
+ * authorized to perform a given action. Typically privileged system
+ * daemons or suid helpers will use this when handling requests from
+ * untrusted clients.
+ *
+ * User sessions can register an authentication agent with the
+ * authority. This is used for requests from untrusted clients where
+ * system policy requires that the user needs to acknowledge (through
+ * proving he is the user or the administrator) a given action.
*/
+/**
+ * PolkitAuthority:
+ *
+ * The #PolkitAuthority struct should not be accessed directly.
+ */
struct _PolkitAuthority
{
+ /*< private >*/
GObject parent_instance;
EggDBusConnection *system_bus;
0);
}
+/**
+ * polkit_authority_get:
+ *
+ * Gets a reference to the authority.
+ *
+ * Returns: A #PolkitAuthority. Free it with g_object_unref() when done with it.
+ **/
PolkitAuthority *
polkit_authority_get (void)
{
static guint
polkit_authority_enumerate_actions_async (PolkitAuthority *authority,
- const gchar *locale,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
call_id = _polkit_authority_enumerate_actions (authority->real,
EGG_DBUS_CALL_FLAGS_NONE,
- locale,
+ "", /* TODO: use current locale */
cancellable,
generic_async_cb,
simple);
return call_id;
}
+/**
+ * polkit_authority_enumerate_actions:
+ * @authority: A #PolkitAuthority.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
+ * @user_data: The data to pass to @callback.
+ *
+ * Asynchronously retrieves all registered actions.
+ *
+ * When the operation is finished, @callback will be invoked. You can then
+ * call polkit_authority_enumerate_actions_finish() to get the result of
+ * the operation.
+ **/
void
polkit_authority_enumerate_actions (PolkitAuthority *authority,
- const gchar *locale,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
- polkit_authority_enumerate_actions_async (authority, locale, cancellable, callback, user_data);
+ polkit_authority_enumerate_actions_async (authority, cancellable, callback, user_data);
}
+/**
+ * polkit_authority_enumerate_actions_finish:
+ * @authority: A #PolkitAuthority.
+ * @res: A #GAsyncResult obtained from the callback.
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes retrieving all registered actions.
+ *
+ * Returns: A list of #PolkitActionDescription 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_authority_enumerate_actions_finish (PolkitAuthority *authority,
GAsyncResult *res,
}
+/**
+ * polkit_authority_enumerate_actions_sync:
+ * @authority: A #PolkitAuthority.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Synchronously retrieves all registered actions.
+ *
+ * Returns: A list of #PolkitActionDescription 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_authority_enumerate_actions_sync (PolkitAuthority *authority,
- const gchar *locale,
GCancellable *cancellable,
GError **error)
{
GAsyncResult *res;
GList *result;
- call_id = polkit_authority_enumerate_actions_async (authority, locale, cancellable, generic_cb, &res);
+ call_id = polkit_authority_enumerate_actions_async (authority, cancellable, generic_cb, &res);
egg_dbus_connection_pending_call_block (authority->system_bus, call_id);
}
/* ---------------------------------------------------------------------------------------------------- */
-
static guint
polkit_authority_check_authorization_async (PolkitAuthority *authority,
PolkitSubject *subject,
return call_id;
}
+/**
+ * polkit_authority_check_authorization:
+ * @authority: A #PolkitAuthority.
+ * @subject: A #PolkitSubject.
+ * @action_id: The action to check for.
+ * @flags: A set of #PolkitCheckAuthorizationFlags.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
+ * @user_data: The data to pass to @callback.
+ *
+ * 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_authority_check_authorization_finish() to get the result of
+ * the operation.
+ **/
void
polkit_authority_check_authorization (PolkitAuthority *authority,
PolkitSubject *subject,
user_data);
}
+/**
+ * polkit_authority_check_authorization_finish:
+ * @authority: A #PolkitAuthority.
+ * @res: A #GAsyncResult obtained from the callback.
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes checking if a subject is authorized for an action.
+ *
+ * Returns: A #PolkitAuthorizationResult.
+ **/
PolkitAuthorizationResult
polkit_authority_check_authorization_finish (PolkitAuthority *authority,
GAsyncResult *res,
return result;
}
+/**
+ * polkit_authority_check_authorization:
+ * @authority: A #PolkitAuthority.
+ * @subject: A #PolkitSubject.
+ * @action_id: The action to check for.
+ * @flags: A set of #PolkitCheckAuthorizationFlags.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
+ * @user_data: The data to pass to @callback.
+ *
+ * Checks if @subject is authorized to perform the action represented by @action_id.
+ *
+ * Returns: A #PolkitAuthorizationResult.
+ */
PolkitAuthorizationResult
polkit_authority_check_authorization_sync (PolkitAuthority *authority,
PolkitSubject *subject,
return call_id;
}
+/**
+ * polkit_authority_register_authentication_agent:
+ * @authority: A #PolkitAuthority.
+ * @object_path: The object path for the authentication agent.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
+ * @user_data: The data to pass to @callback.
+ *
+ * Asynchronously registers an authentication agent.
+ *
+ * When the operation is finished, @callback will be invoked. You can then
+ * call polkit_authority_register_authentication_agent_finish() to get the result of
+ * the operation.
+ **/
void
polkit_authority_register_authentication_agent (PolkitAuthority *authority,
const gchar *object_path,
user_data);
}
+/**
+ * polkit_authority_register_authentication_agent_finish:
+ * @authority: A #PolkitAuthority.
+ * @res: A #GAsyncResult obtained from the callback.
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes registering an authentication agent.
+ *
+ * Returns: %TRUE if the authentication agent was successfully registered, %FALSE if @error is set.
+ **/
gboolean
polkit_authority_register_authentication_agent_finish (PolkitAuthority *authority,
GAsyncResult *res,
}
+/**
+ * polkit_authority_register_authentication_agent_sync:
+ * @authority: A #PolkitAuthority.
+ * @object_path: The object path for the authentication agent.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Registers an authentication agent.
+ *
+ * Returns: %TRUE if the authentication agent was successfully registered, %FALSE if @error is set.
+ **/
gboolean
polkit_authority_register_authentication_agent_sync (PolkitAuthority *authority,
const gchar *object_path,
return call_id;
}
+/**
+ * polkit_authority_unregister_authentication_agent:
+ * @authority: A #PolkitAuthority.
+ * @object_path: The object path that the authentication agent is registered at.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
+ * @user_data: The data to pass to @callback.
+ *
+ * Asynchronously unregisters an authentication agent.
+ *
+ * When the operation is finished, @callback will be invoked. You can then
+ * call polkit_authority_unregister_authentication_agent_finish() to get the result of
+ * the operation.
+ **/
void
polkit_authority_unregister_authentication_agent (PolkitAuthority *authority,
const gchar *object_path,
user_data);
}
+/**
+ * polkit_authority_unregister_authentication_agent_finish:
+ * @authority: A #PolkitAuthority.
+ * @res: A #GAsyncResult obtained from the callback.
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes unregistering an authentication agent.
+ *
+ * Returns: %TRUE if the authentication agent was successfully unregistered, %FALSE if @error is set.
+ **/
gboolean
polkit_authority_unregister_authentication_agent_finish (PolkitAuthority *authority,
GAsyncResult *res,
return ret;
}
-
+/**
+ * polkit_authority_unregister_authentication_agent_sync:
+ * @authority: A #PolkitAuthority.
+ * @object_path: The object path that the authentication agent is registered at.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Unregisters an authentication agent.
+ *
+ * Returns: %TRUE if the authentication agent was successfully unregistered, %FALSE if @error is set.
+ **/
gboolean
polkit_authority_unregister_authentication_agent_sync (PolkitAuthority *authority,
const gchar *object_path,
return call_id;
}
+/**
+ * polkit_authority_authentication_agent_response:
+ * @authority: A #PolkitAuthority.
+ * @cookie: The cookie passed to the authentication agent from the authority.
+ * @identity: The identity that was authenticated.
+ * @cancellable: A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
+ * @user_data: The data to pass to @callback.
+ *
+ * Asynchronously provide response that @identity successfully authenticated
+ * for the authentication request identified by @cookie.
+ *
+ * This function is only used by the privileged bits of an authentication agent.
+ * It will fail if the caller is not sufficiently privileged (typically uid 0).
+ *
+ * When the operation is finished, @callback will be invoked. You can then
+ * call polkit_authority_authentication_agent_response_finish() to get the result of
+ * the operation.
+ **/
void
polkit_authority_authentication_agent_response (PolkitAuthority *authority,
const gchar *cookie,
user_data);
}
+/**
+ * polkit_authority_authentication_agent_response_finish:
+ * @authority: A #PolkitAuthority.
+ * @res: A #GAsyncResult obtained from the callback.
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes providing response from an authentication agent.
+ *
+ * Returns: %TRUE if @authority acknowledged the call, %FALSE if @error is set.
+ **/
gboolean
polkit_authority_authentication_agent_response_finish (PolkitAuthority *authority,
GAsyncResult *res,
}
+/**
+ * polkit_authority_authentication_agent_response_sync:
+ * @authority: A #PolkitAuthority.
+ * @cookie: The cookie passed to the authentication agent from the authority.
+ * @identity: The identity that was authenticated.
+ * @cancellable: A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Provide response that @identity successfully authenticated for the
+ * authentication request identified by @cookie. See polkit_authority_authentication_agent_response()
+ * for limitations on who is allowed is to call this method.
+ *
+ * Returns: %TRUE if @authority acknowledged the call, %FALSE if @error is set.
+ **/
gboolean
polkit_authority_authentication_agent_response_sync (PolkitAuthority *authority,
const gchar *cookie,