endif()
SET(COMPILE_BASE_FLAGS "-g -fPIC -Werror -Wall -Wl,--as-needed -Wl,--no-whole-archive")
+
+IF(KRATE_SUPPORTED)
+ SET(COMPILE_BASE_FLAGS "${COMPILE_BASE_FLAGS} -DKRATE_SUPPORTED")
+ENDIF(KRATE_SUPPORTED)
+
SET(CMAKE_C_FLAGS_PROFILING "${COMPILE_BASE_FLAGS} -O0 -pg")
SET(CMAKE_CXX_FLAGS_PROFILING "${COMPILE_BASE_FLAGS} -O0 -pg -std=${CXX_STD} -fno-rtti")
SET(CMAKE_C_FLAGS_DEBUG "${COMPILE_BASE_FLAGS} -O0 -ggdb")
BuildRequires: gettext-tools
BuildRequires: pkgconfig(klay)
BuildRequires: pkgconfig(dpm-pil)
-BuildRequires: pkgconfig(krate)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(capi-base-common)
+#BuildRequires: pkgconfig(krate)
%description
The dpm-zone package provides zone policy module for device policy manager
%cmake . -DVERSION=%{version} \
-DCMAKE_BUILD_TYPE=%{build_type} \
- -DPLUGIN_INSTALL_DIR=%{_libdir}/dpm/plugins \
+ -DPLUGIN_INSTALL_DIR=%{_libdir}/dpm/plugins \
-DSCRIPT_INSTALL_DIR=%{_scriptdir} \
-DSYSTEMD_UNIT_INSTALL_DIR=%{_unitdir} \
-DDATA_INSTALL_DIR=%{TZ_SYS_DATA}/dpm \
-DRUN_INSTALL_DIR=%{TZ_SYS_RUN} \
-DAPP_INSTALL_PREFIX="%{TZ_SYS_RO_APP}" \
-DAPP_SHARE_PACKAGES_DIR="%{TZ_SYS_RO_PACKAGES}" \
+ -DKRATE_SUPPORTED=1
make %{?jobs:-j%jobs}
* See the License for the specific language governing permissions and
* limitations under the License
*/
-
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/inotify.h>
#include <tzplatform_config.h>
#include <klay/auth/user.h>
-#include <krate/krate.h>
#include <dpm/pil/policy-context.h>
#include <dpm/pil/policy-model.h>
#include <dpm/pil/policy-storage.h>
+
+#ifndef KRATE_SUPPORTED
#include <dpm/pil/app-bundle.h>
#include <dpm/pil/launchpad.h>
+#include <krate/krate.h>
+
#define NAME_PATTERN "^[A-Za-z_][A-Za-z0-9_.-]*"
namespace {
}
} // namespace
-
+#endif
class Zone : public AbstractPolicyProvider {
public:
int Zone::create(const std::string& name, const std::string& setupWizAppid)
{
+#ifndef KRATE_SUPPORTED
if (!isAllowedName(name)) {
- return -1;
+ return TIZEN_ERROR_NOT_PERMITTED;
}
try {
}
return 0;
+#else
+ return TIZEN_ERROR_NOT_PERMITTED;
+#endif
}
int Zone::remove(const std::string& name)
{
if (getState(name) == 0) {
- return -1;
+ return TIZEN_ERROR_NOT_PERMITTED;
}
+#ifndef KRATE_SUPPORTED
try {
Bundle bundle;
bundle.add("id", "krate-remove");
}
return 0;
+#else
+ return TIZEN_ERROR_NOT_PERMITTED;
+#endif
}
int Zone::getState(const std::string& name)
{
+#ifndef KRATE_SUPPORTED
krate_state_e state = (krate_state_e)0;
krate_manager_h krate_manager;
krate_manager_create(&krate_manager);
krate_manager_get_krate_state(krate_manager, name.c_str(), &state);
krate_manager_destroy(krate_manager);
+#else
+ int state = 0;
+#endif
return (int)state;
}
std::vector<std::string> Zone::enumerate(int state)
{
std::vector<std::string> list;
+#ifndef KRATE_SUPPORTED
krate_manager_h krate_manager;
krate_manager_create(&krate_manager);
krate_manager_foreach_name(krate_manager, (krate_state_e)state, foreachKrateCallback, &list);
krate_manager_destroy(krate_manager);
+#endif
return list;
}