%if %{with_systemd_daemon}
BuildRequires: pkgconfig(libsystemd)
%endif
-BuildRequires: pkgconfig(security-manager)
BuildRequires: pkgconfig(security-privilege-manager)
BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(pkgmgr-info)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(capi-ui-efl-util)
BuildRequires: pkgconfig(capi-system-info)
cynara-agent
cynara-plugin
libsystemd
+ security-manager
+ pkgmgr-info
)
SET(ASKUSER_AGENT_PATH ${ASKUSER_PATH}/agent)
${ASKUSER_AGENT_PATH}/main/CynaraTalker.cpp
${ASKUSER_AGENT_PATH}/main/main.cpp
${ASKUSER_AGENT_PATH}/main/PolicyUpdater.cpp
+ ${ASKUSER_AGENT_PATH}/main/Policy.cpp
${ASKUSER_AGENT_PATH}/ui/NotificationBackend.cpp
${ASKUSER_AGENT_PATH}/ui/FdNotifyObject.cpp
)
/*
- * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <utility>
#include <attributes/attributes.h>
-#include <policy/Policy.h>
#include <translator/Translator.h>
#include <types/AgentErrorMsg.h>
#include <types/SupportedTypes.h>
#include <log/alog.h>
#include "Agent.h"
+#include "Policy.h"
namespace AskUser {
auto handler = [&](RequestId requestId, UIResponseType resultType) -> void {
UIResponseHandler(requestId, resultType);
};
- bool ret = ui->start(data.client, data.user, data.privilege, request->id(), handler);
+
+ std::string appId, pkgLabel;
+ identifyApp(data.client, data.user, appId, pkgLabel);
+
+ bool ret = ui->start(data.client, pkgLabel, data.user, data.privilege, request->id(), handler);
if (ret) {
m_UIs.insert(std::make_pair(request->id(), std::move(ui)));
}
/*
- * Copyright (c) 2016 Samsung Electronics Co.
+ * Copyright (c) 2016-2017 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License
*/
/**
- * @file src/agent/notification-daemon/Policy.cpp
+ * @file src/agent/main/Policy.cpp
* @author Zofia Abramowska <z.abramowska@samsung.com>
* @brief Implementation of Policy wrappers
*/
/*
- * Copyright (c) 2016 Samsung Electronics Co.
+ * Copyright (c) 2016-2017 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* limitations under the License
*/
/**
- * @file src/agent/notification-daemon/Policy.h
+ * @file src/agent/main/Policy.h
* @author Zofia Abramowska <z.abramowska@samsung.com>
* @brief Definition of Policy wrappers
*/
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <exception/Exception.h>
#include <log/alog.h>
-#include <policy/Policy.h>
+
#include <policy/PrivilegeInfo.h>
+#include "Policy.h"
#include "PolicyUpdater.h"
namespace AskUser {
/*
- * Copyright (c) 2016 Samsung Electronics Co.
+ * Copyright (c) 2016-2017 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <string>
#include <sys/signalfd.h>
-#include <policy/Policy.h>
#include <policy/PrivilegeInfo.h>
#include <socket/Socket.h>
#include <socket/Poll.h>
}
request = Translator::Gui::dataToNotificationRequest(requestData);
- ALOGD("Recieved data " << request.data.client << " " << request.data.privilege);
+ ALOGD("Recieved data, client: " << request.data.client <<
+ " privilege: " << request.data.privilege);
return true;
}
NotificationResponse response;
m_gui.setLocale();
- response.response = m_gui.popupRun(request.data.client,
+ response.response = m_gui.popupRun(request.pkgLabel,
PrivilegeInfo::getPrivacyDisplayName(request.data.privilege));
m_gui.delDismissFd(m_currentPeerSocket.getFd());
glib-2.0
capi-ui-efl-util
capi-system-info
- security-manager
security-privilege-manager
- pkgmgr-info
)
INCLUDE_DIRECTORIES(SYSTEM
${ASKUSER_PATH}/common/socket/Socket.cpp
${ASKUSER_PATH}/common/socket/Poll.cpp
${ASKUSER_PATH}/common/translator/Translator.cpp
- ${ASKUSER_PATH}/common/policy/Policy.cpp
${ASKUSER_PATH}/common/policy/PrivilegeInfo.cpp
${ASKUSER_PATH}/common/config/Limits.cpp
${ASKUSER_PATH}/common/types/AgentErrorMsg.cpp
/*
- * Copyright (c) 2016 Samsung Electronics Co.
+ * Copyright (c) 2016-2017 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <exception/ErrnoException.h>
#include <exception/Exception.h>
-#include <policy/Policy.h>
#include <translator/Translator.h>
#include <libintl.h>
#include <vconf.h>
ALOGE("language_set failed.");
}
-NResponseType GuiRunner::popupRun(const std::string &app, const std::string &perm)
+NResponseType GuiRunner::popupRun(const std::string &pkgLabel, const std::string &perm)
{
try {
setLocale();
m_running = true;
m_hwKeyClicked = false;
- std::string appId;
- std::string pkgLabel;
- identifyApp(app, std::to_string(getuid()), appId, pkgLabel);
-
// create message
char *messageFormat = dgettext(PROJECT_NAME, "IDS_IDLE_POP_ALLOW_P1SS_TO_ACCESS_YOUR_P2SS_Q");
char buf[BUFSIZ];
/*
- * Copyright (c) 2016 Samsung Electronics Co.
+ * Copyright (c) 2016-2017 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void delDismissFd(int fd);
~GuiRunner();
- NResponseType popupRun(const std::string &app, const std::string &perm);
+ NResponseType popupRun(const std::string &pkgLabel, const std::string &perm);
void stop();
std::string getErrorMsg() { return m_errorMsg; }
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015-2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public:
virtual ~AskUIInterface() {};
- virtual bool start(const std::string &client, const std::string &user,
- const std::string &privilege, RequestId requestId, UIResponseCallback) = 0;
+ virtual bool start(const std::string &client, const std::string &pkgLabel,
+ const std::string &user, const std::string &privilege,
+ RequestId requestId, UIResponseCallback) = 0;
virtual bool setOutdated() = 0;
virtual bool dismiss() = 0;
virtual bool isDismissing() const = 0;
/*
- * Copyright (c) 2016 Samsung Electronics Co.
+ * Copyright (c) 2016-2017 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
}
-bool NotificationBackend::start(const std::string &client, const std::string &user,
- const std::string &privilege, RequestId requestId,
- UIResponseCallback responseCb) {
+bool NotificationBackend::start(const std::string &client, const std::string &pkgLabel,
+ const std::string &user, const std::string &privilege,
+ RequestId requestId, UIResponseCallback responseCb) {
if (!m_notify.init()) {
ALOGW("Couldn't initialize notification object.");
return false;
m_request.data.client = client;
m_request.data.user = user;
m_request.data.privilege = privilege;
+ m_request.pkgLabel = pkgLabel;
m_thread = std::thread(&NotificationBackend::run, this);
return true;
{
std::string data = Translator::Gui::notificationRequestToData(m_request.id,
m_request.data.client,
+ m_request.pkgLabel,
m_request.data.privilege);
return m_clientSocket.send(data);
}
/*
- * Copyright (c) 2016 Samsung Electronics Co.
+ * Copyright (c) 2016-2017 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
NotificationBackend() : m_poller(2), m_clientSocket(Socket::PeerType::CLIENT), m_running(false) {}
virtual ~NotificationBackend();
- virtual bool start(const std::string &client, const std::string &user,
- const std::string &privilege, RequestId requestId,
+ virtual bool start(const std::string &client, const std::string &pkgLabel,
+ const std::string &user, const std::string &privilege, RequestId requestId,
UIResponseCallback responseCb);
virtual bool setOutdated();
virtual bool dismiss();
cynara-agent
glib-2.0
libsystemd
- pkgmgr-info
- security-manager
security-privilege-manager
)
SET(COMMON_SOURCES
${COMMON_PATH}/log/alog.cpp
- ${COMMON_PATH}/policy/Policy.cpp
${COMMON_PATH}/policy/PrivilegeInfo.cpp
${COMMON_PATH}/socket/Socket.cpp
${COMMON_PATH}/socket/Poll.cpp
/*
- * Copyright (c) 2014-2016 Samsung Electronics Co.
+ * Copyright (c) 2014-2017 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
char separator;
cynara_agent_req_id id;
- std::string members[2];
+ std::string members[3];
stream >> id;
stream.read(&separator, 1);
member.assign(buffer.begin(), buffer.end());
}
- return NotificationRequest({id, std::move(members[0]), "", std::move(members[1])});
+ return NotificationRequest({id, std::move(members[0]), std::move(members[1]), "", std::move(members[2])});
}
std::string notificationRequestToData(RequestId id, const std::string &client,
- const std::string &privilege)
+ const std::string &pkgLabel, const std::string &privilege)
{
const char separator = ' ';
return std::to_string(id) + separator +
std::to_string(client.length()) + separator + client + separator +
+ std::to_string(pkgLabel.length()) + separator + pkgLabel + separator +
std::to_string(privilege.length()) + separator + privilege + separator + separator;
}
/*
- * Copyright (c) 2014-2016 Samsung Electronics Co.
+ * Copyright (c) 2014-2017 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
std::string responseToString(NResponseType response);
NotificationRequest dataToNotificationRequest(const std::string &data);
std::string notificationRequestToData(RequestId id, const std::string &client,
- const std::string &privilege);
+ const std::string &pkgLabel, const std::string &privilege);
} // namespace Gui
} // namespace Translator
} // namespace AskUser
/*
- * Copyright (c) 2016 Samsung Electronics Co.
+ * Copyright (c) 2016-2017 Samsung Electronics Co.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#pragma once
+#include <string>
#include <types/RequestId.h>
#include <types/RequestData.h>
struct NotificationRequest {
NotificationRequest() : id(-1) {};
NotificationRequest(RequestId id_) : id(id_) {};
- NotificationRequest(RequestId id_, std::string client, std::string user, std::string privilege)
+ NotificationRequest(RequestId id_, std::string client, std::string pkgLabel,
+ std::string user, std::string privilege)
: id(id_),
- data{std::move(client), std::move(user), std::move(privilege)}
+ data{std::move(client), std::move(user), std::move(privilege)},
+ pkgLabel(std::move(pkgLabel))
{}
RequestId id;
RequestData data;
+ std::string pkgLabel;
};
} // namespace AskUser
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
TEST(TranslatorTest, NotificationRequest) {
cynara_agent_req_id id = 1234;
- std::string app = "lorem ipsum dolor est amet";
+ std::string client = "lorem ipsum dolor est amet";
+ std::string pkgLabel = "My app";
std::string privilege = "http://example.com/permissions/example";
- auto data = Translator::Gui::notificationRequestToData(id, app, privilege);
+ auto data = Translator::Gui::notificationRequestToData(id, client, pkgLabel, privilege);
auto request = Translator::Gui::dataToNotificationRequest(data);
ASSERT_EQ(id, request.id);
- ASSERT_EQ(app, request.data.client);
+ ASSERT_EQ(client, request.data.client);
ASSERT_EQ(privilege, request.data.privilege);
+ ASSERT_EQ(pkgLabel, request.pkgLabel);
}