#define PRIVILEGE_APP_LAUNCH "http://tizen.org/privilege/appmanager.launch"
#define PRIVILEGE_APP_KILL "http://tizen.org/privilege/appmanager.kill"
+extern std::string KRATE_ID_PREFIX;
+
namespace Krate {
namespace {
AppInfo appInfo;
try {
- runtime::User user(name);
+ runtime::User user(KRATE_ID_PREFIX + name);
ApplicationInfo appinfo(appid, user.getUid());
char* locale;
int iteratorId = -1;
try {
PackageManager& packman = PackageManager::instance();
- runtime::User user(name);
+ runtime::User user(KRATE_ID_PREFIX + name);
IteratorData data;
iteratorId = newIteratorId;
int AppProxy::launch(const std::string& name, const AppProxy::Bundle& bundle)
{
try {
- runtime::User user(name);
+ runtime::User user(KRATE_ID_PREFIX + name);
::Bundle b;
if (!bundle.operation.empty()) {
int AppProxy::resume(const std::string& name, const std::string& appid)
{
try {
- runtime::User user(name);
+ runtime::User user(KRATE_ID_PREFIX + name);
Launchpad launchpad(user.getUid());
launchpad.resume(appid);
} catch (runtime::Exception& e) {
int AppProxy::terminate(const std::string& name, const std::string& appid)
{
try {
- runtime::User user(name);
+ runtime::User user(KRATE_ID_PREFIX + name);
Launchpad launchpad(user.getUid());
launchpad.terminate(appid);
} catch (runtime::Exception& e) {
bool AppProxy::isRunning(const std::string& name, const std::string& appid)
{
try {
- runtime::User user(name);
+ runtime::User user(KRATE_ID_PREFIX + name);
Launchpad launchpad(user.getUid());
return launchpad.isRunning(appid);
} catch (runtime::Exception& e) {
#define DEFAULT_ICON_PATH ICON_PATH "/default_icon.png"
#define NOTIFICATION_SUB_ICON_PATH ICON_PATH "/notification_sub_icon.png"
+extern std::string KRATE_ID_PREFIX;
+
namespace Krate {
namespace {
const std::string KRATE_REMOVE_HOOK_PATH = "/etc/gumd/userdel.d";
std::string KRATE_DEFAULT_OWNER;
-std::string KRATE_ID_PREFIX;
std::list<std::string> createdKrateList;
static std::atomic<bool> isKrateForeground(false);
void notiProxyCallback(void *data, notification_type_e type, notification_op *op_list, int num_op)
{
static runtime::User owner(KRATE_DEFAULT_OWNER);
- runtime::User user(*reinterpret_cast<std::string*>(data));
+ runtime::User user(KRATE_ID_PREFIX + *reinterpret_cast<std::string*>(data));
if (user.getName() == owner.getName()) {
// TODO : should remove noti in the krate when related-krate is removed
runtime::Cgroup::create(CGROUP_SUBSYSTEM, CGROUP_SUBSYSTEM);
KRATE_DEFAULT_OWNER = ::tzplatform_getenv(TZ_SYS_DEFAULT_USER);
- KRATE_ID_PREFIX = gum_user_type_to_prefix(GUM_USERTYPE_SECURITY);
PackageManager& packageManager = PackageManager::instance();
packageManager.setEventCallback(packageEventHandler, this);
for (int i = 0; i < GUMD_RETRY_COUNT && guser == NULL; i++) {
guser = gum_user_create_sync(FALSE);
}
- g_object_set(G_OBJECT(guser), "username", name.c_str(),
+ g_object_set(G_OBJECT(guser), "username",
+ (KRATE_ID_PREFIX + name).c_str(),
"usertype", GUM_USERTYPE_SECURITY, NULL);
ret = gum_user_add_sync(guser);
g_object_unref(guser);
}
if (!ret) {
- throw runtime::Exception("Failed to remove user (" + name + ") by gumd");
+ throw runtime::Exception("Failed to create user (" + name + ") by gumd");
}
- runtime::User user(name + KRATE_ID_PREFIX);
+ runtime::User user(KRATE_ID_PREFIX + name);
maskUserServices(user);
auto it = createdKrateList.insert(createdKrateList.end(), name);
notification_register_detailed_changed_cb_for_uid(notiProxyCallback, &(*it), user.getUid());
+
context.notify("Manager::created", name, "");
} catch (runtime::Exception& e) {
ERROR(e.what());
runtime::User user(KRATE_ID_PREFIX + name);
try {
dbus::Connection& systemDBus = dbus::Connection::getSystem();
- const dbus::Variant& var = systemDBus.methodcall
- ("org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- "GetUser",
- -1, "(o)", "(u)", user.getUid());
+ systemDBus.methodcall("org.freedesktop.login1",
+ "/org/freedesktop/login1",
+ "org.freedesktop.login1.Manager",
+ "GetUser",
+ -1, "(o)", "(u)", user.getUid());
return Manager::State::Running;
} catch (runtime::Exception& e) {
return Manager::State::Locked;
#define PRIVLEGE_PACKAGE_ADMIN "http://tizen.org/privilege/packagemanager.admin"
+extern std::string KRATE_ID_PREFIX;
+
namespace Krate {
PackageProxy::PackageProxy(KrateControlContext& ctx) :
free(locale);
try {
- runtime::User user(name);
+ runtime::User user(KRATE_ID_PREFIX + name);
::PackageInfo pkginfo(pkgid, user.getUid());
package.type = pkginfo.getType();
std::vector<std::string> PackageProxy::getPackageList(const std::string& name)
{
try {
- runtime::User user(name);
+ runtime::User user(KRATE_ID_PREFIX + name);
PackageManager& packman = PackageManager::instance();
return packman.getPackageList(user.getUid());
} catch (runtime::Exception& e) {
int PackageProxy::install(const std::string& name, const std::string& pkgpath)
{
try {
- runtime::User user(name);
+ runtime::User user(KRATE_ID_PREFIX + name);
PackageManager& packman = PackageManager::instance();
packman.installPackage(pkgpath, user.getUid());
} catch (runtime::Exception& e) {
int PackageProxy::uninstall(const std::string& name, const std::string& pkgid)
{
try {
- runtime::User user(name);
+ runtime::User user(KRATE_ID_PREFIX + name);
PackageManager& packman = PackageManager::instance();
packman.uninstallPackage(pkgid, user.getUid());
} catch (runtime::Exception& e) {
#include <cynara-client.h>
#include <cynara-session.h>
+#include <gum/common/gum-user-types.h>
+
#include "server.h"
#include "rmi/manager.h"
using namespace std::placeholders;
+std::string KRATE_ID_PREFIX;
+
namespace {
const std::string KRATE_MANAGER_ADDRESS = "/tmp/.krate.sock";
manager.reset(new Krate::Manager(*this));
appProxy.reset(new Krate::AppProxy(*this));
packageProxy.reset(new Krate::PackageProxy(*this));
+
+ KRATE_ID_PREFIX = gum_user_type_to_prefix(GUM_USERTYPE_SECURITY);
}
Server::~Server()