diff options
author | David Zeuthen <davidz@redhat.com> | 2009-07-13 12:59:46 -0400 |
---|---|---|
committer | David Zeuthen <davidz@redhat.com> | 2009-07-13 12:59:46 -0400 |
commit | 2434044da628dad2ceecf7d0231ddfccf9b39566 (patch) | |
tree | ed89196d8c96fc47aab9e094d94d5b26a5799b1e /src/polkit | |
parent | e88e67fa2b74a25533038ade78e3787b98fd1c53 (diff) | |
download | polkit-2434044da628dad2ceecf7d0231ddfccf9b39566.tar.gz |
Move local authority management to a separate library
Diffstat (limited to 'src/polkit')
-rw-r--r-- | src/polkit/Makefile.am | 12 | ||||
-rw-r--r-- | src/polkit/polkit.h | 2 | ||||
-rw-r--r-- | src/polkit/polkitauthoritymanager.c | 655 | ||||
-rw-r--r-- | src/polkit/polkitauthoritymanager.h | 139 | ||||
-rw-r--r-- | src/polkit/polkitauthorization.c | 149 | ||||
-rw-r--r-- | src/polkit/polkitauthorization.h | 65 | ||||
-rw-r--r-- | src/polkit/polkitprivate.h | 3 | ||||
-rw-r--r-- | src/polkit/polkittypes.h | 6 |
8 files changed, 4 insertions, 1027 deletions
diff --git a/src/polkit/Makefile.am b/src/polkit/Makefile.am index 0b06e5f..f37c98a 100644 --- a/src/polkit/Makefile.am +++ b/src/polkit/Makefile.am @@ -22,19 +22,19 @@ BUILT_SOURCES = \ # Build all the PolicyKit D-Bus code here, even the code we # only in the daemon for agent interaction # -polkit-built-sources.stamp : Makefile.am $(top_srcdir)/data/org.freedesktop.PolicyKit1.Authority.xml $(top_srcdir)/data/org.freedesktop.PolicyKit1.AuthorityManager.xml +polkit-built-sources.stamp : Makefile.am $(top_srcdir)/data/org.freedesktop.PolicyKit1.Authority.xml $(top_srcdir)/data/org.freedesktop.PolicyKit1.LocalAuthority.xml eggdbus-binding-tool \ --namespace "_Polkit" \ --dbus-namespace "org.freedesktop.PolicyKit1" \ --introspection-xml $(top_srcdir)/data/org.freedesktop.PolicyKit1.Authority.xml \ - --introspection-xml $(top_srcdir)/data/org.freedesktop.PolicyKit1.AuthorityManager.xml \ + --introspection-xml $(top_srcdir)/data/org.freedesktop.PolicyKit1.LocalAuthority.xml \ --introspection-xml $(top_srcdir)/data/org.freedesktop.PolicyKit1.AuthenticationAgent.xml \ - --stamp-file polkit-built-sources.stamp \ + --stamp-file polkit-built-sources.stamp \ $(NULL) # keep in sync with contents of polkit-built-sources.stamp (Thanks autotools) # -polkit_built_sources = _polkitbindingsmarshal.c _polkitbindingsmarshal.h _polkitbindingsmarshal.list _polkitbindings.c _polkitbindings.h _polkitbindingstypes.h _polkitauthenticationagent.c _polkitauthenticationagent.h docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml _polkitauthoritymanager.c _polkitauthoritymanager.h docbook-interface-org.freedesktop.PolicyKit1.AuthorityManager.xml _polkitauthority.c _polkitauthority.h docbook-interface-org.freedesktop.PolicyKit1.Authority.xml _polkiterror.c _polkiterror.h _polkitimplicitauthorization.c _polkitimplicitauthorization.h _polkitauthorizationresult.c _polkitauthorizationresult.h _polkitcheckauthorizationflags.c _polkitcheckauthorizationflags.h _polkitauthorization.c _polkitauthorization.h _polkitactiondescription.c _polkitactiondescription.h _polkitidentity.c _polkitidentity.h _polkitsubject.c _polkitsubject.h +polkit_built_sources = _polkitbindingsmarshal.c _polkitbindingsmarshal.h _polkitbindingsmarshal.list _polkitbindings.c _polkitbindings.h _polkitbindingstypes.h _polkitauthenticationagent.c _polkitauthenticationagent.h docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml _polkitlocalauthority.c _polkitlocalauthority.h docbook-interface-org.freedesktop.PolicyKit1.LocalAuthority.xml _polkitauthority.c _polkitauthority.h docbook-interface-org.freedesktop.PolicyKit1.Authority.xml _polkiterror.c _polkiterror.h _polkitimplicitauthorization.c _polkitimplicitauthorization.h _polkitauthorizationresult.c _polkitauthorizationresult.h _polkitcheckauthorizationflags.c _polkitcheckauthorizationflags.h _polkitlocalauthorization.c _polkitlocalauthorization.h _polkitactiondescription.c _polkitactiondescription.h _polkitidentity.c _polkitidentity.h _polkitsubject.c _polkitsubject.h lib_LTLIBRARIES=libpolkit-gobject-1.la @@ -47,7 +47,6 @@ libpolkit_gobject_1include_HEADERS = \ polkitactiondescription.h \ polkitdetails.h \ polkitauthority.h \ - polkitauthoritymanager.h \ polkiterror.h \ polkitsubject.h \ polkitunixprocess.h \ @@ -58,7 +57,6 @@ libpolkit_gobject_1include_HEADERS = \ polkitunixgroup.h \ polkitauthorizationresult.h \ polkitcheckauthorizationflags.h \ - polkitauthorization.h \ polkitimplicitauthorization.h \ $(NULL) @@ -69,7 +67,6 @@ libpolkit_gobject_1_la_SOURCES = \ polkitactiondescription.c polkitactiondescription.h \ polkitdetails.c polkitdetails.h \ polkitauthority.c polkitauthority.h \ - polkitauthoritymanager.c polkitauthoritymanager.h \ polkiterror.c polkiterror.h \ polkitsubject.c polkitsubject.h \ polkitunixprocess.c polkitunixprocess.h \ @@ -80,7 +77,6 @@ libpolkit_gobject_1_la_SOURCES = \ polkitunixgroup.c polkitunixgroup.h \ polkitauthorizationresult.c polkitauthorizationresult.h \ polkitcheckauthorizationflags.c polkitcheckauthorizationflags.h \ - polkitauthorization.c polkitauthorization.h \ polkitimplicitauthorization.c polkitimplicitauthorization.h \ $(NULL) diff --git a/src/polkit/polkit.h b/src/polkit/polkit.h index 29b27c5..ee3b0bd 100644 --- a/src/polkit/polkit.h +++ b/src/polkit/polkit.h @@ -37,8 +37,6 @@ #include <polkit/polkitauthorizationresult.h> #include <polkit/polkitcheckauthorizationflags.h> #include <polkit/polkitauthority.h> -#include <polkit/polkitauthoritymanager.h> -#include <polkit/polkitauthorization.h> #include <polkit/polkitdetails.h> #undef _POLKIT_INSIDE_POLKIT_H diff --git a/src/polkit/polkitauthoritymanager.c b/src/polkit/polkitauthoritymanager.c deleted file mode 100644 index a07156f..0000000 --- a/src/polkit/polkitauthoritymanager.c +++ /dev/null @@ -1,655 +0,0 @@ -/* - * Copyright (C) 2008 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: David Zeuthen <davidz@redhat.com> - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "polkitauthoritymanager.h" - -#include "polkitprivate.h" - -/** - * SECTION:polkitauthoritymanager - * @title: PolkitAuthorityManager - * @short_description: Authority Manager - * @stability: Unstable - * - * Manage authorizations. - * - * To use this unstable API you need to define the symbol - * <literal>POLKIT_I_KNOW_AUTHORITY_MANAGER_API_IS_SUBJECT_TO_CHANGE</literal>. - */ - -struct _PolkitAuthorityManager -{ - GObject parent_instance; - - EggDBusConnection *system_bus; - EggDBusObjectProxy *authority_manager_object_proxy; - - _PolkitAuthorityManager *real; -}; - -struct _PolkitAuthorityManagerClass -{ - GObjectClass parent_class; - -}; - -/* TODO: locking */ - -static PolkitAuthorityManager *the_authority_manager = NULL; - -G_DEFINE_TYPE (PolkitAuthorityManager, polkit_authority_manager, G_TYPE_OBJECT); - - -static void -polkit_authority_manager_init (PolkitAuthorityManager *authority_manager) -{ - authority_manager->system_bus = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM); - - authority_manager->authority_manager_object_proxy = egg_dbus_connection_get_object_proxy (authority_manager->system_bus, - "org.freedesktop.PolicyKit1", - "/org/freedesktop/PolicyKit1/Authority"); - - authority_manager->real = _POLKIT_QUERY_INTERFACE_AUTHORITY_MANAGER (authority_manager->authority_manager_object_proxy); -} - -static void -polkit_authority_manager_finalize (GObject *object) -{ - PolkitAuthorityManager *authority_manager; - - authority_manager = POLKIT_AUTHORITY_MANAGER (object); - - g_object_unref (authority_manager->authority_manager_object_proxy); - g_object_unref (authority_manager->system_bus); - - the_authority_manager = NULL; - - if (G_OBJECT_CLASS (polkit_authority_manager_parent_class)->finalize != NULL) - G_OBJECT_CLASS (polkit_authority_manager_parent_class)->finalize (object); -} - -static void -polkit_authority_manager_class_init (PolkitAuthorityManagerClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->finalize = polkit_authority_manager_finalize; - -} - -PolkitAuthorityManager * -polkit_authority_manager_get (void) -{ - if (the_authority_manager != NULL) - goto out; - - the_authority_manager = POLKIT_AUTHORITY_MANAGER (g_object_new (POLKIT_TYPE_AUTHORITY_MANAGER, NULL)); - - out: - return the_authority_manager; -} - -static void -generic_cb (GObject *source_obj, - GAsyncResult *res, - gpointer user_data) -{ - GAsyncResult **target_res = user_data; - - *target_res = g_object_ref (res); -} - -static void -generic_async_cb (GObject *source_obj, - GAsyncResult *res, - gpointer user_data) -{ - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data); - - g_simple_async_result_set_op_res_gpointer (simple, g_object_ref (res), g_object_unref); - g_simple_async_result_complete (simple); -} - -/* ---------------------------------------------------------------------------------------------------- */ - -static guint -polkit_authority_manager_enumerate_users_async (PolkitAuthorityManager *authority_manager, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - guint call_id; - GSimpleAsyncResult *simple; - - simple = g_simple_async_result_new (G_OBJECT (authority_manager), - callback, - user_data, - polkit_authority_manager_enumerate_users_async); - - call_id = _polkit_authority_manager_enumerate_users (authority_manager->real, - EGG_DBUS_CALL_FLAGS_NONE, - cancellable, - generic_async_cb, - simple); - - return call_id; -} - -void -polkit_authority_manager_enumerate_users (PolkitAuthorityManager *authority_manager, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - polkit_authority_manager_enumerate_users_async (authority_manager, cancellable, callback, user_data); -} - -GList * -polkit_authority_manager_enumerate_users_finish (PolkitAuthorityManager *authority_manager, - GAsyncResult *res, - GError **error) -{ - EggDBusArraySeq *array_seq; - GList *result; - guint n; - GSimpleAsyncResult *simple; - GAsyncResult *real_res; - - simple = G_SIMPLE_ASYNC_RESULT (res); - real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); - - g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_manager_enumerate_users_async); - - result = NULL; - - if (!_polkit_authority_manager_enumerate_users_finish (authority_manager->real, - &array_seq, - real_res, - error)) - goto out; - - for (n = 0; n < array_seq->size; n++) - { - _PolkitIdentity *real_identity; - - real_identity = array_seq->data.v_ptr[n]; - - result = g_list_prepend (result, polkit_identity_new_for_real (real_identity)); - } - - result = g_list_reverse (result); - - g_object_unref (array_seq); - - out: - g_object_unref (real_res); - return result; -} - -GList * -polkit_authority_manager_enumerate_users_sync (PolkitAuthorityManager *authority_manager, - GCancellable *cancellable, - GError **error) -{ - guint call_id; - GAsyncResult *res; - GList *result; - - call_id = polkit_authority_manager_enumerate_users_async (authority_manager, cancellable, generic_cb, &res); - - egg_dbus_connection_pending_call_block (authority_manager->system_bus, call_id); - - result = polkit_authority_manager_enumerate_users_finish (authority_manager, res, error); - - g_object_unref (res); - - return result; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -static guint -polkit_authority_manager_enumerate_groups_async (PolkitAuthorityManager *authority_manager, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - guint call_id; - GSimpleAsyncResult *simple; - - simple = g_simple_async_result_new (G_OBJECT (authority_manager), - callback, - user_data, - polkit_authority_manager_enumerate_groups_async); - - call_id = _polkit_authority_manager_enumerate_groups (authority_manager->real, - EGG_DBUS_CALL_FLAGS_NONE, - cancellable, - generic_async_cb, - simple); - - return call_id; -} - -void -polkit_authority_manager_enumerate_groups (PolkitAuthorityManager *authority_manager, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - polkit_authority_manager_enumerate_groups_async (authority_manager, cancellable, callback, user_data); -} - -GList * -polkit_authority_manager_enumerate_groups_finish (PolkitAuthorityManager *authority_manager, - GAsyncResult *res, - GError **error) -{ - EggDBusArraySeq *array_seq; - GList *result; - guint n; - GSimpleAsyncResult *simple; - GAsyncResult *real_res; - - simple = G_SIMPLE_ASYNC_RESULT (res); - real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); - - g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_manager_enumerate_groups_async); - - result = NULL; - - if (!_polkit_authority_manager_enumerate_groups_finish (authority_manager->real, - &array_seq, - real_res, - error)) - goto out; - - for (n = 0; n < array_seq->size; n++) - { - _PolkitIdentity *real_identity; - - real_identity = array_seq->data.v_ptr[n]; - - result = g_list_prepend (result, polkit_identity_new_for_real (real_identity)); - } - - result = g_list_reverse (result); - - g_object_unref (array_seq); - - out: - g_object_unref (real_res); - return result; -} - -GList * -polkit_authority_manager_enumerate_groups_sync (PolkitAuthorityManager *authority_manager, - GCancellable *cancellable, - GError **error) -{ - guint call_id; - GAsyncResult *res; - GList *result; - - call_id = polkit_authority_manager_enumerate_groups_async (authority_manager, cancellable, generic_cb, &res); - - egg_dbus_connection_pending_call_block (authority_manager->system_bus, call_id); - - result = polkit_authority_manager_enumerate_groups_finish (authority_manager, res, error); - - g_object_unref (res); - - return result; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -static guint -polkit_authority_manager_enumerate_authorizations_async (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - guint call_id; - GSimpleAsyncResult *simple; - _PolkitIdentity *real_identity; - - simple = g_simple_async_result_new (G_OBJECT (authority_manager), - callback, - user_data, - polkit_authority_manager_enumerate_authorizations_async); - - real_identity = polkit_identity_get_real (identity); - - call_id = _polkit_authority_manager_enumerate_authorizations (authority_manager->real, - EGG_DBUS_CALL_FLAGS_NONE, - real_identity, - cancellable, - generic_async_cb, - simple); - - g_object_unref (real_identity); - - return call_id; -} - -void -polkit_authority_manager_enumerate_authorizations (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - polkit_authority_manager_enumerate_authorizations_async (authority_manager, - identity, - cancellable, - callback, - user_data); -} - -GList * -polkit_authority_manager_enumerate_authorizations_finish (PolkitAuthorityManager *authority_manager, - GAsyncResult *res, - GError **error) -{ - EggDBusArraySeq *array_seq; - GList *result; - guint n; - GSimpleAsyncResult *simple; - GAsyncResult *real_res; - - simple = G_SIMPLE_ASYNC_RESULT (res); - real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); - - g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_manager_enumerate_authorizations_async); - - result = NULL; - - if (!_polkit_authority_manager_enumerate_authorizations_finish (authority_manager->real, - &array_seq, - real_res, - error)) - goto out; - - for (n = 0; n < array_seq->size; n++) - { - _PolkitAuthorization *real_authorization; - - real_authorization = array_seq->data.v_ptr[n]; - - result = g_list_prepend (result, polkit_authorization_new_for_real (real_authorization)); - } - - result = g_list_reverse (result); - - g_object_unref (array_seq); - - out: - g_object_unref (real_res); - return result; -} - - -GList * -polkit_authority_manager_enumerate_authorizations_sync (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - GCancellable *cancellable, - GError **error) -{ - guint call_id; - GAsyncResult *res; - GList *result; - - call_id = polkit_authority_manager_enumerate_authorizations_async (authority_manager, - identity, - cancellable, - generic_cb, - &res); - - egg_dbus_connection_pending_call_block (authority_manager->system_bus, call_id); - - result = polkit_authority_manager_enumerate_authorizations_finish (authority_manager, res, error); - - g_object_unref (res); - - return result; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -static guint -polkit_authority_manager_add_authorization_async (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - PolkitAuthorization *authorization, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - guint call_id; - GSimpleAsyncResult *simple; - _PolkitAuthorization *real_authorization; - _PolkitIdentity *real_identity; - - simple = g_simple_async_result_new (G_OBJECT (authority_manager), - callback, - user_data, - polkit_authority_manager_add_authorization_async); - - real_identity = polkit_identity_get_real (identity); - real_authorization = polkit_authorization_get_real (authorization); - - call_id = _polkit_authority_manager_add_authorization (authority_manager->real, - EGG_DBUS_CALL_FLAGS_NONE, - real_identity, - real_authorization, - cancellable, - generic_async_cb, - simple); - - g_object_unref (real_authorization); - g_object_unref (real_identity); - - return call_id; -} - -void -polkit_authority_manager_add_authorization (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - PolkitAuthorization *authorization, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - polkit_authority_manager_add_authorization_async (authority_manager, - identity, - authorization, - cancellable, - callback, - user_data); -} - -gboolean -polkit_authority_manager_add_authorization_finish (PolkitAuthorityManager *authority_manager, - GAsyncResult *res, - GError **error) -{ - GSimpleAsyncResult *simple; - GAsyncResult *real_res; - gboolean ret; - - simple = G_SIMPLE_ASYNC_RESULT (res); - real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); - - g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_manager_add_authorization_async); - - ret = _polkit_authority_manager_add_authorization_finish (authority_manager->real, - real_res, - error); - - if (!ret) - goto out; - - out: - g_object_unref (real_res); - return ret; -} - - -gboolean -polkit_authority_manager_add_authorization_sync (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - PolkitAuthorization *authorization, - GCancellable *cancellable, - GError **error) -{ - guint call_id; - GAsyncResult *res; - gboolean ret; - - call_id = polkit_authority_manager_add_authorization_async (authority_manager, - identity, - authorization, - cancellable, - generic_cb, - &res); - - egg_dbus_connection_pending_call_block (authority_manager->system_bus, call_id); - - ret = polkit_authority_manager_add_authorization_finish (authority_manager, res, error); - - g_object_unref (res); - - return ret; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -static guint -polkit_authority_manager_remove_authorization_async (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - PolkitAuthorization *authorization, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - guint call_id; - GSimpleAsyncResult *simple; - _PolkitAuthorization *real_authorization; - _PolkitIdentity *real_identity; - - simple = g_simple_async_result_new (G_OBJECT (authority_manager), - callback, - user_data, - polkit_authority_manager_remove_authorization_async); - - real_identity = polkit_identity_get_real (identity); - real_authorization = polkit_authorization_get_real (authorization); - - call_id = _polkit_authority_manager_remove_authorization (authority_manager->real, - EGG_DBUS_CALL_FLAGS_NONE, - real_identity, - real_authorization, - cancellable, - generic_async_cb, - simple); - - g_object_unref (real_authorization); - g_object_unref (real_identity); - - return call_id; -} - -void -polkit_authority_manager_remove_authorization (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - PolkitAuthorization *authorization, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - polkit_authority_manager_remove_authorization_async (authority_manager, - identity, - authorization, - cancellable, - callback, - user_data); -} - -gboolean -polkit_authority_manager_remove_authorization_finish (PolkitAuthorityManager *authority_manager, - GAsyncResult *res, - GError **error) -{ - GSimpleAsyncResult *simple; - GAsyncResult *real_res; - gboolean ret; - - simple = G_SIMPLE_ASYNC_RESULT (res); - real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple)); - - g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_manager_remove_authorization_async); - - ret = _polkit_authority_manager_remove_authorization_finish (authority_manager->real, - real_res, - error); - - if (!ret) - goto out; - - out: - g_object_unref (real_res); - return ret; -} - - -gboolean -polkit_authority_manager_remove_authorization_sync (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - PolkitAuthorization *authorization, - GCancellable *cancellable, - GError **error) -{ - guint call_id; - GAsyncResult *res; - gboolean ret; - - call_id = polkit_authority_manager_remove_authorization_async (authority_manager, - identity, - authorization, - cancellable, - generic_cb, - &res); - - egg_dbus_connection_pending_call_block (authority_manager->system_bus, call_id); - - ret = polkit_authority_manager_remove_authorization_finish (authority_manager, res, error); - - g_object_unref (res); - - return ret; -} - -/* ---------------------------------------------------------------------------------------------------- */ diff --git a/src/polkit/polkitauthoritymanager.h b/src/polkit/polkitauthoritymanager.h deleted file mode 100644 index d68e2a2..0000000 --- a/src/polkit/polkitauthoritymanager.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2008 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: David Zeuthen <davidz@redhat.com> - */ - -#if !defined (_POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H) -#error "Only <polkit/polkit.h> can be included directly, this file may disappear or change contents." -#endif - -#ifndef __POLKIT_AUTHORITY_MANAGER_H -#define __POLKIT_AUTHORITY_MANAGER_H - -#include <glib-object.h> -#include <gio/gio.h> -#include <polkit/polkittypes.h> - -#if defined (POLKIT_I_KNOW_AUTHORITY_MANAGER_API_IS_SUBJECT_TO_CHANGE) || defined (_POLKIT_COMPILATION) - -G_BEGIN_DECLS - -#define POLKIT_TYPE_AUTHORITY_MANAGER (polkit_authority_manager_get_type()) -#define POLKIT_AUTHORITY_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), POLKIT_TYPE_AUTHORITY_MANAGER, PolkitAuthorityManager)) -#define POLKIT_AUTHORITY_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), POLKIT_TYPE_AUTHORITY_MANAGER, PolkitAuthorityManagerClass)) -#define POLKIT_AUTHORITY_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), POLKIT_TYPE_AUTHORITY_MANAGER, PolkitAuthorityManagerClass)) -#define POLKIT_IS_AUTHORITY_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), POLKIT_TYPE_AUTHORITY_MANAGER)) -#define POLKIT_IS_AUTHORITY_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), POLKIT_TYPE_AUTHORITY_MANAGER)) - -#if 0 -typedef struct _PolkitAuthorityManager PolkitAuthorityManager; -#endif -typedef struct _PolkitAuthorityManagerClass PolkitAuthorityManagerClass; - -GType polkit_authority_manager_get_type (void) G_GNUC_CONST; - -PolkitAuthorityManager *polkit_authority_manager_get (void); - -/* ---------------------------------------------------------------------------------------------------- */ - -GList *polkit_authority_manager_enumerate_users_sync (PolkitAuthorityManager *authority_manager, - GCancellable *cancellable, - GError **error); - -GList *polkit_authority_manager_enumerate_groups_sync (PolkitAuthorityManager *authority_manager, - GCancellable *cancellable, - GError **error); - -GList *polkit_authority_manager_enumerate_authorizations_sync (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - GCancellable *cancellable, - GError **error); - -gboolean polkit_authority_manager_add_authorization_sync (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - PolkitAuthorization *authorization, - GCancellable *cancellable, - GError **error); - -gboolean polkit_authority_manager_remove_authorization_sync (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - PolkitAuthorization *authorization, - GCancellable *cancellable, - GError **error); - -/* ---------------------------------------------------------------------------------------------------- */ - - -void polkit_authority_manager_enumerate_users (PolkitAuthorityManager *authority_manager, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -GList * polkit_authority_manager_enumerate_users_finish (PolkitAuthorityManager *authority_manager, - GAsyncResult *res, - GError **error); - -void polkit_authority_manager_enumerate_groups (PolkitAuthorityManager *authority_manager, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -GList * polkit_authority_manager_enumerate_groups_finish (PolkitAuthorityManager *authority_manager, - GAsyncResult *res, - GError **error); - -void polkit_authority_manager_enumerate_authorizations (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -GList * polkit_authority_manager_enumerate_authorizations_finish (PolkitAuthorityManager *authority_manager, - GAsyncResult *res, - GError **error); - -void polkit_authority_manager_add_authorization (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - PolkitAuthorization *authorization, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean polkit_authority_manager_add_authorization_finish (PolkitAuthorityManager *authority_manager, - GAsyncResult *res, - GError **error); - -void polkit_authority_manager_remove_authorization (PolkitAuthorityManager *authority_manager, - PolkitIdentity *identity, - PolkitAuthorization *authorization, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean polkit_authority_manager_remove_authorization_finish (PolkitAuthorityManager *authority_manager, - GAsyncResult *res, - GError **error); - -/* ---------------------------------------------------------------------------------------------------- */ - -G_END_DECLS - -#endif /* API hiding */ - -#endif /* __POLKIT_AUTHORITY_MANAGER_H */ diff --git a/src/polkit/polkitauthorization.c b/src/polkit/polkitauthorization.c deleted file mode 100644 index a87c3e8..0000000 --- a/src/polkit/polkitauthorization.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (C) 2008 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: David Zeuthen <davidz@redhat.com> - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "polkitauthorization.h" -#include "polkitprivate.h" - -/** - * SECTION:polkitauthorization - * @title: PolkitAuthorization - * @short_description: Authorization - * @stability: Unstable - * - * This class represents an explicit authorization. - * - * To use this unstable API you need to define the symbol - * <literal>POLKIT_I_KNOW_AUTHORITY_MANAGER_API_IS_SUBJECT_TO_CHANGE</literal>. - */ - -struct _PolkitAuthorization -{ - GObject parent_instance; - - _PolkitAuthorization *real; - - PolkitSubject *subject; -}; - -struct _PolkitAuthorizationClass -{ - GObjectClass parent_class; - -}; - -G_DEFINE_TYPE (PolkitAuthorization, polkit_authorization, G_TYPE_OBJECT); - -static void -polkit_authorization_init (PolkitAuthorization *authorization) -{ -} - -static void -polkit_authorization_finalize (GObject *object) -{ - PolkitAuthorization *authorization; - - authorization = POLKIT_AUTHORIZATION (object); - - if (authorization->subject != NULL) - g_object_unref (authorization->subject); - - g_object_unref (authorization->real); - - if (G_OBJECT_CLASS (polkit_authorization_parent_class)->finalize != NULL) - G_OBJECT_CLASS (polkit_authorization_parent_class)->finalize (object); -} - -static void -polkit_authorization_class_init (PolkitAuthorizationClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - gobject_class->finalize = polkit_authorization_finalize; -} - -PolkitAuthorization * -polkit_authorization_new (const gchar *action_id, - PolkitSubject *subject, - gboolean is_negative) -{ - PolkitAuthorization *authorization; - _PolkitAuthorization *real; - _PolkitSubject *real_subject; - - real_subject = polkit_subject_get_real (subject); - - real = _polkit_authorization_new (action_id, real_subject, is_negative); - - g_object_unref (real_subject); - - authorization = polkit_authorization_new_for_real (real); - - g_object_unref (real); - - return authorization; -} - -PolkitAuthorization * -polkit_authorization_new_for_real (_PolkitAuthorization *real) -{ - PolkitAuthorization *authorization; - - authorization = POLKIT_AUTHORIZATION (g_object_new (POLKIT_TYPE_AUTHORIZATION, NULL)); - - authorization->real = g_object_ref (real); - - return authorization; -} - -_PolkitAuthorization * -polkit_authorization_get_real (PolkitAuthorization *authorization) -{ - return g_object_ref (authorization->real); -} - -/* ---------------------------------------------------------------------------------------------------- */ - -const gchar * -polkit_authorization_get_action_id (PolkitAuthorization *authorization) -{ - return _polkit_authorization_get_action_id (authorization->real); -} - - -PolkitSubject * -polkit_authorization_get_subject (PolkitAuthorization *authorization) -{ - if (authorization->subject == NULL) - authorization->subject = polkit_subject_new_for_real (_polkit_authorization_get_subject (authorization->real)); - - return authorization->subject; -} - -gboolean -polkit_authorization_get_is_negative (PolkitAuthorization *authorization) -{ - return _polkit_authorization_get_is_negative (authorization->real); -} diff --git a/src/polkit/polkitauthorization.h b/src/polkit/polkitauthorization.h deleted file mode 100644 index 53ba1a3..0000000 --- a/src/polkit/polkitauthorization.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2008 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: David Zeuthen <davidz@redhat.com> - */ - -#if !defined (_POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H) -#error "Only <polkit/polkit.h> can be included directly, this file may disappear or change contents." -#endif - -#ifndef __POLKIT_AUTHORIZATION_H -#define __POLKIT_AUTHORIZATION_H - -#include <glib-object.h> -#include <gio/gio.h> -#include <polkit/polkittypes.h> - -#if defined (POLKIT_I_KNOW_AUTHORITY_MANAGER_API_IS_SUBJECT_TO_CHANGE) || defined (_POLKIT_COMPILATION) - -G_BEGIN_DECLS - -#define POLKIT_TYPE_AUTHORIZATION (polkit_authorization_get_type()) -#define POLKIT_AUTHORIZATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), POLKIT_TYPE_AUTHORIZATION, PolkitAuthorization)) -#define POLKIT_AUTHORIZATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), POLKIT_TYPE_AUTHORIZATION, PolkitAuthorizationClass)) -#define POLKIT_AUTHORIZATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), POLKIT_TYPE_AUTHORIZATION, PolkitAuthorizationClass)) -#define POLKIT_IS_AUTHORIZATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), POLKIT_TYPE_AUTHORIZATION)) -#define POLKIT_IS_AUTHORIZATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), POLKIT_TYPE_AUTHORIZATION)) - -#if 0 -typedef struct _PolkitAuthorization PolkitAuthorization; -#endif -typedef struct _PolkitAuthorizationClass PolkitAuthorizationClass; - -GType polkit_authorization_get_type (void) G_GNUC_CONST; - -PolkitAuthorization *polkit_authorization_new (const gchar *action_id, - PolkitSubject *subject, - gboolean is_negative); - -const gchar *polkit_authorization_get_action_id (PolkitAuthorization *authorization); - -PolkitSubject *polkit_authorization_get_subject (PolkitAuthorization *authorization); - -gboolean polkit_authorization_get_is_negative (PolkitAuthorization *authorization); - -G_END_DECLS - -#endif /* API hiding */ - -#endif /* __POLKIT_AUTHORIZATION_H */ diff --git a/src/polkit/polkitprivate.h b/src/polkit/polkitprivate.h index 5a8b951..89601fc 100644 --- a/src/polkit/polkitprivate.h +++ b/src/polkit/polkitprivate.h @@ -44,9 +44,6 @@ _PolkitSubject *polkit_subject_get_real (PolkitSubject *subject); PolkitIdentity *polkit_identity_new_for_real (_PolkitIdentity *real); _PolkitIdentity *polkit_identity_get_real (PolkitIdentity *identity); -PolkitAuthorization *polkit_authorization_new_for_real (_PolkitAuthorization *real); -_PolkitAuthorization *polkit_authorization_get_real (PolkitAuthorization *authorization); - PolkitAuthorizationResult *polkit_authorization_result_new_for_real (_PolkitAuthorizationResult *real); _PolkitAuthorizationResult *polkit_authorization_result_get_real (PolkitAuthorizationResult *authorization_result); diff --git a/src/polkit/polkittypes.h b/src/polkit/polkittypes.h index 4344262..fcc98fa 100644 --- a/src/polkit/polkittypes.h +++ b/src/polkit/polkittypes.h @@ -27,9 +27,6 @@ struct _PolkitAuthority; typedef struct _PolkitAuthority PolkitAuthority; -struct _PolkitAuthorityManager; -typedef struct _PolkitAuthorityManager PolkitAuthorityManager; - struct _PolkitActionDescription; typedef struct _PolkitActionDescription PolkitActionDescription; @@ -52,9 +49,6 @@ typedef struct _PolkitUnixUser PolkitUnixUser; struct _PolkitUnixGroup; typedef struct _PolkitUnixGroup PolkitUnixGroup; -struct _PolkitAuthorization; -typedef struct _PolkitAuthorization PolkitAuthorization; - struct _PolkitAuthorizationResult; typedef struct _PolkitAuthorizationResult PolkitAuthorizationResult; |