From df3da5bf5de19a566c51e0049351e62914b66d41 Mon Sep 17 00:00:00 2001 From: =?utf8?q?K=C3=A9vin=20THIERRY?= Date: Mon, 20 Jan 2014 14:27:38 +0100 Subject: [PATCH] Add multi-user support MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Bug-Tizen: PTREL-364 Change-Id: Iadd1676192d3235f9f5f9bc37ba215ef35bbf84c Signed-off-by: Kévin THIERRY --- CMakeLists.txt | 2 +- packaging/syspopup.spec | 45 +++++++++++++++++++++--------------------- src/syspopup_core.c | 8 +++++++- src/syspopup_db.c | 6 +++++- syspopup-app/CMakeLists.txt | 2 +- syspopup-caller/CMakeLists.txt | 2 +- syspopup/CMakeLists.txt | 2 +- 7 files changed, 39 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3ebbad..ac9e968 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ IF (with_wayland) ADD_DEFINITIONS("-DWAYLAND") ENDIF(with_wayland) -pkg_check_modules(libpkgs REQUIRED aul dlog bundle sqlite3 glib-2.0 dbus-glib-1) +pkg_check_modules(libpkgs REQUIRED aul dlog bundle sqlite3 glib-2.0 dbus-glib-1 libtzplatform-config) FOREACH(flag ${libpkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/packaging/syspopup.spec b/packaging/syspopup.spec index 024ac68..8486b0f 100755 --- a/packaging/syspopup.spec +++ b/packaging/syspopup.spec @@ -1,17 +1,17 @@ %bcond_with x %bcond_with wayland -Name: syspopup -Summary: syspopup package -Version: 0.0.92 -Release: 1 -Group: System/Libraries -License: Apache-2.0 -Source0: syspopup-%{version}.tar.gz -Source1001: %{name}.manifest -Source1002: %{name}-devel.manifest -Source1003: %{name}-caller.manifest -Source1004: %{name}-caller-devel.manifest +Name: syspopup +Summary: Syspopup package +Version: 0.0.92 +Release: 0 +Group: System/Libraries +License: Apache-2.0 +Source0: syspopup-%{version}.tar.gz +Source1001: %{name}.manifest +Source1002: %{name}-devel.manifest +Source1003: %{name}-caller.manifest +Source1004: %{name}-caller-devel.manifest BuildRequires: cmake BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(bundle) @@ -25,13 +25,14 @@ BuildRequires: pkgconfig(ecore-x) BuildRequires: pkgconfig(aul) BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(appcore-efl) +BuildRequires: pkgconfig(libtzplatform-config) %description syspopup package for popup %package devel -Summary: syspopup development package +Summary: Syspopup development package Group: System/Libraries Requires: %{name} = %{version}-%{release} @@ -39,17 +40,17 @@ Requires: %{name} = %{version}-%{release} syspopup development package popup %package caller -Summary: syspopup-caller package -Group: System/Libraries -Requires: %{name} = %{version}-%{release} -Requires(post): /sbin/ldconfig +Summary: Syspopup-caller package +Group: System/Libraries +Requires: %{name} = %{version}-%{release} +Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig %description caller syspopup-caller package for popup %package caller-devel -Summary: syspopup-caller development package +Summary: Syspopup-caller development package Group: System/Development Requires: %{name} = %{version}-%{release} @@ -73,8 +74,8 @@ make %{?jobs:-j%jobs} %install %make_install -mkdir -p %{buildroot}/opt/dbspace -sqlite3 %{buildroot}/opt/dbspace/.syspopup.db < %{buildroot}/usr/share/syspopup/syspopup_db.sql +mkdir -p %{buildroot}%{TZ_SYS_DB} +sqlite3 %{buildroot}%{TZ_SYS_DB}/.syspopup.db < %{buildroot}/usr/share/syspopup/syspopup_db.sql rm -rf %{buildroot}/usr/share/syspopup/syspopup_db.sql touch %{buildroot}%{_datadir}/popup_noti_term @@ -94,11 +95,11 @@ touch %{buildroot}%{_datadir}/popup_noti_term %{_bindir}/sp_test %{_bindir}/syspopup-app %{_libdir}/libsyspopup.so.0.1.0 -/usr/share/packages/org.tizen.syspopup-app.xml +%TZ_SYS_RO_PACKAGES/org.tizen.syspopup-app.xml %{_datadir}/popup_noti_term -%attr(644,root,app) /opt/dbspace/.syspopup.db -%attr(644,root,app) /opt/dbspace/.syspopup.db-journal +%attr(644,root,%{TZ_SYS_USER_GROUP}) %{TZ_SYS_DB}/.syspopup.db +%attr(644,root,%{TZ_SYS_USER_GROUP}) %{TZ_SYS_DB}/.syspopup.db-journal %files devel diff --git a/src/syspopup_core.c b/src/syspopup_core.c index dc76dca..d8cced4 100755 --- a/src/syspopup_core.c +++ b/src/syspopup_core.c @@ -26,6 +26,12 @@ #include #include #include +#include +#include + +/* For multi-user support */ +#include + #include "syspopup_core.h" #include "simple_util.h" @@ -237,7 +243,7 @@ const char *_syspopup_get_name_from_bundle(bundle *b) { const char *name; - if (getuid() != 0 && getuid() != 5000) { + if (getuid() != 0 && getuid() != tzplatform_getuid(TZ_USER_NAME)) { _E("syspopup permission error"); return NULL; } diff --git a/src/syspopup_db.c b/src/syspopup_db.c index 9721b4a..a53ffba 100755 --- a/src/syspopup_db.c +++ b/src/syspopup_db.c @@ -25,10 +25,14 @@ #include #include #include + +/* For multi-user support */ +#include + #include "syspopup_db.h" #include "simple_util.h" -#define SYSPOPUP_DB_PATH "/opt/dbspace/.syspopup.db" +#define SYSPOPUP_DB_PATH tzplatform_mkpath(TZ_SYS_DB, ".syspopup.db") #define QUERY_MAXLEN 4096 #define SP_INFO_TBL "syspopup_info" diff --git a/syspopup-app/CMakeLists.txt b/syspopup-app/CMakeLists.txt index 821aeaa..384b730 100644 --- a/syspopup-app/CMakeLists.txt +++ b/syspopup-app/CMakeLists.txt @@ -22,7 +22,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/syspopup) INCLUDE(FindPkgConfig) -pkg_check_modules(syspopup_app_pkgs REQUIRED appcore-efl) +pkg_check_modules(syspopup_app_pkgs REQUIRED appcore-efl libtzplatform-config) FOREACH(flag ${syspopup_app_pkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/syspopup-caller/CMakeLists.txt b/syspopup-caller/CMakeLists.txt index 2fcc6ce..143fbf3 100644 --- a/syspopup-caller/CMakeLists.txt +++ b/syspopup-caller/CMakeLists.txt @@ -20,7 +20,7 @@ MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") # Set required packages INCLUDE(FindPkgConfig) -pkg_check_modules(spcpkgs REQUIRED dlog bundle sqlite3 glib-2.0 aul dbus-glib-1) +pkg_check_modules(spcpkgs REQUIRED dlog bundle sqlite3 glib-2.0 aul dbus-glib-1 libtzplatform-config) FOREACH(flag ${spcpkgs_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/syspopup/CMakeLists.txt b/syspopup/CMakeLists.txt index 615b884..0d7d4fc 100644 --- a/syspopup/CMakeLists.txt +++ b/syspopup/CMakeLists.txt @@ -19,7 +19,7 @@ MESSAGE("Build type: ${CMAKE_BUILD_TYPE}") # Set required packages INCLUDE(FindPkgConfig) -SET(APPSVC_SPPPGS_CHECK_MODULES "dlog bundle sqlite3 glib-2.0 evas elementary ecore ecore-input dbus-glib-1") +SET(APPSVC_SPPPGS_CHECK_MODULES "dlog bundle sqlite3 glib-2.0 evas elementary ecore ecore-input dbus-glib-1 libtzplatform-config") IF (with_wayland) pkg_check_modules(sppkgs REQUIRED ${APPSVC_SPPPGS_CHECK_MODULES}) -- 2.7.4