PolicyKit: Branch 'master'
David Zeuthen
david at kemper.freedesktop.org
Mon Jul 13 10:02:51 PDT 2009
configure.ac | 2
data/Makefile.am | 5
data/org.freedesktop.PolicyKit1.AuthorityManager.xml | 87 --
data/org.freedesktop.PolicyKit1.LocalAuthority.xml | 87 ++
data/polkit-local-1.pc.in | 11
docs/polkit/Makefile.am | 5
docs/polkit/polkit-1-docs.xml | 12
docs/polkit/polkit-1-sections.txt | 78 +-
docs/polkit/polkit-1.types | 9
src/Makefile.am | 2
src/nullbackend/Makefile.am | 1
src/polkit/Makefile.am | 12
src/polkit/polkit.h | 2
src/polkit/polkitauthoritymanager.c | 655 ------------------
src/polkit/polkitauthoritymanager.h | 139 ----
src/polkit/polkitauthorization.c | 149 ----
src/polkit/polkitauthorization.h | 65 -
src/polkit/polkitprivate.h | 3
src/polkit/polkittypes.h | 6
src/polkitbackend/Makefile.am | 28
src/polkitbackend/polkitbackendauthority.c | 67 +
src/polkitbackend/polkitbackendauthority.h | 26
src/polkitbackend/polkitbackendconfigsource.c | 2
src/polkitbackend/polkitbackendlocalauthority.c | 102 +-
src/polkitbackend/polkitbackendtypes.h | 6
src/polkitd/Makefile.am | 1
src/polkitlocal/Makefile.am | 54 +
src/polkitlocal/polkitlocal.h | 35 +
src/polkitlocal/polkitlocalauthority.c | 656 +++++++++++++++++++
src/polkitlocal/polkitlocalauthority.h | 135 +++
src/polkitlocal/polkitlocalauthorization.c | 150 ++++
src/polkitlocal/polkitlocalauthorization.h | 65 +
src/polkitlocal/polkitlocalprivate.h | 37 +
src/polkitlocal/polkitlocaltypes.h | 41 +
src/programs/Makefile.am | 1
35 files changed, 1459 insertions(+), 1277 deletions(-)
New commits:
commit 2434044da628dad2ceecf7d0231ddfccf9b39566
Author: David Zeuthen <davidz at redhat.com>
Date: Mon Jul 13 12:59:46 2009 -0400
Move local authority management to a separate library
diff --git a/configure.ac b/configure.ac
index 0857323..df2023a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -409,8 +409,10 @@ data/polkit-1
data/polkit-gobject-1.pc
data/polkit-backend-1.pc
data/polkit-agent-1.pc
+data/polkit-local-1.pc
src/Makefile
src/polkit/Makefile
+src/polkitlocal/Makefile
src/polkitbackend/Makefile
src/polkitagent/Makefile
src/polkitd/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index f4b1005..6422772 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -22,13 +22,13 @@ pam_DATA = polkit-1
endif
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = polkit-gobject-1.pc polkit-backend-1.pc polkit-agent-1.pc
+pkgconfig_DATA = polkit-gobject-1.pc polkit-backend-1.pc polkit-agent-1.pc polkit-local-1.pc
CLEANFILES = $(BUILT_SOURCES)
EXTRA_DIST = \
org.freedesktop.PolicyKit1.Authority.xml \
- org.freedesktop.PolicyKit1.AuthorityManager.xml \
+ org.freedesktop.PolicyKit1.LocalAuthority.xml \
org.freedesktop.PolicyKit1.AuthenticationAgent.xml \
$(service_in_files) \
$(dbusconf_in_files) \
@@ -36,6 +36,7 @@ EXTRA_DIST = \
polkit-gobject-1.pc.in \
polkit-backend-1.pc.in \
polkit-agent-1.pc.in \
+ polkit-local-1.pc.in \
$(NULL)
diff --git a/data/org.freedesktop.PolicyKit1.AuthorityManager.xml b/data/org.freedesktop.PolicyKit1.AuthorityManager.xml
deleted file mode 100644
index 053056c..0000000
--- a/data/org.freedesktop.PolicyKit1.AuthorityManager.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
-
- <interface name="org.freedesktop.PolicyKit1.AuthorityManager">
- <annotation name="org.gtk.EggDBus.DocString.Summary" value="Manage an Authority"/>
- <annotation name="org.gtk.EggDBus.DocString" value="This D-Bus interface <emphasis>may</emphasis> be implemented by the <literal>/org/freedesktop/PoliycKit1/Authority</literal> object on the well-known name <literal>org.freedesktop.PolicyKit1</literal> on the system message bus."/>
-
- <!-- Authorization struct -->
- <annotation name="org.gtk.EggDBus.DeclareStruct" value="Authorization">
- <annotation name="org.gtk.EggDBus.DocString.Summary" value="Authorizations"/>
- <annotation name="org.gtk.EggDBus.DocString" value="This struct describes an authorization belonging to an #Identity."/>
-
- <annotation name="org.gtk.EggDBus.Struct.Member" value="String:action_id">
- <annotation name="org.gtk.EggDBus.DocString" value="Identifier for the action the authorization is for."/>
- </annotation>
-
- <annotation name="org.gtk.EggDBus.Struct.Member" value="Subject:subject">
- <annotation name="org.gtk.EggDBus.Type" value="Subject"/>
- <annotation name="org.gtk.EggDBus.DocString" value="The #Subject that the authorization applies to."/>
- </annotation>
-
- <annotation name="org.gtk.EggDBus.Struct.Member" value="Boolean:is_negative">
- <annotation name="org.gtk.EggDBus.DocString" value="Whether the authorization is negative."/>
- </annotation>
- </annotation>
-
- <method name="EnumerateUsers">
- <annotation name="org.gtk.EggDBus.DocString" value="Enumerate all users known to the authority."/>
-
- <arg name="users" direction="out" type="a(sa{sv})">
- <annotation name="org.gtk.EggDBus.Type" value="Array<Identity>"/>
- <annotation name="org.gtk.EggDBus.DocString" value="An array of #Identity structs."/>
- </arg>
- </method>
-
- <method name="EnumerateGroups">
- <annotation name="org.gtk.EggDBus.DocString" value="Enumerate all groups known to the authority."/>
-
- <arg name="groups" direction="out" type="a(sa{sv})">
- <annotation name="org.gtk.EggDBus.Type" value="Array<Identity>"/>
- <annotation name="org.gtk.EggDBus.DocString" value="An array of #Identity structs."/>
- </arg>
- </method>
-
- <method name="AddAuthorization">
- <annotation name="org.gtk.EggDBus.DocString" value="Add an authorization to @identity."/>
-
- <arg name="identity" direction="in" type="(sa{sv})">
- <annotation name="org.gtk.EggDBus.Type" value="Identity"/>
- <annotation name="org.gtk.EggDBus.DocString" value="The #Identity to add @authorization to."/>
- </arg>
- <arg name="authorization" direction="in" type="(s(sa{sv})b)">
- <annotation name="org.gtk.EggDBus.Type" value="Authorization"/>
- <annotation name="org.gtk.EggDBus.DocString" value="The #Authorization to add to @identity."/>
- </arg>
- </method>
-
- <method name="RemoveAuthorization">
- <annotation name="org.gtk.EggDBus.DocString" value="Remove an authorization from @identity."/>
-
- <arg name="identity" direction="in" type="(sa{sv})">
- <annotation name="org.gtk.EggDBus.Type" value="Identity"/>
- <annotation name="org.gtk.EggDBus.DocString" value="The #Identity to remove @authorization from."/>
- </arg>
- <arg name="authorization" direction="in" type="(s(sa{sv})b)">
- <annotation name="org.gtk.EggDBus.Type" value="Authorization"/>
- <annotation name="org.gtk.EggDBus.DocString" value="The #Authorization to remove from @identity."/>
- </arg>
- </method>
-
- <method name="EnumerateAuthorizations">
- <annotation name="org.gtk.EggDBus.DocString" value="Enumerate all authorizations for @identity."/>
-
- <arg name="identity" direction="in" type="(sa{sv})">
- <annotation name="org.gtk.EggDBus.Type" value="Identity"/>
- <annotation name="org.gtk.EggDBus.StructType" value="Identity"/>
- <annotation name="org.gtk.EggDBus.DocString" value="An #Identity to enumerate authorizations for."/>
- </arg>
- <arg name="authorizations" direction="out" type="a(s(sa{sv})b)">
- <annotation name="org.gtk.EggDBus.Type" value="Array<Authorization>"/>
- <annotation name="org.gtk.EggDBus.DocString" value="An array of #Authorization structs for @identity."/>
- </arg>
- </method>
-
- </interface>
-</node>
diff --git a/data/org.freedesktop.PolicyKit1.LocalAuthority.xml b/data/org.freedesktop.PolicyKit1.LocalAuthority.xml
new file mode 100644
index 0000000..d6d263e
--- /dev/null
+++ b/data/org.freedesktop.PolicyKit1.LocalAuthority.xml
@@ -0,0 +1,87 @@
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+
+ <interface name="org.freedesktop.PolicyKit1.LocalAuthority">
+ <annotation name="org.gtk.EggDBus.DocString.Summary" value="Manage the local Authority"/>
+ <annotation name="org.gtk.EggDBus.DocString" value="This D-Bus interface <emphasis>may</emphasis> be implemented by the <literal>/org/freedesktop/PoliycKit1/Authority</literal> object on the well-known name <literal>org.freedesktop.PolicyKit1</literal> on the system message bus."/>
+
+ <!-- Authorization struct -->
+ <annotation name="org.gtk.EggDBus.DeclareStruct" value="LocalAuthorization">
+ <annotation name="org.gtk.EggDBus.DocString.Summary" value="Authorizations"/>
+ <annotation name="org.gtk.EggDBus.DocString" value="This struct describes an authorization belonging to an #Identity."/>
+
+ <annotation name="org.gtk.EggDBus.Struct.Member" value="String:action_id">
+ <annotation name="org.gtk.EggDBus.DocString" value="Identifier for the action the authorization is for."/>
+ </annotation>
+
+ <annotation name="org.gtk.EggDBus.Struct.Member" value="Subject:subject">
+ <annotation name="org.gtk.EggDBus.Type" value="Subject"/>
+ <annotation name="org.gtk.EggDBus.DocString" value="The #Subject that the authorization applies to."/>
+ </annotation>
+
+ <annotation name="org.gtk.EggDBus.Struct.Member" value="Boolean:is_negative">
+ <annotation name="org.gtk.EggDBus.DocString" value="Whether the authorization is negative."/>
+ </annotation>
+ </annotation>
+
+ <method name="EnumerateUsers">
+ <annotation name="org.gtk.EggDBus.DocString" value="Enumerate all users known to the authority."/>
+
+ <arg name="users" direction="out" type="a(sa{sv})">
+ <annotation name="org.gtk.EggDBus.Type" value="Array<Identity>"/>
+ <annotation name="org.gtk.EggDBus.DocString" value="An array of #Identity structs."/>
+ </arg>
+ </method>
+
+ <method name="EnumerateGroups">
+ <annotation name="org.gtk.EggDBus.DocString" value="Enumerate all groups known to the authority."/>
+
+ <arg name="groups" direction="out" type="a(sa{sv})">
+ <annotation name="org.gtk.EggDBus.Type" value="Array<Identity>"/>
+ <annotation name="org.gtk.EggDBus.DocString" value="An array of #Identity structs."/>
+ </arg>
+ </method>
+
+ <method name="AddAuthorization">
+ <annotation name="org.gtk.EggDBus.DocString" value="Add an authorization to @identity."/>
+
+ <arg name="identity" direction="in" type="(sa{sv})">
+ <annotation name="org.gtk.EggDBus.Type" value="Identity"/>
+ <annotation name="org.gtk.EggDBus.DocString" value="The #Identity to add @authorization to."/>
+ </arg>
+ <arg name="authorization" direction="in" type="(s(sa{sv})b)">
+ <annotation name="org.gtk.EggDBus.Type" value="LocalAuthorization"/>
+ <annotation name="org.gtk.EggDBus.DocString" value="The #LocalAuthorization to add to @identity."/>
+ </arg>
+ </method>
+
+ <method name="RemoveAuthorization">
+ <annotation name="org.gtk.EggDBus.DocString" value="Remove an authorization from @identity."/>
+
+ <arg name="identity" direction="in" type="(sa{sv})">
+ <annotation name="org.gtk.EggDBus.Type" value="Identity"/>
+ <annotation name="org.gtk.EggDBus.DocString" value="The #Identity to remove @authorization from."/>
+ </arg>
+ <arg name="authorization" direction="in" type="(s(sa{sv})b)">
+ <annotation name="org.gtk.EggDBus.Type" value="LocalAuthorization"/>
+ <annotation name="org.gtk.EggDBus.DocString" value="The #LocalAuthorization to remove from @identity."/>
+ </arg>
+ </method>
+
+ <method name="EnumerateAuthorizations">
+ <annotation name="org.gtk.EggDBus.DocString" value="Enumerate all authorizations for @identity."/>
+
+ <arg name="identity" direction="in" type="(sa{sv})">
+ <annotation name="org.gtk.EggDBus.Type" value="Identity"/>
+ <annotation name="org.gtk.EggDBus.StructType" value="Identity"/>
+ <annotation name="org.gtk.EggDBus.DocString" value="An #Identity to enumerate authorizations for."/>
+ </arg>
+ <arg name="authorizations" direction="out" type="a(s(sa{sv})b)">
+ <annotation name="org.gtk.EggDBus.Type" value="Array<LocalAuthorization>"/>
+ <annotation name="org.gtk.EggDBus.DocString" value="An array of #LocalAuthorization structs for @identity."/>
+ </arg>
+ </method>
+
+ </interface>
+</node>
diff --git a/data/polkit-local-1.pc.in b/data/polkit-local-1.pc.in
new file mode 100644
index 0000000..ab917c1
--- /dev/null
+++ b/data/polkit-local-1.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: polkit-local-1
+Description: PolicyKit Local Authority API
+Version: @VERSION@
+Libs: -L${libdir} -lpolkit-local-1
+Cflags: -I${includedir}/polkit-1
+Requires: polkit-gobject-1
diff --git a/docs/polkit/Makefile.am b/docs/polkit/Makefile.am
index 7461bfe..97308e7 100644
--- a/docs/polkit/Makefile.am
+++ b/docs/polkit/Makefile.am
@@ -35,6 +35,8 @@ INCLUDES = \
-I$(top_builddir)/src/polkitbackend \
-I$(top_srcdir)/src/polkitagent \
-I$(top_builddir)/src/polkitagent \
+ -I$(top_srcdir)/src/polkitlocal \
+ -I$(top_builddir)/src/polkitlocal \
$(NULL)
GTKDOC_LIBS = \
@@ -44,6 +46,7 @@ GTKDOC_LIBS = \
$(top_builddir)/src/polkit/libpolkit-gobject-1.la \
$(top_builddir)/src/polkitbackend/libpolkit-backend-1.la \
$(top_builddir)/src/polkitagent/libpolkit-agent-1.la \
+ $(top_builddir)/src/polkitlocal/libpolkit-local-1.la \
$(NULL)
# Extra options to supply to gtkdoc-mkdb
@@ -58,7 +61,7 @@ content_files = \
../extensiondir.xml \
../version.xml \
../../src/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml \
- ../../src/polkit/docbook-interface-org.freedesktop.PolicyKit1.AuthorityManager.xml \
+ ../../src/polkit/docbook-interface-org.freedesktop.PolicyKit1.LocalAuthority.xml \
../../src/polkit/docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml \
../man/PolicyKit-1.xml \
../man/pkcheck.xml \
diff --git a/docs/polkit/polkit-1-docs.xml b/docs/polkit/polkit-1-docs.xml
index 3128e02..8776354 100644
--- a/docs/polkit/polkit-1-docs.xml
+++ b/docs/polkit/polkit-1-docs.xml
@@ -62,19 +62,17 @@
<part id="ref-dbus-api">
<title>D-Bus API Reference</title>
<xi:include href="../../src/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml"/>
- <xi:include href="../../src/polkit/docbook-interface-org.freedesktop.PolicyKit1.AuthorityManager.xml"/>
+ <xi:include href="../../src/polkit/docbook-interface-org.freedesktop.PolicyKit1.LocalAuthority.xml"/>
<xi:include href="../../src/polkit/docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml"/>
</part>
<part id="ref-api">
- <title>Core API Reference</title>
+ <title>Client API Reference</title>
<xi:include href="xml/polkitauthority.xml"/>
<xi:include href="xml/polkitauthorizationresult.xml"/>
<xi:include href="xml/polkitdetails.xml"/>
<xi:include href="xml/polkiterror.xml"/>
<xi:include href="xml/polkitactiondescription.xml"/>
- <xi:include href="xml/polkitauthoritymanager.xml"/>
- <xi:include href="xml/polkitauthorization.xml"/>
<chapter id="subjects">
<title>Subjects</title>
<xi:include href="xml/polkitsubject.xml"/>
@@ -90,6 +88,12 @@
</chapter>
</part>
+ <part id="ref-local-api">
+ <title>Local Authority Client API Reference</title>
+ <xi:include href="xml/polkitlocalauthority.xml"/>
+ <xi:include href="xml/polkitlocalauthorization.xml"/>
+ </part>
+
<part id="ref-backend-api">
<title>Backend API Reference</title>
<xi:include href="xml/polkitbackendauthority.xml"/>
diff --git a/docs/polkit/polkit-1-sections.txt b/docs/polkit/polkit-1-sections.txt
index 619250e..2f2d9fa 100644
--- a/docs/polkit/polkit-1-sections.txt
+++ b/docs/polkit/polkit-1-sections.txt
@@ -48,33 +48,33 @@ POLKIT_AUTHORITY_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
+<FILE>polkitlocalauthority</FILE>
+PolkitLocalAuthority
+polkit_local_authority_get
+polkit_local_authority_enumerate_users_sync
+polkit_local_authority_enumerate_groups_sync
+polkit_local_authority_enumerate_authorizations_sync
+polkit_local_authority_add_authorization_sync
+polkit_local_authority_remove_authorization_sync
+polkit_local_authority_enumerate_users
+polkit_local_authority_enumerate_users_finish
+polkit_local_authority_enumerate_groups
+polkit_local_authority_enumerate_groups_finish
+polkit_local_authority_enumerate_authorizations
+polkit_local_authority_enumerate_authorizations_finish
+polkit_local_authority_add_authorization
+polkit_local_authority_add_authorization_finish
+polkit_local_authority_remove_authorization
+polkit_local_authority_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
+POLKIT_LOCAL_AUTHORITY
+POLKIT_IS_LOCAL_AUTHORITY
+POLKIT_TYPE_LOCAL_AUTHORITY
+polkit_local_authority_get_type
+POLKIT_LOCAL_AUTHORITY_CLASS
+POLKIT_IS_LOCAL_AUTHORITY_CLASS
+POLKIT_LOCAL_AUTHORITY_GET_CLASS
</SECTION>
<SECTION>
@@ -131,21 +131,21 @@ 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
+<FILE>polkitlocalauthorization</FILE>
+PolkitLocalAuthorization
+polkit_local_authorization_new
+polkit_local_authorization_get_action_id
+polkit_local_authorization_get_subject
+polkit_local_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
+PolkitLocalAuthorizationClass
+POLKIT_LOCAL_AUTHORIZATION
+POLKIT_IS_LOCAL_AUTHORIZATION
+POLKIT_TYPE_LOCAL_AUTHORIZATION
+polkit_local_authorization_get_type
+POLKIT_LOCAL_AUTHORIZATION_CLASS
+POLKIT_IS_LOCAL_AUTHORIZATION_CLASS
+POLKIT_LOCAL_AUTHORIZATION_GET_CLASS
</SECTION>
<SECTION>
diff --git a/docs/polkit/polkit-1.types b/docs/polkit/polkit-1.types
index 50a14c4..07b220a 100644
--- a/docs/polkit/polkit-1.types
+++ b/docs/polkit/polkit-1.types
@@ -1,17 +1,11 @@
polkit_authority_get_type
-polkit_authority_manager_get_type
-
-polkit_authorization_get_type
polkit_action_description_get_type
polkit_details_get_type
-
polkit_check_authorization_flags_get_type
polkit_implicit_authorization_get_type
-
polkit_identity_get_type
polkit_unix_user_get_type
polkit_unix_group_get_type
-
polkit_subject_get_type
polkit_unix_process_get_type
polkit_unix_session_get_type
@@ -19,6 +13,9 @@ polkit_system_bus_name_get_type
polkit_error_get_type
polkit_authorization_result_get_type
+polkit_local_authority_get_type
+polkit_local_authorization_get_type
+
polkit_backend_authority_get_type
polkit_backend_action_lookup_get_type
polkit_backend_local_authority_get_type
diff --git a/src/Makefile.am b/src/Makefile.am
index a90dba2..93426a9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,5 +1,5 @@
-SUBDIRS = polkit polkitbackend polkitagent polkitd nullbackend programs examples
+SUBDIRS = polkit polkitlocal polkitbackend polkitagent polkitd nullbackend programs examples
clean-local :
rm -f *~
diff --git a/src/nullbackend/Makefile.am b/src/nullbackend/Makefile.am
index 2a81ec1..13beb19 100644
--- a/src/nullbackend/Makefile.am
+++ b/src/nullbackend/Makefile.am
@@ -27,6 +27,7 @@ libnullbackend_la_SOURCES = \
libnullbackend_la_CFLAGS = \
-DPOLKIT_BACKEND_I_KNOW_API_IS_SUBJECT_TO_CHANGE \
+ -DPOLKIT_LOCAL_I_KNOW_API_IS_SUBJECT_TO_CHANGE \
-DG_LOG_DOMAIN=\"PolkitNullBackend\" \
$(GLIB_CFLAGS) \
$(NULL)
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 at 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 at 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 at 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 at 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;
diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am
index d8a1f4a..b6c27aa 100644
--- a/src/polkitbackend/Makefile.am
+++ b/src/polkitbackend/Makefile.am
@@ -5,6 +5,8 @@ INCLUDES = \
-I$(top_srcdir)/src \
-I$(top_builddir)/src/polkit \
-I$(top_srcdir)/src/polkit \
+ -I$(top_builddir)/src/polkitlocal \
+ -I$(top_srcdir)/src/polkitlocal \
-DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \
-DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \
-DPACKAGE_DATA_DIR=\""$(datadir)"\" \
@@ -15,6 +17,7 @@ INCLUDES = \
-D_POSIX_PTHREAD_SEMANTICS \
-D_REENTRANT \
-DEGG_DBUS_I_KNOW_API_IS_SUBJECT_TO_CHANGE \
+ -DPOLKIT_LOCAL_I_KNOW_API_IS_SUBJECT_TO_CHANGE \
$(NULL)
BUILT_SOURCES = \
@@ -48,18 +51,18 @@ libpolkit_backend_1include_HEADERS = \
polkitbackendactionlookup.h \
$(NULL)
-libpolkit_backend_1_la_SOURCES = \
- $(ck_built_sources) \
- $(BUILT_SOURCES) \
- polkitbackend.h \
- polkitbackendtypes.h \
- polkitbackendprivate.h \
- polkitbackendauthority.h polkitbackendauthority.c \
- polkitbackendlocalauthority.h polkitbackendlocalauthority.c \
- polkitbackendactionpool.h polkitbackendactionpool.c \
- polkitbackendsessionmonitor.h polkitbackendsessionmonitor.c \
- polkitbackendconfigsource.h polkitbackendconfigsource.c \
- polkitbackendactionlookup.h polkitbackendactionlookup.c \
+libpolkit_backend_1_la_SOURCES = \
+ $(ck_built_sources) \
+ $(BUILT_SOURCES) \
+ polkitbackend.h \
+ polkitbackendtypes.h \
+ polkitbackendprivate.h \
+ polkitbackendauthority.h polkitbackendauthority.c \
+ polkitbackendlocalauthority.h polkitbackendlocalauthority.c \
+ polkitbackendactionpool.h polkitbackendactionpool.c \
+ polkitbackendsessionmonitor.h polkitbackendsessionmonitor.c \
+ polkitbackendconfigsource.h polkitbackendconfigsource.c \
+ polkitbackendactionlookup.h polkitbackendactionlookup.c \
$(NULL)
libpolkit_backend_1_la_CFLAGS = \
@@ -73,6 +76,7 @@ libpolkit_backend_1_la_LIBADD = \
$(GLIB_LIBS) \
$(EGG_DBUS_LIBS) \
$(top_builddir)/src/polkit/libpolkit-gobject-1.la \
+ $(top_builddir)/src/polkitlocal/libpolkit-local-1.la \
$(EXPAT_LIBS) \
$(NULL)
diff --git a/src/polkitbackend/polkitbackendauthority.c b/src/polkitbackend/polkitbackendauthority.c
index b1a51c1..2de548e 100644
--- a/src/polkitbackend/polkitbackendauthority.c
+++ b/src/polkitbackend/polkitbackendauthority.c
@@ -23,8 +23,13 @@
#include <errno.h>
#include <pwd.h>
#include <string.h>
+
#include <polkit/polkit.h>
#include <polkit/polkitprivate.h>
+
+#include <polkitlocal/polkitlocal.h>
+#include <polkitlocal/polkitlocalprivate.h>
+
#include "polkitbackendauthority.h"
#include "polkitbackendactionlookup.h"
#include "polkitbackendlocalauthority.h"
@@ -295,7 +300,7 @@ polkit_backend_authority_check_authorization_finish (PolkitBackendAuthority *au
*
* Retrieves all authorizations for @identity.
*
- * Returns: A list of #PolkitAuthorization objects or %NULL if @error is set. The returned list
+ * Returns: A list of #PolkitLocalAuthorization 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 *
@@ -338,7 +343,7 @@ gboolean
polkit_backend_authority_add_authorization (PolkitBackendAuthority *authority,
PolkitSubject *caller,
PolkitIdentity *identity,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error)
{
PolkitBackendAuthorityClass *klass;
@@ -375,7 +380,7 @@ gboolean
polkit_backend_authority_remove_authorization (PolkitBackendAuthority *authority,
PolkitSubject *caller,
PolkitIdentity *identity,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error)
{
PolkitBackendAuthorityClass *klass;
@@ -551,11 +556,11 @@ struct _ServerClass
};
static void authority_iface_init (_PolkitAuthorityIface *authority_iface);
-static void authority_manager_iface_init (_PolkitAuthorityManagerIface *authority_manager_iface);
+static void local_authority_iface_init (_PolkitLocalAuthorityIface *local_authority_iface);
G_DEFINE_TYPE_WITH_CODE (Server, server, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (_POLKIT_TYPE_AUTHORITY, authority_iface_init)
- G_IMPLEMENT_INTERFACE (_POLKIT_TYPE_AUTHORITY_MANAGER, authority_manager_iface_init)
+ G_IMPLEMENT_INTERFACE (_POLKIT_TYPE_LOCAL_AUTHORITY, local_authority_iface_init)
);
static void
@@ -674,7 +679,7 @@ authority_handle_enumerate_actions (_PolkitAuthority *instance,
/* ---------------------------------------------------------------------------------------------------- */
static void
-authority_manager_handle_enumerate_users (_PolkitAuthorityManager *instance,
+local_authority_handle_enumerate_users (_PolkitLocalAuthority *instance,
EggDBusMethodInvocation *method_invocation)
{
Server *server = SERVER (instance);
@@ -712,7 +717,7 @@ authority_manager_handle_enumerate_users (_PolkitAuthorityManager *instance,
egg_dbus_array_seq_add (array, real);
}
- _polkit_authority_manager_handle_enumerate_users_finish (method_invocation, array);
+ _polkit_local_authority_handle_enumerate_users_finish (method_invocation, array);
g_object_unref (array);
@@ -727,7 +732,7 @@ authority_manager_handle_enumerate_users (_PolkitAuthorityManager *instance,
/* ---------------------------------------------------------------------------------------------------- */
static void
-authority_manager_handle_enumerate_groups (_PolkitAuthorityManager *instance,
+local_authority_handle_enumerate_groups (_PolkitLocalAuthority *instance,
EggDBusMethodInvocation *method_invocation)
{
Server *server = SERVER (instance);
@@ -765,7 +770,7 @@ authority_manager_handle_enumerate_groups (_PolkitAuthorityManager *instance,
egg_dbus_array_seq_add (array, real);
}
- _polkit_authority_manager_handle_enumerate_groups_finish (method_invocation, array);
+ _polkit_local_authority_handle_enumerate_groups_finish (method_invocation, array);
g_object_unref (array);
@@ -922,7 +927,7 @@ authority_handle_cancel_check_authorization (_PolkitAuthority *ins
/* ---------------------------------------------------------------------------------------------------- */
static void
-authority_manager_handle_enumerate_authorizations (_PolkitAuthorityManager *instance,
+local_authority_handle_enumerate_authorizations (_PolkitLocalAuthority *instance,
_PolkitIdentity *real_identity,
EggDBusMethodInvocation *method_invocation)
{
@@ -959,14 +964,14 @@ authority_manager_handle_enumerate_authorizations (_PolkitAuthorityManager
for (l = authorizations; l != NULL; l = l->next)
{
- PolkitAuthorization *authorization = POLKIT_AUTHORIZATION (l->data);
- _PolkitAuthorization *real;
+ PolkitLocalAuthorization *authorization = POLKIT_LOCAL_AUTHORIZATION (l->data);
+ _PolkitLocalAuthorization *real;
- real = polkit_authorization_get_real (authorization);
+ real = polkit_local_authorization_get_real (authorization);
egg_dbus_array_seq_add (array, real);
}
- _polkit_authority_manager_handle_enumerate_authorizations_finish (method_invocation, array);
+ _polkit_local_authority_handle_enumerate_authorizations_finish (method_invocation, array);
g_object_unref (array);
@@ -983,15 +988,15 @@ authority_manager_handle_enumerate_authorizations (_PolkitAuthorityManager
/* ---------------------------------------------------------------------------------------------------- */
static void
-authority_manager_handle_add_authorization (_PolkitAuthorityManager *instance,
+local_authority_handle_add_authorization (_PolkitLocalAuthority *instance,
_PolkitIdentity *real_identity,
- _PolkitAuthorization *real_authorization,
+ _PolkitLocalAuthorization *real_authorization,
EggDBusMethodInvocation *method_invocation)
{
Server *server = SERVER (instance);
PolkitSubject *caller;
PolkitIdentity *identity;
- PolkitAuthorization *authorization;
+ PolkitLocalAuthorization *authorization;
GError *error;
@@ -999,7 +1004,7 @@ authority_manager_handle_add_authorization (_PolkitAuthorityManager *inst
identity = polkit_identity_new_for_real (real_identity);
- authorization = polkit_authorization_new_for_real (real_authorization);
+ authorization = polkit_local_authorization_new_for_real (real_authorization);
error = NULL;
if (!polkit_backend_authority_add_authorization (server->authority,
@@ -1013,7 +1018,7 @@ authority_manager_handle_add_authorization (_PolkitAuthorityManager *inst
goto out;
}
- _polkit_authority_manager_handle_add_authorization_finish (method_invocation);
+ _polkit_local_authority_handle_add_authorization_finish (method_invocation);
out:
g_object_unref (authorization);
@@ -1024,15 +1029,15 @@ authority_manager_handle_add_authorization (_PolkitAuthorityManager *inst
/* ---------------------------------------------------------------------------------------------------- */
static void
-authority_manager_handle_remove_authorization (_PolkitAuthorityManager *instance,
+local_authority_handle_remove_authorization (_PolkitLocalAuthority *instance,
_PolkitIdentity *real_identity,
- _PolkitAuthorization *real_authorization,
+ _PolkitLocalAuthorization *real_authorization,
EggDBusMethodInvocation *method_invocation)
{
Server *server = SERVER (instance);
PolkitSubject *caller;
PolkitIdentity *identity;
- PolkitAuthorization *authorization;
+ PolkitLocalAuthorization *authorization;
GError *error;
@@ -1040,7 +1045,7 @@ authority_manager_handle_remove_authorization (_PolkitAuthorityManager *i
identity = polkit_identity_new_for_real (real_identity);
- authorization = polkit_authorization_new_for_real (real_authorization);
+ authorization = polkit_local_authorization_new_for_real (real_authorization);
error = NULL;
if (!polkit_backend_authority_remove_authorization (server->authority,
@@ -1054,7 +1059,7 @@ authority_manager_handle_remove_authorization (_PolkitAuthorityManager *i
goto out;
}
- _polkit_authority_manager_handle_remove_authorization_finish (method_invocation);
+ _polkit_local_authority_handle_remove_authorization_finish (method_invocation);
out:
g_object_unref (authorization);
@@ -1179,13 +1184,13 @@ authority_iface_init (_PolkitAuthorityIface *authority_iface)
}
static void
-authority_manager_iface_init (_PolkitAuthorityManagerIface *authority_manager_iface)
+local_authority_iface_init (_PolkitLocalAuthorityIface *local_authority_iface)
{
- authority_manager_iface->handle_enumerate_users = authority_manager_handle_enumerate_users;
- authority_manager_iface->handle_enumerate_groups = authority_manager_handle_enumerate_groups;
- authority_manager_iface->handle_enumerate_authorizations = authority_manager_handle_enumerate_authorizations;
- authority_manager_iface->handle_add_authorization = authority_manager_handle_add_authorization;
- authority_manager_iface->handle_remove_authorization = authority_manager_handle_remove_authorization;
+ local_authority_iface->handle_enumerate_users = local_authority_handle_enumerate_users;
+ local_authority_iface->handle_enumerate_groups = local_authority_handle_enumerate_groups;
+ local_authority_iface->handle_enumerate_authorizations = local_authority_handle_enumerate_authorizations;
+ local_authority_iface->handle_add_authorization = local_authority_handle_add_authorization;
+ local_authority_iface->handle_remove_authorization = local_authority_handle_remove_authorization;
}
static void
@@ -1270,7 +1275,7 @@ polkit_backend_register_authority (PolkitBackendAuthority *authority,
object_path,
_POLKIT_TYPE_AUTHORITY,
G_OBJECT (server),
- _POLKIT_TYPE_AUTHORITY_MANAGER,
+ _POLKIT_TYPE_LOCAL_AUTHORITY,
G_OBJECT (server),
G_TYPE_INVALID);
diff --git a/src/polkitbackend/polkitbackendauthority.h b/src/polkitbackend/polkitbackendauthority.h
index 1077aad..9afb864 100644
--- a/src/polkitbackend/polkitbackendauthority.h
+++ b/src/polkitbackend/polkitbackendauthority.h
@@ -27,6 +27,8 @@
#define __POLKIT_BACKEND_AUTHORITY_H
#include <glib-object.h>
+#include <polkitlocal/polkitlocal.h>
+
#include "polkitbackendtypes.h"
G_BEGIN_DECLS
@@ -165,17 +167,17 @@ struct _PolkitBackendAuthorityClass
PolkitIdentity *identity,
GError **error);
- gboolean (*add_authorization) (PolkitBackendAuthority *authority,
- PolkitSubject *caller,
- PolkitIdentity *identity,
- PolkitAuthorization *authorization,
- GError **error);
+ gboolean (*add_authorization) (PolkitBackendAuthority *authority,
+ PolkitSubject *caller,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GError **error);
- gboolean (*remove_authorization) (PolkitBackendAuthority *authority,
- PolkitSubject *caller,
- PolkitIdentity *identity,
- PolkitAuthorization *authorization,
- GError **error);
+ gboolean (*remove_authorization) (PolkitBackendAuthority *authority,
+ PolkitSubject *caller,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GError **error);
/* TODO: need something more efficient such that we don't watch all name changes */
void (*system_bus_name_owner_changed) (PolkitBackendAuthority *authority,
@@ -239,13 +241,13 @@ GList *polkit_backend_authority_enumerate_authorizations (PolkitBackendAuthor
gboolean polkit_backend_authority_add_authorization (PolkitBackendAuthority *authority,
PolkitSubject *caller,
PolkitIdentity *identity,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error);
gboolean polkit_backend_authority_remove_authorization (PolkitBackendAuthority *authority,
PolkitSubject *caller,
PolkitIdentity *identity,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error);
gboolean polkit_backend_authority_register_authentication_agent (PolkitBackendAuthority *authority,
diff --git a/src/polkitbackend/polkitbackendconfigsource.c b/src/polkitbackend/polkitbackendconfigsource.c
index a98936c..224d0d0 100644
--- a/src/polkitbackend/polkitbackendconfigsource.c
+++ b/src/polkitbackend/polkitbackendconfigsource.c
@@ -213,7 +213,7 @@ polkit_backend_config_source_class_init (PolkitBackendConfigSourceClass *klass)
gobject_class->get_property = polkit_backend_config_source_get_property;
gobject_class->set_property = polkit_backend_config_source_set_property;
- gobject_class->finalize = polkit_backend_config_source_constructed;
+ gobject_class->constructed = polkit_backend_config_source_constructed;
gobject_class->finalize = polkit_backend_config_source_finalize;
g_type_class_add_private (klass, sizeof (PolkitBackendConfigSourcePrivate));
diff --git a/src/polkitbackend/polkitbackendlocalauthority.c b/src/polkitbackend/polkitbackendlocalauthority.c
index 319f8d1..5c43aa5 100644
--- a/src/polkitbackend/polkitbackendlocalauthority.c
+++ b/src/polkitbackend/polkitbackendlocalauthority.c
@@ -135,12 +135,12 @@ static GList *get_authorizations_for_identity (PolkitBackendLocalAuthority *auth
static gboolean add_authorization_for_identity (PolkitBackendLocalAuthority *authority,
PolkitIdentity *identity,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error);
static gboolean remove_authorization_for_identity (PolkitBackendLocalAuthority *authority,
PolkitIdentity *identity,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error);
/* ---------------------------------------------------------------------------------------------------- */
@@ -190,17 +190,17 @@ static GList *polkit_backend_local_authority_enumerate_authorizations (PolkitBac
PolkitIdentity *identity,
GError **error);
-static gboolean polkit_backend_local_authority_add_authorization (PolkitBackendAuthority *authority,
- PolkitSubject *caller,
- PolkitIdentity *identity,
- PolkitAuthorization *authorization,
- GError **error);
+static gboolean polkit_backend_local_authority_add_authorization (PolkitBackendAuthority *authority,
+ PolkitSubject *caller,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GError **error);
-static gboolean polkit_backend_local_authority_remove_authorization (PolkitBackendAuthority *authority,
- PolkitSubject *caller,
- PolkitIdentity *identity,
- PolkitAuthorization *authorization,
- GError **error);
+static gboolean polkit_backend_local_authority_remove_authorization (PolkitBackendAuthority *authority,
+ PolkitSubject *caller,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GError **error);
static gboolean polkit_backend_local_authority_register_authentication_agent (PolkitBackendAuthority *authority,
PolkitSubject *caller,
@@ -477,11 +477,11 @@ check_authorization_challenge_cb (AuthenticationAgent *agent,
implicit_authorization == POLKIT_IMPLICIT_AUTHORIZATION_ADMINISTRATOR_AUTHENTICATION_REQUIRED_RETAINED)
{
GError *error;
- PolkitAuthorization *authorization;
+ PolkitLocalAuthorization *authorization;
- authorization = polkit_authorization_new (action_id,
- subject,
- FALSE);
+ authorization = polkit_local_authorization_new (action_id,
+ subject,
+ FALSE);
if (!add_authorization_for_identity (authority,
user_of_subject,
@@ -932,7 +932,7 @@ static gboolean
polkit_backend_local_authority_add_authorization (PolkitBackendAuthority *authority,
PolkitSubject *caller,
PolkitIdentity *identity,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error)
{
PolkitBackendLocalAuthority *local_authority;
@@ -952,9 +952,9 @@ polkit_backend_local_authority_add_authorization (PolkitBackendAuthority *auth
subject_str = NULL;
user_of_caller = NULL;
- subject = polkit_authorization_get_subject (authorization);
- action_id = polkit_authorization_get_action_id (authorization);
- is_negative = polkit_authorization_get_is_negative (authorization);
+ subject = polkit_local_authorization_get_subject (authorization);
+ action_id = polkit_local_authorization_get_action_id (authorization);
+ is_negative = polkit_local_authorization_get_is_negative (authorization);
if (subject != NULL)
subject_str = polkit_subject_to_string (subject);
@@ -1015,7 +1015,7 @@ static gboolean
polkit_backend_local_authority_remove_authorization (PolkitBackendAuthority *authority,
PolkitSubject *caller,
PolkitIdentity *identity,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error)
{
PolkitBackendLocalAuthority *local_authority;
@@ -1035,9 +1035,9 @@ polkit_backend_local_authority_remove_authorization (PolkitBackendAuthority *a
subject_str = NULL;
user_of_caller = NULL;
- subject = polkit_authorization_get_subject (authorization);
- action_id = polkit_authorization_get_action_id (authorization);
- is_negative = polkit_authorization_get_is_negative (authorization);
+ subject = polkit_local_authorization_get_subject (authorization);
+ action_id = polkit_local_authorization_get_action_id (authorization);
+ is_negative = polkit_local_authorization_get_is_negative (authorization);
if (subject != NULL)
subject_str = polkit_subject_to_string (subject);
@@ -2141,19 +2141,19 @@ struct AuthorizationStore
static AuthorizationStore *authorization_store_new (PolkitIdentity *identity);
static GList *authorization_store_get_all_authorizations (AuthorizationStore *store);
-static PolkitAuthorization *authorization_store_find_permanent_authorization (AuthorizationStore *store,
+static PolkitLocalAuthorization *authorization_store_find_permanent_authorization (AuthorizationStore *store,
const gchar *action_id);
-static PolkitAuthorization *authorization_store_find_temporary_authorization (AuthorizationStore *store,
+static PolkitLocalAuthorization *authorization_store_find_temporary_authorization (AuthorizationStore *store,
PolkitSubject *subject,
const gchar *action_id);
static gboolean authorization_store_add_authorization (AuthorizationStore *store,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error);
static gboolean authorization_store_remove_authorization (AuthorizationStore *store,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error);
/* private */
@@ -2253,7 +2253,7 @@ authorization_store_reload_permanent_authorizations (AuthorizationStore *store)
guint num_tokens;
const gchar *action_id;
gboolean is_negative;
- PolkitAuthorization *authorization;
+ PolkitLocalAuthorization *authorization;
/* skip blank lines and comments */
if (strlen (line) == 0 || line[0] == '#')
@@ -2272,7 +2272,7 @@ authorization_store_reload_permanent_authorizations (AuthorizationStore *store)
action_id = tokens[0];
is_negative = (strcmp (tokens[1], "1") == 0);
- authorization = polkit_authorization_new (action_id, NULL, is_negative);
+ authorization = polkit_local_authorization_new (action_id, NULL, is_negative);
store->authorizations = g_list_prepend (store->authorizations, authorization);
}
@@ -2321,12 +2321,12 @@ authorization_store_save_permanent_authorizations (AuthorizationStore *store,
for (l = store->authorizations; l != NULL; l = l->next)
{
- PolkitAuthorization *authorization = POLKIT_AUTHORIZATION (l->data);
+ PolkitLocalAuthorization *authorization = POLKIT_LOCAL_AUTHORIZATION (l->data);
const gchar *action_id;
gboolean is_negative;
- action_id = polkit_authorization_get_action_id (authorization);
- is_negative = polkit_authorization_get_is_negative (authorization);
+ action_id = polkit_local_authorization_get_action_id (authorization);
+ is_negative = polkit_local_authorization_get_is_negative (authorization);
g_string_append_printf (s, "%s %d\n", action_id, is_negative);
}
@@ -2363,21 +2363,21 @@ authorization_store_get_all_authorizations (AuthorizationStore *store)
return result;
}
-static PolkitAuthorization *
+static PolkitLocalAuthorization *
authorization_store_find_permanent_authorization (AuthorizationStore *store,
const gchar *action_id)
{
GList *l;
- PolkitAuthorization *ret;
+ PolkitLocalAuthorization *ret;
ret = NULL;
for (l = store->authorizations; l != NULL; l = l->next)
{
- PolkitAuthorization *authorization = POLKIT_AUTHORIZATION (l->data);
+ PolkitLocalAuthorization *authorization = POLKIT_LOCAL_AUTHORIZATION (l->data);
const gchar *authorization_action_id;
- authorization_action_id = polkit_authorization_get_action_id (authorization);
+ authorization_action_id = polkit_local_authorization_get_action_id (authorization);
if (strcmp (authorization_action_id, action_id) == 0)
{
ret = authorization;
@@ -2389,24 +2389,24 @@ authorization_store_find_permanent_authorization (AuthorizationStore *store,
return ret;
}
-static PolkitAuthorization *
+static PolkitLocalAuthorization *
authorization_store_find_temporary_authorization (AuthorizationStore *store,
PolkitSubject *subject,
const gchar *action_id)
{
GList *l;
- PolkitAuthorization *ret;
+ PolkitLocalAuthorization *ret;
ret = NULL;
for (l = store->temporary_authorizations; l != NULL; l = l->next)
{
- PolkitAuthorization *authorization = POLKIT_AUTHORIZATION (l->data);
+ PolkitLocalAuthorization *authorization = POLKIT_LOCAL_AUTHORIZATION (l->data);
const gchar *authorization_action_id;
PolkitSubject *authorization_subject;
- authorization_action_id = polkit_authorization_get_action_id (authorization);
- authorization_subject = polkit_authorization_get_subject (authorization);
+ authorization_action_id = polkit_local_authorization_get_action_id (authorization);
+ authorization_subject = polkit_local_authorization_get_subject (authorization);
if (strcmp (authorization_action_id, action_id) == 0 &&
polkit_subject_equal (authorization_subject, subject))
@@ -2422,7 +2422,7 @@ authorization_store_find_temporary_authorization (AuthorizationStore *store,
static gboolean
authorization_store_add_authorization (AuthorizationStore *store,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error)
{
gboolean ret;
@@ -2431,8 +2431,8 @@ authorization_store_add_authorization (AuthorizationStore *store,
ret = FALSE;
- action_id = polkit_authorization_get_action_id (authorization);
- subject = polkit_authorization_get_subject (authorization);
+ action_id = polkit_local_authorization_get_action_id (authorization);
+ subject = polkit_local_authorization_get_subject (authorization);
if (subject != NULL)
{
@@ -2489,18 +2489,18 @@ authorization_store_add_authorization (AuthorizationStore *store,
static gboolean
authorization_store_remove_authorization (AuthorizationStore *store,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error)
{
gboolean ret;
PolkitSubject *subject;
const gchar *action_id;
- PolkitAuthorization *target;
+ PolkitLocalAuthorization *target;
ret = FALSE;
- action_id = polkit_authorization_get_action_id (authorization);
- subject = polkit_authorization_get_subject (authorization);
+ action_id = polkit_local_authorization_get_action_id (authorization);
+ subject = polkit_local_authorization_get_subject (authorization);
if (subject != NULL)
{
@@ -2745,7 +2745,7 @@ get_authorizations_for_identity (PolkitBackendLocalAuthority *authority,
static gboolean
add_authorization_for_identity (PolkitBackendLocalAuthority *authority,
PolkitIdentity *identity,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error)
{
AuthorizationStore *store;
@@ -2777,7 +2777,7 @@ add_authorization_for_identity (PolkitBackendLocalAuthority *authority,
static gboolean
remove_authorization_for_identity (PolkitBackendLocalAuthority *authority,
PolkitIdentity *identity,
- PolkitAuthorization *authorization,
+ PolkitLocalAuthorization *authorization,
GError **error)
{
AuthorizationStore *store;
diff --git a/src/polkitbackend/polkitbackendtypes.h b/src/polkitbackend/polkitbackendtypes.h
index 54dc208..e0906df 100644
--- a/src/polkitbackend/polkitbackendtypes.h
+++ b/src/polkitbackend/polkitbackendtypes.h
@@ -27,9 +27,6 @@
struct _PolkitBackendAuthority;
typedef struct _PolkitBackendAuthority PolkitBackendAuthority;
-struct _PolkitBackendLocalAuthority;
-typedef struct _PolkitBackendLocalAuthority PolkitBackendLocalAuthority;
-
struct _PolkitBackendSessionMonitor;
typedef struct _PolkitBackendSessionMonitor PolkitBackendSessionMonitor;
@@ -39,5 +36,8 @@ typedef struct _PolkitBackendConfigSource PolkitBackendConfigSource;
struct _PolkitBackendActionLookup;
typedef struct _PolkitBackendActionLookup PolkitBackendActionLookup; /* Dummy typedef */
+struct _PolkitBackendLocalAuthority;
+typedef struct _PolkitBackendLocalAuthority PolkitBackendLocalAuthority;
+
#endif /* __POLKIT_BACKEND_TYPES_H */
diff --git a/src/polkitd/Makefile.am b/src/polkitd/Makefile.am
index c425d68..af1ca5f 100644
--- a/src/polkitd/Makefile.am
+++ b/src/polkitd/Makefile.am
@@ -22,6 +22,7 @@ polkitd_1_SOURCES = \
polkitd_1_CFLAGS = \
-DPOLKIT_BACKEND_I_KNOW_API_IS_SUBJECT_TO_CHANGE \
+ -DPOLKIT_LOCAL_I_KNOW_API_IS_SUBJECT_TO_CHANGE \
-DG_LOG_DOMAIN=\"polkitd-1\" \
$(GLIB_CFLAGS) \
$(NULL)
diff --git a/src/polkitlocal/Makefile.am b/src/polkitlocal/Makefile.am
new file mode 100644
index 0000000..eac6a24
--- /dev/null
+++ b/src/polkitlocal/Makefile.am
@@ -0,0 +1,54 @@
+NULL =
+
+INCLUDES = \
+ -I$(top_builddir)/src \
+ -I$(top_srcdir)/src \
+ -I$(top_builddir)/src/polkit \
+ -I$(top_srcdir)/src/polkit \
+ -DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \
+ -DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \
+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
+ -DPACKAGE_BIN_DIR=\""$(bindir)"\" \
+ -DPACKAGE_LOCALSTATE_DIR=\""$(localstatedir)"\" \
+ -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
+ -DPACKAGE_LIB_DIR=\""$(libdir)"\" \
+ -D_POSIX_PTHREAD_SEMANTICS \
+ -D_REENTRANT \
+ -DEGG_DBUS_I_KNOW_API_IS_SUBJECT_TO_CHANGE \
+ $(NULL)
+
+lib_LTLIBRARIES=libpolkit-local-1.la
+
+libpolkit_local_1includedir=$(includedir)/polkit-1/polkitlocal
+
+libpolkit_local_1include_HEADERS = \
+ polkitlocal.h \
+ polkitlocaltypes.h \
+ polkitlocalauthority.h \
+ polkitlocalauthorization.h \
+ $(NULL)
+
+libpolkit_local_1_la_SOURCES = \
+ polkitlocal.h \
+ polkitlocaltypes.h \
+ polkitlocalprivate.h \
+ polkitlocalauthority.c polkitlocalauthority.h \
+ polkitlocalauthorization.c polkitlocalauthorization.h \
+ $(NULL)
+
+libpolkit_local_1_la_CFLAGS = \
+ -D_POLKIT_COMPILATION \
+ -D_POLKIT_LOCAL_COMPILATION \
+ $(GLIB_CFLAGS) \
+ $(EGG_DBUS_CFLAGS) \
+ $(NULL)
+
+libpolkit_local_1_la_LIBADD = \
+ $(GLIB_LIBS) \
+ $(EGG_DBUS_LIBS) \
+ $(top_builddir)/src/polkit/libpolkit-gobject-1.la \
+ $(EXPAT_LIBS) \
+ $(NULL)
+
+clean-local :
+ rm -f *~
diff --git a/src/polkitlocal/polkitlocal.h b/src/polkitlocal/polkitlocal.h
new file mode 100644
index 0000000..e0317b7
--- /dev/null
+++ b/src/polkitlocal/polkitlocal.h
@@ -0,0 +1,35 @@
+/*
+ * 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 at redhat.com>
+ */
+
+#ifndef __POLKIT_LOCAL_H
+#define __POLKIT_LOCAL_H
+
+#if !defined (POLKIT_LOCAL_I_KNOW_API_IS_SUBJECT_TO_CHANGE) && !defined (_POLKIT_LOCAL_COMPILATION)
+#error "libpolkitlocal is unstable API and subject to change. You must define POLKIT_LOCAL_I_KNOW_API_IS_SUBJECT_TO_CHANGE to acknowledge this."
+#endif
+
+#define _POLKIT_LOCAL_INSIDE_POLKIT_LOCAL_H 1
+#include <polkitlocal/polkitlocaltypes.h>
+#include <polkitlocal/polkitlocalauthority.h>
+#include <polkitlocal/polkitlocalauthorization.h>
+#undef _POLKIT_LOCAL_INSIDE_POLKIT_LOCAL_H
+
+#endif /* __POLKIT_LOCAL_H */
diff --git a/src/polkitlocal/polkitlocalauthority.c b/src/polkitlocal/polkitlocalauthority.c
new file mode 100644
index 0000000..34605ab
--- /dev/null
+++ b/src/polkitlocal/polkitlocalauthority.c
@@ -0,0 +1,656 @@
+/*
+ * 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 at redhat.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "polkitlocalauthority.h"
+
+#include "polkitprivate.h"
+#include "polkitlocalprivate.h"
+
+/**
+ * SECTION:polkitlocalauthority
+ * @title: PolkitLocalAuthority
+ * @short_description: Manage the Local Authority
+ * @stability: Unstable
+ *
+ * Manage authorizations.
+ *
+ * To use this unstable API you need to define the symbol
+ * <literal>POLKIT_LOCAL_I_KNOW_API_IS_SUBJECT_TO_CHANGE</literal>.
+ */
+
+struct _PolkitLocalAuthority
+{
+ GObject parent_instance;
+
+ EggDBusConnection *system_bus;
+ EggDBusObjectProxy *local_authority_object_proxy;
+
+ _PolkitLocalAuthority *real;
+};
+
+struct _PolkitLocalAuthorityClass
+{
+ GObjectClass parent_class;
+
+};
+
+/* TODO: locking */
+
+static PolkitLocalAuthority *the_local_authority = NULL;
+
+G_DEFINE_TYPE (PolkitLocalAuthority, polkit_local_authority, G_TYPE_OBJECT);
+
+
+static void
+polkit_local_authority_init (PolkitLocalAuthority *local_authority)
+{
+ local_authority->system_bus = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
+
+ local_authority->local_authority_object_proxy = egg_dbus_connection_get_object_proxy (local_authority->system_bus,
+ "org.freedesktop.PolicyKit1",
+ "/org/freedesktop/PolicyKit1/Authority");
+
+ local_authority->real = _POLKIT_QUERY_INTERFACE_LOCAL_AUTHORITY (local_authority->local_authority_object_proxy);
+}
+
+static void
+polkit_local_authority_finalize (GObject *object)
+{
+ PolkitLocalAuthority *local_authority;
+
+ local_authority = POLKIT_LOCAL_AUTHORITY (object);
+
+ g_object_unref (local_authority->local_authority_object_proxy);
+ g_object_unref (local_authority->system_bus);
+
+ the_local_authority = NULL;
+
+ if (G_OBJECT_CLASS (polkit_local_authority_parent_class)->finalize != NULL)
+ G_OBJECT_CLASS (polkit_local_authority_parent_class)->finalize (object);
+}
+
+static void
+polkit_local_authority_class_init (PolkitLocalAuthorityClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->finalize = polkit_local_authority_finalize;
+
+}
+
+PolkitLocalAuthority *
+polkit_local_authority_get (void)
+{
+ if (the_local_authority != NULL)
+ goto out;
+
+ the_local_authority = POLKIT_LOCAL_AUTHORITY (g_object_new (POLKIT_TYPE_LOCAL_AUTHORITY, NULL));
+
+ out:
+ return the_local_authority;
+}
+
+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_local_authority_enumerate_users_async (PolkitLocalAuthority *local_authority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ guint call_id;
+ GSimpleAsyncResult *simple;
+
+ simple = g_simple_async_result_new (G_OBJECT (local_authority),
+ callback,
+ user_data,
+ polkit_local_authority_enumerate_users_async);
+
+ call_id = _polkit_local_authority_enumerate_users (local_authority->real,
+ EGG_DBUS_CALL_FLAGS_NONE,
+ cancellable,
+ generic_async_cb,
+ simple);
+
+ return call_id;
+}
+
+void
+polkit_local_authority_enumerate_users (PolkitLocalAuthority *local_authority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ polkit_local_authority_enumerate_users_async (local_authority, cancellable, callback, user_data);
+}
+
+GList *
+polkit_local_authority_enumerate_users_finish (PolkitLocalAuthority *local_authority,
+ 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_local_authority_enumerate_users_async);
+
+ result = NULL;
+
+ if (!_polkit_local_authority_enumerate_users_finish (local_authority->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_local_authority_enumerate_users_sync (PolkitLocalAuthority *local_authority,
+ GCancellable *cancellable,
+ GError **error)
+{
+ guint call_id;
+ GAsyncResult *res;
+ GList *result;
+
+ call_id = polkit_local_authority_enumerate_users_async (local_authority, cancellable, generic_cb, &res);
+
+ egg_dbus_connection_pending_call_block (local_authority->system_bus, call_id);
+
+ result = polkit_local_authority_enumerate_users_finish (local_authority, res, error);
+
+ g_object_unref (res);
+
+ return result;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static guint
+polkit_local_authority_enumerate_groups_async (PolkitLocalAuthority *local_authority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ guint call_id;
+ GSimpleAsyncResult *simple;
+
+ simple = g_simple_async_result_new (G_OBJECT (local_authority),
+ callback,
+ user_data,
+ polkit_local_authority_enumerate_groups_async);
+
+ call_id = _polkit_local_authority_enumerate_groups (local_authority->real,
+ EGG_DBUS_CALL_FLAGS_NONE,
+ cancellable,
+ generic_async_cb,
+ simple);
+
+ return call_id;
+}
+
+void
+polkit_local_authority_enumerate_groups (PolkitLocalAuthority *local_authority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ polkit_local_authority_enumerate_groups_async (local_authority, cancellable, callback, user_data);
+}
+
+GList *
+polkit_local_authority_enumerate_groups_finish (PolkitLocalAuthority *local_authority,
+ 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_local_authority_enumerate_groups_async);
+
+ result = NULL;
+
+ if (!_polkit_local_authority_enumerate_groups_finish (local_authority->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_local_authority_enumerate_groups_sync (PolkitLocalAuthority *local_authority,
+ GCancellable *cancellable,
+ GError **error)
+{
+ guint call_id;
+ GAsyncResult *res;
+ GList *result;
+
+ call_id = polkit_local_authority_enumerate_groups_async (local_authority, cancellable, generic_cb, &res);
+
+ egg_dbus_connection_pending_call_block (local_authority->system_bus, call_id);
+
+ result = polkit_local_authority_enumerate_groups_finish (local_authority, res, error);
+
+ g_object_unref (res);
+
+ return result;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static guint
+polkit_local_authority_enumerate_authorizations_async (PolkitLocalAuthority *local_authority,
+ 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 (local_authority),
+ callback,
+ user_data,
+ polkit_local_authority_enumerate_authorizations_async);
+
+ real_identity = polkit_identity_get_real (identity);
+
+ call_id = _polkit_local_authority_enumerate_authorizations (local_authority->real,
+ EGG_DBUS_CALL_FLAGS_NONE,
+ real_identity,
+ cancellable,
+ generic_async_cb,
+ simple);
+
+ g_object_unref (real_identity);
+
+ return call_id;
+}
+
+void
+polkit_local_authority_enumerate_authorizations (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ polkit_local_authority_enumerate_authorizations_async (local_authority,
+ identity,
+ cancellable,
+ callback,
+ user_data);
+}
+
+GList *
+polkit_local_authority_enumerate_authorizations_finish (PolkitLocalAuthority *local_authority,
+ 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_local_authority_enumerate_authorizations_async);
+
+ result = NULL;
+
+ if (!_polkit_local_authority_enumerate_authorizations_finish (local_authority->real,
+ &array_seq,
+ real_res,
+ error))
+ goto out;
+
+ for (n = 0; n < array_seq->size; n++)
+ {
+ _PolkitLocalAuthorization *real_authorization;
+
+ real_authorization = array_seq->data.v_ptr[n];
+
+ result = g_list_prepend (result, polkit_local_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_local_authority_enumerate_authorizations_sync (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ GCancellable *cancellable,
+ GError **error)
+{
+ guint call_id;
+ GAsyncResult *res;
+ GList *result;
+
+ call_id = polkit_local_authority_enumerate_authorizations_async (local_authority,
+ identity,
+ cancellable,
+ generic_cb,
+ &res);
+
+ egg_dbus_connection_pending_call_block (local_authority->system_bus, call_id);
+
+ result = polkit_local_authority_enumerate_authorizations_finish (local_authority, res, error);
+
+ g_object_unref (res);
+
+ return result;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static guint
+polkit_local_authority_add_authorization_async (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ guint call_id;
+ GSimpleAsyncResult *simple;
+ _PolkitLocalAuthorization *real_authorization;
+ _PolkitIdentity *real_identity;
+
+ simple = g_simple_async_result_new (G_OBJECT (local_authority),
+ callback,
+ user_data,
+ polkit_local_authority_add_authorization_async);
+
+ real_identity = polkit_identity_get_real (identity);
+ real_authorization = polkit_local_authorization_get_real (authorization);
+
+ call_id = _polkit_local_authority_add_authorization (local_authority->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_local_authority_add_authorization (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ polkit_local_authority_add_authorization_async (local_authority,
+ identity,
+ authorization,
+ cancellable,
+ callback,
+ user_data);
+}
+
+gboolean
+polkit_local_authority_add_authorization_finish (PolkitLocalAuthority *local_authority,
+ 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_local_authority_add_authorization_async);
+
+ ret = _polkit_local_authority_add_authorization_finish (local_authority->real,
+ real_res,
+ error);
+
+ if (!ret)
+ goto out;
+
+ out:
+ g_object_unref (real_res);
+ return ret;
+}
+
+
+gboolean
+polkit_local_authority_add_authorization_sync (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GCancellable *cancellable,
+ GError **error)
+{
+ guint call_id;
+ GAsyncResult *res;
+ gboolean ret;
+
+ call_id = polkit_local_authority_add_authorization_async (local_authority,
+ identity,
+ authorization,
+ cancellable,
+ generic_cb,
+ &res);
+
+ egg_dbus_connection_pending_call_block (local_authority->system_bus, call_id);
+
+ ret = polkit_local_authority_add_authorization_finish (local_authority, res, error);
+
+ g_object_unref (res);
+
+ return ret;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static guint
+polkit_local_authority_remove_authorization_async (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ guint call_id;
+ GSimpleAsyncResult *simple;
+ _PolkitLocalAuthorization *real_authorization;
+ _PolkitIdentity *real_identity;
+
+ simple = g_simple_async_result_new (G_OBJECT (local_authority),
+ callback,
+ user_data,
+ polkit_local_authority_remove_authorization_async);
+
+ real_identity = polkit_identity_get_real (identity);
+ real_authorization = polkit_local_authorization_get_real (authorization);
+
+ call_id = _polkit_local_authority_remove_authorization (local_authority->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_local_authority_remove_authorization (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ polkit_local_authority_remove_authorization_async (local_authority,
+ identity,
+ authorization,
+ cancellable,
+ callback,
+ user_data);
+}
+
+gboolean
+polkit_local_authority_remove_authorization_finish (PolkitLocalAuthority *local_authority,
+ 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_local_authority_remove_authorization_async);
+
+ ret = _polkit_local_authority_remove_authorization_finish (local_authority->real,
+ real_res,
+ error);
+
+ if (!ret)
+ goto out;
+
+ out:
+ g_object_unref (real_res);
+ return ret;
+}
+
+
+gboolean
+polkit_local_authority_remove_authorization_sync (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GCancellable *cancellable,
+ GError **error)
+{
+ guint call_id;
+ GAsyncResult *res;
+ gboolean ret;
+
+ call_id = polkit_local_authority_remove_authorization_async (local_authority,
+ identity,
+ authorization,
+ cancellable,
+ generic_cb,
+ &res);
+
+ egg_dbus_connection_pending_call_block (local_authority->system_bus, call_id);
+
+ ret = polkit_local_authority_remove_authorization_finish (local_authority, res, error);
+
+ g_object_unref (res);
+
+ return ret;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
diff --git a/src/polkitlocal/polkitlocalauthority.h b/src/polkitlocal/polkitlocalauthority.h
new file mode 100644
index 0000000..cc1afe5
--- /dev/null
+++ b/src/polkitlocal/polkitlocalauthority.h
@@ -0,0 +1,135 @@
+/*
+ * 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 at redhat.com>
+ */
+
+#if !defined (_POLKIT_LOCAL_COMPILATION) && !defined(_POLKIT_LOCAL_INSIDE_POLKIT_LOCAL_H)
+#error "Only <polkitlocal/polkitlocal.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef __POLKIT_LOCAL_AUTHORITY_H
+#define __POLKIT_LOCAL_AUTHORITY_H
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <polkitlocal/polkitlocaltypes.h>
+
+G_BEGIN_DECLS
+
+#define POLKIT_TYPE_LOCAL_AUTHORITY (polkit_local_authority_get_type())
+#define POLKIT_LOCAL_AUTHORITY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), POLKIT_TYPE_LOCAL_AUTHORITY, PolkitLocalAuthority))
+#define POLKIT_LOCAL_AUTHORITY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), POLKIT_TYPE_LOCAL_AUTHORITY, PolkitLocalAuthorityClass))
+#define POLKIT_LOCAL_AUTHORITY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), POLKIT_TYPE_LOCAL_AUTHORITY, PolkitLocalAuthorityClass))
+#define POLKIT_IS_LOCAL_AUTHORITY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), POLKIT_TYPE_LOCAL_AUTHORITY))
+#define POLKIT_IS_LOCAL_AUTHORITY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), POLKIT_TYPE_LOCAL_AUTHORITY))
+
+#if 0
+typedef struct _PolkitLocalAuthority PolkitLocalAuthority;
+#endif
+typedef struct _PolkitLocalAuthorityClass PolkitLocalAuthorityClass;
+
+GType polkit_local_authority_get_type (void) G_GNUC_CONST;
+
+PolkitLocalAuthority *polkit_local_authority_get (void);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+GList *polkit_local_authority_enumerate_users_sync (PolkitLocalAuthority *local_authority,
+ GCancellable *cancellable,
+ GError **error);
+
+GList *polkit_local_authority_enumerate_groups_sync (PolkitLocalAuthority *local_authority,
+ GCancellable *cancellable,
+ GError **error);
+
+GList *polkit_local_authority_enumerate_authorizations_sync (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ GCancellable *cancellable,
+ GError **error);
+
+gboolean polkit_local_authority_add_authorization_sync (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GCancellable *cancellable,
+ GError **error);
+
+gboolean polkit_local_authority_remove_authorization_sync (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GCancellable *cancellable,
+ GError **error);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+
+void polkit_local_authority_enumerate_users (PolkitLocalAuthority *local_authority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GList * polkit_local_authority_enumerate_users_finish (PolkitLocalAuthority *local_authority,
+ GAsyncResult *res,
+ GError **error);
+
+void polkit_local_authority_enumerate_groups (PolkitLocalAuthority *local_authority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GList * polkit_local_authority_enumerate_groups_finish (PolkitLocalAuthority *local_authority,
+ GAsyncResult *res,
+ GError **error);
+
+void polkit_local_authority_enumerate_authorizations (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+GList * polkit_local_authority_enumerate_authorizations_finish (PolkitLocalAuthority *local_authority,
+ GAsyncResult *res,
+ GError **error);
+
+void polkit_local_authority_add_authorization (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+gboolean polkit_local_authority_add_authorization_finish (PolkitLocalAuthority *local_authority,
+ GAsyncResult *res,
+ GError **error);
+
+void polkit_local_authority_remove_authorization (PolkitLocalAuthority *local_authority,
+ PolkitIdentity *identity,
+ PolkitLocalAuthorization *authorization,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+
+gboolean polkit_local_authority_remove_authorization_finish (PolkitLocalAuthority *local_authority,
+ GAsyncResult *res,
+ GError **error);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+G_END_DECLS
+
+#endif /* __POLKIT_LOCAL_AUTHORITY_H */
diff --git a/src/polkitlocal/polkitlocalauthorization.c b/src/polkitlocal/polkitlocalauthorization.c
new file mode 100644
index 0000000..19756dd
--- /dev/null
+++ b/src/polkitlocal/polkitlocalauthorization.c
@@ -0,0 +1,150 @@
+/*
+ * 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 at redhat.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "polkitlocalauthorization.h"
+#include "polkitprivate.h"
+#include "polkitlocalprivate.h"
+
+/**
+ * SECTION:polkitlocalauthorization
+ * @title: PolkitLocalAuthorization
+ * @short_description: Local Authorization
+ * @stability: Unstable
+ *
+ * Instances of this class represents authorizations for the local authority backend.
+ *
+ * To use this unstable API you need to define the symbol
+ * <literal>POLKIT_LOCAL_I_KNOW_API_IS_SUBJECT_TO_CHANGE</literal>.
+ */
+
+struct _PolkitLocalAuthorization
+{
+ GObject parent_instance;
+
+ _PolkitLocalAuthorization *real;
+
+ PolkitSubject *subject;
+};
+
+struct _PolkitLocalAuthorizationClass
+{
+ GObjectClass parent_class;
+
+};
+
+G_DEFINE_TYPE (PolkitLocalAuthorization, polkit_local_authorization, G_TYPE_OBJECT);
+
+static void
+polkit_local_authorization_init (PolkitLocalAuthorization *local_authorization)
+{
+}
+
+static void
+polkit_local_authorization_finalize (GObject *object)
+{
+ PolkitLocalAuthorization *local_authorization;
+
+ local_authorization = POLKIT_LOCAL_AUTHORIZATION (object);
+
+ if (local_authorization->subject != NULL)
+ g_object_unref (local_authorization->subject);
+
+ g_object_unref (local_authorization->real);
+
+ if (G_OBJECT_CLASS (polkit_local_authorization_parent_class)->finalize != NULL)
+ G_OBJECT_CLASS (polkit_local_authorization_parent_class)->finalize (object);
+}
+
+static void
+polkit_local_authorization_class_init (PolkitLocalAuthorizationClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->finalize = polkit_local_authorization_finalize;
+}
+
+PolkitLocalAuthorization *
+polkit_local_authorization_new (const gchar *action_id,
+ PolkitSubject *subject,
+ gboolean is_negative)
+{
+ PolkitLocalAuthorization *local_authorization;
+ _PolkitLocalAuthorization *real;
+ _PolkitSubject *real_subject;
+
+ real_subject = polkit_subject_get_real (subject);
+
+ real = _polkit_local_authorization_new (action_id, real_subject, is_negative);
+
+ g_object_unref (real_subject);
+
+ local_authorization = polkit_local_authorization_new_for_real (real);
+
+ g_object_unref (real);
+
+ return local_authorization;
+}
+
+PolkitLocalAuthorization *
+polkit_local_authorization_new_for_real (_PolkitLocalAuthorization *real)
+{
+ PolkitLocalAuthorization *local_authorization;
+
+ local_authorization = POLKIT_LOCAL_AUTHORIZATION (g_object_new (POLKIT_TYPE_LOCAL_AUTHORIZATION, NULL));
+
+ local_authorization->real = g_object_ref (real);
+
+ return local_authorization;
+}
+
+_PolkitLocalAuthorization *
+polkit_local_authorization_get_real (PolkitLocalAuthorization *local_authorization)
+{
+ return g_object_ref (local_authorization->real);
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+const gchar *
+polkit_local_authorization_get_action_id (PolkitLocalAuthorization *local_authorization)
+{
+ return _polkit_local_authorization_get_action_id (local_authorization->real);
+}
+
+
+PolkitSubject *
+polkit_local_authorization_get_subject (PolkitLocalAuthorization *local_authorization)
+{
+ if (local_authorization->subject == NULL)
+ local_authorization->subject = polkit_subject_new_for_real (_polkit_local_authorization_get_subject (local_authorization->real));
+
+ return local_authorization->subject;
+}
+
+gboolean
+polkit_local_authorization_get_is_negative (PolkitLocalAuthorization *local_authorization)
+{
+ return _polkit_local_authorization_get_is_negative (local_authorization->real);
+}
diff --git a/src/polkitlocal/polkitlocalauthorization.h b/src/polkitlocal/polkitlocalauthorization.h
new file mode 100644
index 0000000..e23c1b7
--- /dev/null
+++ b/src/polkitlocal/polkitlocalauthorization.h
@@ -0,0 +1,65 @@
+/*
+ * 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 at redhat.com>
+ */
+
+#if !defined (_POLKIT_LOCAL_COMPILATION) && !defined(_POLKIT_LOCAL_INSIDE_POLKIT_LOCAL_H)
+#error "Only <polkitlocal/polkitlocal.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#ifndef __POLKIT_LOCAL_AUTHORIZATION_H
+#define __POLKIT_LOCAL_AUTHORIZATION_H
+
+#include <glib-object.h>
+#include <gio/gio.h>
+#include <polkitlocal/polkitlocaltypes.h>
+
+#if defined (POLKIT_I_KNOW_AUTHORITY_MANAGER_API_IS_SUBJECT_TO_CHANGE) || defined (_POLKIT_COMPILATION)
+
+G_BEGIN_DECLS
+
+#define POLKIT_TYPE_LOCAL_AUTHORIZATION (polkit_local_authorization_get_type())
+#define POLKIT_LOCAL_AUTHORIZATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), POLKIT_TYPE_LOCAL_AUTHORIZATION, PolkitLocalAuthorization))
+#define POLKIT_LOCAL_AUTHORIZATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), POLKIT_TYPE_LOCAL_AUTHORIZATION, PolkitLocalAuthorizationClass))
+#define POLKIT_LOCAL_AUTHORIZATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), POLKIT_TYPE_LOCAL_AUTHORIZATION, PolkitLocalAuthorizationClass))
+#define POLKIT_IS_LOCAL_AUTHORIZATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), POLKIT_TYPE_LOCAL_AUTHORIZATION))
+#define POLKIT_IS_LOCAL_AUTHORIZATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), POLKIT_TYPE_LOCAL_AUTHORIZATION))
+
+#if 0
+typedef struct _PolkitLocalAuthorization PolkitLocalAuthorization;
+#endif
+typedef struct _PolkitLocalAuthorizationClass PolkitLocalAuthorizationClass;
+
+GType polkit_local_authorization_get_type (void) G_GNUC_CONST;
+
+PolkitLocalAuthorization *polkit_local_authorization_new (const gchar *action_id,
+ PolkitSubject *subject,
+ gboolean is_negative);
+
+const gchar *polkit_local_authorization_get_action_id (PolkitLocalAuthorization *local_authorization);
+
+PolkitSubject *polkit_local_authorization_get_subject (PolkitLocalAuthorization *local_authorization);
+
+gboolean polkit_local_authorization_get_is_negative (PolkitLocalAuthorization *local_authorization);
+
+G_END_DECLS
+
+#endif /* API hiding */
+
+#endif /* __POLKIT_LOCAL_AUTHORIZATION_H */
diff --git a/src/polkitlocal/polkitlocalprivate.h b/src/polkitlocal/polkitlocalprivate.h
new file mode 100644
index 0000000..bf41900
--- /dev/null
+++ b/src/polkitlocal/polkitlocalprivate.h
@@ -0,0 +1,37 @@
+/*
+ * 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 at redhat.com>
+ */
+
+#ifndef __POLKIT_LOCAL_PRIVATE_H
+#define __POLKIT_LOCAL_PRIVATE_H
+
+#include "_polkitbindings.h"
+
+/* notes:
+ *
+ * - the _new_for_real() functions will ref the passed arg (you will still own the ref)
+ * - the _get_real() functions will return a ref (you will own the ref)
+ *
+ */
+
+PolkitLocalAuthorization *polkit_local_authorization_new_for_real (_PolkitLocalAuthorization *real);
+_PolkitLocalAuthorization *polkit_local_authorization_get_real (PolkitLocalAuthorization *authorization);
+
+#endif /* __POLKIT_LOCAL_PRIVATE_H */
diff --git a/src/polkitlocal/polkitlocaltypes.h b/src/polkitlocal/polkitlocaltypes.h
new file mode 100644
index 0000000..803370a
--- /dev/null
+++ b/src/polkitlocal/polkitlocaltypes.h
@@ -0,0 +1,41 @@
+/*
+ * 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 at redhat.com>
+ */
+
+#if !defined(_POLKIT_LOCAL_INSIDE_POLKIT_LOCAL_H) && !defined (_POLKIT_LOCAL_COMPILATION)
+#error "Only <polkitlocal/polkitlocal.h> can be included directly, this file may disappear or change contents"
+#endif
+
+#ifndef __POLKIT_LOCAL_TYPES_H
+#define __POLKIT_LOCAL_TYPES_H
+
+#include <polkit/polkit.h>
+
+G_BEGIN_DECLS
+
+struct _PolkitLocalAuthority;
+typedef struct _PolkitLocalAuthority PolkitLocalAuthority;
+
+struct _PolkitLocalAuthorization;
+typedef struct _PolkitLocalAuthorization PolkitLocalAuthorization;
+
+G_END_DECLS
+
+#endif /* __POLKIT_LOCAL_TYPES_H */
diff --git a/src/programs/Makefile.am b/src/programs/Makefile.am
index 074fb39..79e9161 100644
--- a/src/programs/Makefile.am
+++ b/src/programs/Makefile.am
@@ -41,6 +41,7 @@ libpkexec_action_lookup_la_SOURCES = \
libpkexec_action_lookup_la_CFLAGS = \
-DPOLKIT_BACKEND_I_KNOW_API_IS_SUBJECT_TO_CHANGE \
+ -DPOLKIT_LOCAL_I_KNOW_API_IS_SUBJECT_TO_CHANGE \
-DG_LOG_DOMAIN=\"pkexec-action-lookup\" \
$(GLIB_CFLAGS) \
$(NULL)
More information about the hal-commit
mailing list