Remove building of unnecessary components 00/135300/3
authorZofia Abramowska <z.abramowska@samsung.com>
Thu, 22 Jun 2017 11:58:05 +0000 (13:58 +0200)
committerZofia Abramowska <z.abramowska@samsung.com>
Mon, 26 Jun 2017 14:12:13 +0000 (16:12 +0200)
Remove:
* askuser agent
* askuser privacy plugins
* askuser client plugin
* askuser commons

Change-Id: I4f9e0e768be6e2ea46aa830bb9a9da101ed326bc

17 files changed:
CMakeLists.txt
packaging/askuser.spec
src/agent/notification-daemon/Logic.cpp
src/agent/notification-daemon/Logic.h
src/agent/notification-daemon/event/Event.h
src/agent/notification-daemon/ui/Answerable.h
src/agent/notification-daemon/ui/Po.cpp
src/agent/notification-daemon/ui/Po.h
src/agent/notification-daemon/ui/PopupLaunchMobile.h [deleted file]
src/agent/notification-daemon/ui/PopupLaunchWearable.h [deleted file]
src/agent/notification-daemon/ui/Popupper.cpp
src/agent/notification-daemon/ui/Popupper.h
src/agent/notification-daemon/ui/Toast.h [deleted file]
src/plugin/CMakeLists.txt
src/plugin/client/ClientPlugin.cpp [deleted file]
src/plugin/client/PrivacyPlugin.cpp [deleted file]
src/plugin/service/PrivacyPlugin.cpp [deleted file]

index 289bd389b9cd75115f3c95650516881180a99934..bd98706ed983d638e2d2d84aaec924bd8bc1b913 100644 (file)
@@ -88,18 +88,8 @@ ENDIF (RES_DIR)
 SET(ASKUSER_PATH ${PROJECT_SOURCE_DIR}/src)
 
 IF (BUILD_ASKUSER)
-    SET(TARGET_ASKUSER "askuser")
-    SET(TARGET_ASKUSER_COMMON "askuser-common")
     SET(TARGET_PLUGIN_SERVICE "askuser-plugin-service")
-    SET(TARGET_PLUGIN_CLIENT "askuser-plugin-client")
-    SET(TARGET_PRIVACYDENIED_PLUGIN_CLIENT "privacy-denied-plugin-client")
-    SET(TARGET_PRIVACYDENIED_PLUGIN_SERVICE "privacy-denied-plugin-service")
-    SET(TARGET_TEST "askuser-test")
-    SET(TARGET_TESTS "askuser-tests")
-    ADD_SUBDIRECTORY(src/agent)
-    ADD_SUBDIRECTORY(src/common)
     ADD_SUBDIRECTORY(src/plugin)
-    ADD_SUBDIRECTORY(test)
 ENDIF (BUILD_ASKUSER)
 
 IF (BUILD_ASKUSER_NOTIFICATION)
index fe0170ecc1d7b1c0cb15a39071ce4aded6af8b21..8b335cef6db2972e98c2b46c3330e95d94b62426 100644 (file)
@@ -1,9 +1,5 @@
-%if !%{defined with_systemd_daemon}
-%define with_systemd_daemon 1
-%endif
-
 Name:       askuser
-Summary:    Agent service for Cynara 'ask user' policy
+Summary:    Agent plugin for Cynara 'ask user' policy
 Version:    0.1.13
 Release:    1
 Group:      Security/Access Control
@@ -11,47 +7,14 @@ License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
 Source1001:    default.manifest
 BuildRequires: cmake
-BuildRequires: pkgconfig(cynara-agent)
-%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: askuser-notification-devel
+BuildRequires: pkgconfig(cynara-plugin)
 
 %if !%{defined build_type}
 %define build_type RELEASE
 %endif
 
 %description
-Daemon allowing user to grant or deny acces for given application and privilege
-
-%package -n libaskuser-common
-Summary:    Askuser common library
-
-%description -n libaskuser-common
-Askuser common library with common functionalities
-
-%package plugins
-BuildRequires: pkgconfig(cynara-plugin)
-Requires:   cynara
-Requires:   libcynara-client
-Summary:    Askuser cynara plugins
-
-%description plugins
-Askuser plugin library with cynara service and client side plugins
-
-%package test
-BuildRequires: pkgconfig(cynara-agent)
-BuildRequires: pkgconfig(cynara-client)
-BuildRequires: pkgconfig(cynara-admin)
-BuildRequires: pkgconfig(gmock)
-Summary: Tool for testing askuser packages and unit tests for askuser
-
-%description test
-Tool for testing askuser packages and unit tests for askuser
+Plugin for supporting custom policy type "Ask user"
 
 %prep
 %setup -q
@@ -71,73 +34,22 @@ export LDFLAGS+="-Wl,--rpath=%{_libdir}"
 %cmake . \
         -DBUILD_ASKUSER=ON \
         -DCMAKE_BUILD_TYPE=%{?build_type} \
-        -DBUILD_WITH_SYSTEMD_DAEMON=%{?with_systemd_daemon} \
         -DCMAKE_VERBOSE_MAKEFILE=ON
 make %{?jobs:-j%jobs}
 
 %install
 rm -rf %{buildroot}
 %make_install
-rm -f %{buildroot}/%{_libdir}/libaskuser-common.so
-
-%if %{with_systemd_daemon}
-mkdir -p %{buildroot}/%{_unitdir}/multi-user.target.wants
-mkdir -p %{buildroot}/%{_unitdir}/cynara.service.wants
-ln -s ../askuser.service %{buildroot}/%{_unitdir}/multi-user.target.wants/askuser.service
-ln -s ../askuser.service %{buildroot}/%{_unitdir}/cynara.service.wants/askuser.service
-%endif
 
 %post
-%if %{with_systemd_daemon}
-systemctl daemon-reload
-
-systemctl restart askuser.service
 systemctl restart cynara.service
-%endif
 
 %preun
-%if %{with_systemd_daemon}
-if [ $1 = 0 ]; then
-    systemctl stop askuser.service
-fi
-%endif
 
 %postun
-%if %{with_systemd_daemon}
-if [ $1 = 0 ]; then
-    systemctl daemon-reload
-fi
-
 systemctl restart cynara.service
-%endif
-
-%post -n libaskuser-common -p /sbin/ldconfig
-
-%postun -n libaskuser-common -p /sbin/ldconfig
 
 %files
 %manifest default.manifest
 %license LICENSE
-%attr(755, root, root) %{_bindir}/askuser
-%if %{with_systemd_daemon}
-%{_unitdir}/askuser.service
-%{_unitdir}/multi-user.target.wants/*
-%{_unitdir}/cynara.service.wants/*
-%endif
-
-%files -n libaskuser-common
-%manifest default.manifest
-%license LICENSE
-%{_libdir}/libaskuser-common.so.*
-
-%files plugins
-%manifest default.manifest
-%license LICENSE
-%{_libdir}/cynara/plugin/client/*
 %{_libdir}/cynara/plugin/service/*
-
-%files test
-%manifest default.manifest
-%license LICENSE
-%attr(755,root,root) %{_bindir}/askuser-test
-%attr(755,root,root) %{_bindir}/askuser-tests
index d333e0e93dce1829ffc0e4de0651bab3103e6504..7997bdb821765b64b20d3974a64921ef02912c9d 100644 (file)
@@ -206,7 +206,6 @@ void Logic::init() {
     m_popupper.setLocale();
     m_popupper.initialize();
     m_popupper.registerPopupResponseHandler([&](int popupId, NResponseType response) { popupResponse(popupId, response);});
-    m_popupper.registerToastFinishedHandler([&](int toastId) {toastFinished(toastId);});
 
     registerSignalFd();
 
@@ -254,15 +253,6 @@ void Logic::popupResponse(int popupId, NResponseType response) {
     processEvents();
 }
 
-void Logic::toastFinished(int toastId) {
-    if (toastId != m_currentEventId) {
-        ALOGD("Got different toast id than is being processed");
-        return;
-    }
-    finishCurrentEvent();
-    processEvents();
-}
-
 } // namespace Notification
 
 } // namepsace AskUser
index 9bb0c8bf0714d5c2493645dab3e295546ba11564..e1bec91a3e90a0801fced901872f554db84c8d0f 100644 (file)
@@ -70,7 +70,6 @@ private:
     bool isEventProcessed();
     void finishCurrentEvent();
     void popupResponse(int popupId, NResponseType response);
-    void toastFinished(int toastId);
 
     AskUser::Protocol::ChannelPtr m_clientChannel;
     Popupper m_popupper;
index 0aac5ec7c54d58e0698c0447a59794cbfe975f2a..f00cba490620c9597f905abbb8ac06af5f438a32 100644 (file)
@@ -61,65 +61,6 @@ private:
     std::string m_privilege;
 };
 
-class EventPopupLaunch : public IUIEvent {
-public:
-    EventPopupLaunch(Popupper *popupper, int popupId, const std::string &appName,
-                     const std::string &pkgName, const std::vector<std::string> &privileges)
-        : IUIEvent(popupper), m_popupId(popupId), m_appName(appName),
-          m_pkgName(pkgName), m_privileges(privileges)
-    {
-        setId(popupId);
-    }
-
-    virtual void process() {
-        m_popupper->popupLaunch(m_popupId, m_appName, m_pkgName, m_privileges);
-    }
-private:
-    int m_popupId;
-    std::string m_appName;
-    std::string m_pkgName;
-    std::vector<std::string> m_privileges;
-};
-
-class EventToastDeny : public IUIEvent {
-public:
-    EventToastDeny(Popupper *popupper, int toastId, const std::string &appName,
-               const std::string &pkgName, const std::string &privilege)
-        : IUIEvent(popupper), m_toastId(toastId), m_appName(appName),
-          m_pkgName(pkgName), m_privilege(privilege)
-    {
-        setId(toastId);
-    }
-
-    virtual void process() {
-        m_popupper->toastDeny(m_toastId, m_appName, m_pkgName, m_privilege);
-    }
-private:
-    int m_toastId;
-    std::string m_appName;
-    std::string m_pkgName;
-    std::string m_privilege;
-};
-
-class EventToastFail : public IUIEvent {
-public:
-    EventToastFail(Popupper *popupper, int toastId, const std::string &appName,
-               const std::string &pkgName)
-        : IUIEvent(popupper), m_toastId(toastId), m_appName(appName),
-          m_pkgName(pkgName)
-    {
-        setId(toastId);
-    }
-
-    virtual void process() {
-        m_popupper->toastFail(m_toastId, m_appName, m_pkgName);
-    }
-private:
-    int m_toastId;
-    std::string m_appName;
-    std::string m_pkgName;
-};
-
 } //namespace AskUser
 } //namespace Notification
 
index f610d702df04767835b69f2f2639517b8b7947af..3a18ed212068c9700580599f3b8de075b25d9545 100644 (file)
@@ -71,27 +71,5 @@ private:
     PopupCheck *m_popup;
 };
 
-class AnswerablePopupLaunch : public IAnswerable {
-public:
-    AnswerablePopupLaunch(Popup *popup, AnswerHandler handler)
-        : IAnswerable(handler), m_popup(popup) {}
-    virtual void process(enum Button button) const {
-        NResponseType answer;
-        switch (button) {
-        case IAnswerable::Button::ALLOW:
-            answer = NResponseType::AllowAlways;
-            break;
-        case IAnswerable::Button::DENY:
-            answer = NResponseType::DenyAlways;
-            break;
-        default:
-            answer = NResponseType::Error;
-        }
-        m_handler(m_popup->getId(), answer);
-    }
-private:
-    Popup *m_popup;
-};
-
 } // namespace AskUser
 } // namespace Notification
index 220f3bb4d56bf81179d5e91e0acc7b2214c27ee9..b984fd54e12fb66d65f4e1a771cac4e76a3d0152 100644 (file)
@@ -95,18 +95,6 @@ std::string getPkgLabel(const std::string &pkgName) {
     return pkgInfo.pkgLabel();
 }
 
-std::string getPrivacyList(const std::vector<std::string> &privs) {
-    setLocale();
-    std::string privacyList = "";
-    for (auto &priv : privs) {
-        std::string privacyName = PrivilegeInfo::getPrivacyDisplayName(priv);
-        if (privacyList.find(privacyName) == std::string::npos) {
-            privacyList.append("<br/>");
-            privacyList.append(privacyName);
-        }
-    }
-    return privacyList;
-}
 } // namespace anonymous
 
 namespace Notification {
@@ -115,18 +103,6 @@ std::string createPopupCheckMsg(const std::string &, const std::string &pkgName,
     return makeFromFormat(getFormat(MsgType::MSG_POPUP_TEXT), getPkgLabel(pkgName).c_str(),
                           PrivilegeInfo::getPrivacyDisplayName(priv).c_str());
 }
-std::string createPopupLaunchMsg(const std::string &, const std::string &pkgName, const std::vector<std::string> &privs) {
-    std::string launchTextFormat = makeFromFormat(getFormat(MsgType::MSG_POPUP_LAUNCH_TEXT), getPkgLabel(pkgName).c_str());
-    return makeFromFormat("%s%s", launchTextFormat.c_str(), getPrivacyList(privs).c_str());
-}
-
-std::string createToastDenyMsg(const std::string &, const std::string &pkgName, const std::string &priv) {
-    return makeFromFormat(getFormat(MsgType::MSG_TOAST_DENY_TEXT), getPkgLabel(pkgName).c_str(),
-                          PrivilegeInfo::getPrivacyDisplayName(priv).c_str());
-}
-std::string createToastFailMsg(const std::string &, const std::string &pkgName) {
-    return makeFromFormat(getFormat(MsgType::MSG_TOAST_FAIL_TEXT), getPkgLabel(pkgName).c_str());
-}
 
 std::string getPopupTitleMsg() {
     return makeFromFormat("%s", getFormat(MsgType::MSG_POPUP_TITLE));
index 983cbcd98a00d03e19c5d2e8ed02379f518a8e25..0f7fab4287b7093450576daddfe86266538e8240 100644 (file)
@@ -27,10 +27,7 @@ namespace Notification {
 namespace Po {
 
 std::string createPopupCheckMsg(const std::string &appName, const std::string &pkgName, const std::string &priv);
-std::string createPopupLaunchMsg(const std::string &appName, const std::string &pkgName, const std::vector<std::string> &privs);
 std::string createPrivilegeDescr(const std::string &priv);
-std::string createToastDenyMsg(const std::string &appName, const std::string &pkgName, const std::string &priv);
-std::string createToastFailMsg(const std::string &appName, const std::string &pkgName);
 
 std::string getPopupTitleMsg();
 std::string getAllowButtonMsg();
diff --git a/src/agent/notification-daemon/ui/PopupLaunchMobile.h b/src/agent/notification-daemon/ui/PopupLaunchMobile.h
deleted file mode 100644 (file)
index 1422ed2..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *  Copyright (c) 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.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License
- */
-/**
- * @file        src/agent/notification-daemon/ui/PopupLaunchMobile.h
- * @author      Zofia Abramowska <z.abramowska@samsung.com>
- * @brief       Declaration of PopupLaunchMobile class
- */
-
-#pragma once
-
-#include <Elementary.h>
-
-#include <exception/Exception.h>
-#include "Po.h"
-#include "Popup.h"
-
-namespace AskUser {
-namespace Notification {
-
-class PopupLaunchMobile : public Popup {
-public:
-    PopupLaunchMobile(Evas_Object *parent, int popupId, const std::string &msg)
-        : Popup(parent, msg)
-    {
-        setId(popupId);
-    }
-    virtual ~PopupLaunchMobile() {}
-
-    virtual void create() {
-        // popup
-        elm_popup_align_set(m_popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
-        elm_object_part_text_set(m_popup, "title,text", Po::getPopupTitleMsg().c_str());
-        evas_object_size_hint_weight_set(m_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
-        // layout
-        m_layout = elm_layout_add(m_popup);
-        if (m_layout == nullptr) {
-            ALOGE("EFL : Failed to add layout");
-            throw Exception("Enlightenment failed");
-        }
-        elm_layout_file_set(m_layout, RES_DIR"/popup_custom.edj", "popup_layout_mobile");
-        evas_object_size_hint_weight_set(m_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
-        // content
-        m_content = elm_label_add(m_layout);
-        if (!m_content) {
-            ALOGE("EFL : Failed to add content");
-            throw Exception("Enlightement failed");
-        }
-        elm_object_text_set(m_content, m_msg.c_str());
-        elm_object_style_set(m_content, "popup/default");
-        elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
-        evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-        evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
-        elm_object_part_content_set(m_layout, "elm.swallow.content", m_content);
-
-        // buttons
-        m_denyButton = elm_button_add(m_popup);
-        if (!m_denyButton) {
-            ALOGE("EFL : Failed to add deny button");
-            throw Exception("Enlightement failed");
-        }
-        elm_object_part_content_set(m_popup, "button1", m_denyButton);
-        elm_object_text_set(m_denyButton, Po::getDenyButtonMsg().c_str());
-
-        m_allowButton = elm_button_add(m_popup);
-        if (!m_allowButton) {
-            ALOGE("EFL : Failed to add allow button");
-            throw Exception("Enlightement failed");
-        }
-        elm_object_part_content_set(m_popup, "button2", m_allowButton);
-        elm_object_text_set(m_allowButton, Po::getAllowButtonMsg().c_str());
-        elm_object_content_set(m_popup, m_layout);
-        evas_object_show(m_popup);
-    }
-private:
-    Evas_Object *m_content = nullptr;
-    Evas_Object *m_layout = nullptr;
-    Evas_Object *m_layoutInner = nullptr;
-};
-
-} /* namespace Notification */
-} /* namespace Askuser */
-
diff --git a/src/agent/notification-daemon/ui/PopupLaunchWearable.h b/src/agent/notification-daemon/ui/PopupLaunchWearable.h
deleted file mode 100644 (file)
index 4ca51a2..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *  Copyright (c) 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.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License
- */
-/**
- * @file        src/agent/notification-daemon/ui/PopupLaunchWearable.h
- * @author      Zofia Abramowska <z.abramowska@samsung.com>
- * @brief       Declaration of PopupLaunchWearableper class
- */
-
-#pragma once
-
-#include <Elementary.h>
-
-#include <exception/Exception.h>
-#include "Po.h"
-#include "Popup.h"
-
-namespace AskUser {
-namespace Notification {
-
-class PopupLaunchWearable : public Popup {
-public:
-    PopupLaunchWearable(Evas_Object *parent, int popupId, const std::string msg)
-        : Popup(parent, msg)
-    {
-        setId(popupId);
-    }
-    virtual ~PopupLaunchWearable() {}
-
-    virtual void create() {
-        Evas_Object *icon;
-        elm_object_style_set(m_popup, "circle");
-
-        m_layout = elm_layout_add(m_popup);
-        if (m_layout == nullptr) {
-            ALOGE("EFL : Failed to add layout");
-            throw Exception("Enlightenment failed");
-        }
-        elm_layout_theme_set(m_layout, "layout", "popup", "content/circle/buttons2");
-        elm_object_part_text_set(m_layout, "elm.text.title", Po::getPopupTitleMsg().c_str());
-        elm_object_content_set(m_popup, m_layout);
-
-        m_layoutInner = elm_layout_add(m_layout);
-        if (m_layoutInner == nullptr) {
-            ALOGE("EFL : Failed to add layout");
-            throw Exception("Enlightenment failed");
-        }
-        elm_layout_file_set(m_layoutInner, RES_DIR"/popup_custom.edj", "popup_checkview_internal");
-        evas_object_size_hint_weight_set(m_layoutInner, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-        elm_object_part_content_set(m_layout, "elm.swallow.content", m_layoutInner);
-
-        m_content = elm_label_add(m_layoutInner);
-        if (m_content == nullptr) {
-            ALOGE("EFL : Failed to add content");
-            throw Exception("Enlightenment failed");
-        }
-        elm_object_text_set(m_content, m_msg.c_str());
-        elm_object_style_set(m_content, "popup/default");
-        elm_label_line_wrap_set(m_content, ELM_WRAP_MIXED);
-        evas_object_size_hint_weight_set(m_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-        evas_object_size_hint_align_set(m_content, EVAS_HINT_FILL, EVAS_HINT_FILL);
-        elm_object_part_content_set(m_layoutInner, "label", m_content);
-
-        m_allowButton = elm_button_add(m_popup);
-        if (m_allowButton == nullptr) {
-            ALOGE("EFL : Failed to add allow button");
-            throw Exception("Enlightenment failed");
-        }
-        elm_object_style_set(m_allowButton, "popup/circle/right");
-        elm_object_part_content_set(m_popup, "button2", m_allowButton);
-
-        icon = elm_image_add(m_allowButton);
-        if (icon == nullptr) {
-            ALOGE("EFL : Failed to add allow button icon");
-            throw Exception("Enlightenment failed");
-        }
-        elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_check.png", NULL);
-        evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-        elm_object_part_content_set(m_allowButton, "elm.swallow.content", icon);
-        evas_object_show(icon);
-
-        m_denyButton = elm_button_add(m_popup);
-        if (m_denyButton == nullptr) {
-            ALOGE("EFL : Failed to add deny button");
-            throw Exception("Enlightenment failed");
-        }
-        elm_object_style_set(m_denyButton, "popup/circle/left");
-        elm_object_part_content_set(m_popup, "button1", m_denyButton);
-
-        icon = elm_image_add(m_denyButton);
-        if (icon == nullptr) {
-            ALOGE("EFL : Failed to add deny button icon");
-            throw Exception("Enlightenment failed");
-        }
-        elm_image_file_set(icon, RES_DIR"/tw_ic_popup_btn_delete.png", NULL);
-        elm_object_part_content_set(m_denyButton, "elm.swallow.content", icon);
-        evas_object_show(icon);
-
-        evas_object_show(m_popup);
-    }
-private:
-    std::vector<std::string> m_privs;
-    Evas_Object *m_content = nullptr;
-    Evas_Object *m_layout = nullptr;
-    Evas_Object *m_layoutInner = nullptr;
-};
-
-} /* namespace Notification */
-} /* namespace Askuser */
-
index 2bd70cba62a6c39bf1c6134a59a83a563d578cc9..ee31ec60c2384de76f9ea28f5e0102b5e5ff0afb 100644 (file)
 
 #include "Answerable.h"
 #include "Po.h"
-#include "PopupLaunchMobile.h"
-#include "PopupLaunchWearable.h"
 #include "PopupCheckMobile.h"
 #include "PopupCheckWearable.h"
-#include "Toast.h"
 
 #include <exception/ErrnoException.h>
 #include <exception/Exception.h>
@@ -61,10 +58,6 @@ void Popupper::registerPopupResponseHandler(PopupHandler handler) {
     m_popupResponseHandler = handler;
 }
 
-void Popupper::registerToastFinishedHandler(ToastHandler handler) {
-    m_toastFinishedHandler = handler;
-}
-
 void Popupper::unfocusedCb(void *data, Evas_Object *, void *)
 {
     ALOGD("Unfocused");
@@ -113,11 +106,6 @@ Eina_Bool Popupper::hwKeyClickedCb(void *data, int type, void *event)
     return EINA_TRUE;
 }
 
-void Popupper::timeoutToastCb(void *data, Evas_Object *, void *) {
-    Popupper *popupper = static_cast<Popupper*>(data);
-    popupper->m_toastFinishedHandler(popupper->m_elementPtr->getId());
-}
-
 Popupper::~Popupper()
 {}
 
@@ -194,55 +182,6 @@ void Popupper::popupCheck(int popupId, const std::string &appId, const std::stri
     show();
 
 }
-void Popupper::popupLaunch(int popupId, const std::string &appId, const std::string &pkgId, const std::vector<std::string> &privs) {
-    std::string profileName = getProfileName();
-    Popup *popup;
-    try {
-        if (profileName[0] != 'w' && profileName[0] != 'W') {
-            // Not wearable
-            popup = new PopupLaunchMobile(m_win, popupId, Po::createPopupLaunchMsg(appId, pkgId, privs));
-        } else {
-            // Wearable
-            popup = new PopupLaunchWearable(m_win, popupId, Po::createPopupLaunchMsg(appId, pkgId, privs));
-        }
-        popup->create();
-    } catch (const std::exception &e) {
-        ALOGE("Failed to create popup launch : " << e.what());
-        m_popupResponseHandler(popupId, NResponseType::Error);
-        return;
-    }
-
-    m_answerablePtr.reset(new AnswerablePopupLaunch(popup, m_popupResponseHandler));
-    evas_object_smart_callback_add(popup->getAllowButton(), "clicked", &Popupper::allowPressedCb,
-                                   m_answerablePtr.get());
-    evas_object_smart_callback_add(popup->getDenyButton(), "clicked", &Popupper::denyPressedCb,
-                                   m_answerablePtr.get());
-
-    m_elementPtr.reset(popup);
-    show();
-}
-void Popupper::toastDeny(int toastId, const std::string &appId, const std::string &pkgId, const std::string &priv) {
-    try {
-        Toast *toast = new Toast(m_win, toastId, Po::createToastDenyMsg(appId, pkgId, priv));
-        toast->create();
-        m_elementPtr.reset(toast);
-    } catch (const std::exception &e) {
-        ALOGE("Failed to create toast deny : " << e.what());
-        return;
-    }
-    m_toastFinishedHandler(toastId);
-}
-void Popupper::toastFail(int toastId, const std::string &appId, const std::string &pkgId) {
-    try {
-        Toast *toast = new Toast(m_win, toastId, Po::createToastFailMsg(appId, pkgId));
-        toast->create();
-        m_elementPtr.reset(toast);
-    } catch (const std::exception &e) {
-        ALOGE("Failed to create toast fail : " << e.what());
-        return;
-    }
-    m_toastFinishedHandler(toastId);
-}
 
 void Popupper::start()
 {
index a8e5b4ee0a7075776281d9d067cd0a3e017d9bf1..478f6829d15c4d41f62227f29721030a75ea8a6b 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "Answerable.h"
 #include "Popup.h"
-#include "Toast.h"
 #include <types/NotificationResponse.h>
 #include <log/alog.h>
 
@@ -41,19 +40,14 @@ namespace Notification {
 class Popupper {
 public:
     typedef std::function<void(int, NResponseType)> PopupHandler;
-    typedef std::function<void(int)> ToastHandler;
 
     Popupper() = default;
     void initialize();
     void setLocale();
     void registerPopupResponseHandler(PopupHandler handler);
-    void registerToastFinishedHandler(ToastHandler handler);
     void start();
 
     void popupCheck(int popupId, const std::string &appId, const std::string &pkgId, const std::string &priv);
-    void popupLaunch(int popupId, const std::string &appId, const std::string &pkgId, const std::vector<std::string> &privs);
-    void toastDeny(int toastId, const std::string &appId, const std::string &pkgId, const std::string &priv);
-    void toastFail(int toastId, const std::string &appId, const std::string &pkgId);
 
     void popupClose(int popupId);
     void stop();
@@ -64,13 +58,11 @@ private:
     static void unfocusedCb(void *data, Evas_Object *, void *);
     static void allowPressedCb(void *data, Evas_Object *, void *);
     static void denyPressedCb(void *data, Evas_Object *, void *);
-    static void timeoutToastCb(void *data, Evas_Object *, void *);
     static Eina_Bool hwKeyClickedCb(void *data, int type, void *event);
 
     void show();
 
     PopupHandler m_popupResponseHandler;
-    ToastHandler m_toastFinishedHandler;
 
     Evas_Object *m_win = nullptr;
     std::unique_ptr<UIElement> m_elementPtr;
diff --git a/src/agent/notification-daemon/ui/Toast.h b/src/agent/notification-daemon/ui/Toast.h
deleted file mode 100644 (file)
index d5602e0..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Copyright (c) 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.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License
- */
-/**
- * @file        src/agent/notification-daemon/ui/Toast.h
- * @author      Zofia Abramowska <z.abramowska@samsung.com>
- * @brief       Declaration of Toast class
- */
-
-#pragma once
-
-#include <exception>
-#include <string>
-
-#include <notification_status.h>
-#include <notification_error.h>
-
-#include <log/alog.h>
-#include "UIElement.h"
-
-namespace AskUser {
-namespace Notification {
-
-class Toast : public UIElement {
-public:
-    Toast(Evas_Object *m_parentWindow, int toastId, const std::string msg) : UIElement(m_parentWindow), m_msg(msg)
-    {
-        setId(toastId);
-    }
-    virtual void create() {
-        int ret = notification_status_message_post(m_msg.c_str());
-        if (ret != NOTIFICATION_ERROR_NONE) {
-            ALOGE("notification_status_message_post failed with " << ret);
-            throw std::runtime_error("notification_status_message_post failed with " + std::to_string(ret));
-        }
-    }
-private:
-    std::string m_msg;
-};
-
-} /* namespace Notification */
-} /* namespace Askuser */
-
index 27a2f3e89eeb99f199070ed6ded45293da64a643..508d9bf872cd127dca17ac0cbcc1f0b8ba98c742 100644 (file)
@@ -33,61 +33,14 @@ SET(SERVICE_PLUGIN_SOURCES
     ${PLUGIN_PATH}/service/ServicePlugin.cpp
     )
 
-SET(CLIENT_PLUGIN_SOURCES
-    ${PLUGIN_PATH}/client/ClientPlugin.cpp
-    )
-
 ADD_DEFINITIONS("-fvisibility=default")
 
 ADD_LIBRARY(${TARGET_PLUGIN_SERVICE} SHARED ${SERVICE_PLUGIN_SOURCES})
-ADD_LIBRARY(${TARGET_PLUGIN_CLIENT} SHARED ${CLIENT_PLUGIN_SOURCES})
 
 TARGET_LINK_LIBRARIES(${TARGET_PLUGIN_SERVICE}
     ${TARGET_ASKUSER_COMMON}
     ${TARGET_ASKUSER_COMMON_DEPS}
     )
-TARGET_LINK_LIBRARIES(${TARGET_PLUGIN_CLIENT}
-    ${TARGET_ASKUSER_COMMON}
-    ${TARGET_ASKUSER_COMMON_DEPS}
-    )
 
 INSTALL(TARGETS ${TARGET_PLUGIN_SERVICE}
     DESTINATION ${LIB_INSTALL_DIR}/cynara/plugin/service/)
-INSTALL(TARGETS ${TARGET_PLUGIN_CLIENT}
-    DESTINATION ${LIB_INSTALL_DIR}/cynara/plugin/client/)
-
-########################## PRIVACY DENIED PLUGINS ##############################
-
-PKG_CHECK_MODULES(PDP_DEP
-    REQUIRED
-    cynara-plugin
-    security-manager
-    askuser-notification
-    )
-
-INCLUDE_DIRECTORIES(
-    ${ASKUSER_PATH}/common/config
-    SYSTEM
-    ${PDP_DEP_INCLUDE_DIRS}
-    )
-
-SET(PDP_CLIENT_SOURCES
-    ${PLUGIN_PATH}/client/PrivacyPlugin.cpp
-    )
-
-SET(PDP_SERVICE_SOURCES
-    ${PLUGIN_PATH}/service/PrivacyPlugin.cpp
-    )
-
-LINK_DIRECTORIES(${PDP_DEP_LIBRARY_DIRS})
-
-ADD_LIBRARY(${TARGET_PRIVACYDENIED_PLUGIN_SERVICE} SHARED ${PDP_SERVICE_SOURCES})
-ADD_LIBRARY(${TARGET_PRIVACYDENIED_PLUGIN_CLIENT} SHARED ${PDP_CLIENT_SOURCES})
-
-TARGET_LINK_LIBRARIES(${TARGET_PRIVACYDENIED_PLUGIN_SERVICE} ${PDP_DEP_LIBRARIES})
-TARGET_LINK_LIBRARIES(${TARGET_PRIVACYDENIED_PLUGIN_CLIENT} ${PDP_DEP_LIBRARIES})
-
-INSTALL(TARGETS ${TARGET_PRIVACYDENIED_PLUGIN_SERVICE}
-    DESTINATION ${LIB_INSTALL_DIR}/cynara/plugin/service/)
-INSTALL(TARGETS ${TARGET_PRIVACYDENIED_PLUGIN_CLIENT}
-    DESTINATION ${LIB_INSTALL_DIR}/cynara/plugin/client/)
diff --git a/src/plugin/client/ClientPlugin.cpp b/src/plugin/client/ClientPlugin.cpp
deleted file mode 100644 (file)
index 5fe1e1e..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- *  Copyright (c) 2014-2015 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.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License
- */
-/**
- * @file        ClientPlugin.cpp
- * @author      Zofia Abramowska <z.abramowska@samsung.com>
- * @brief       Implementation of cynara client side AskUser plugin.
- */
-
-#include <cynara-client-plugin.h>
-#include <cynara-error.h>
-#include <vector>
-
-#include <attributes/attributes.h>
-#include <log/log.h>
-#include <types/PolicyDescription.h>
-#include <types/SupportedTypes.h>
-
-using namespace Cynara;
-
-namespace AskUser {
-const std::vector<PolicyDescription> clientDescriptions = {
-        { SupportedTypes::Client::ALLOW_ONCE, "Allow once" },
-        { SupportedTypes::Client::ALLOW_PER_SESSION, "Allow per session" },
-
-        { SupportedTypes::Client::DENY_ONCE, "Deny once" },
-        { SupportedTypes::Client::DENY_PER_SESSION, "Deny per session" }
-};
-
-class ClientPlugin : public ClientPluginInterface {
-public:
-    const std::vector<PolicyDescription> &getSupportedPolicyDescr() {
-        return clientDescriptions;
-    }
-
-    bool isCacheable(const ClientSession &session UNUSED, const PolicyResult &result) {
-        return (result.policyType() == SupportedTypes::Client::ALLOW_PER_SESSION
-                || result.policyType() == SupportedTypes::Client::DENY_PER_SESSION);
-    }
-
-    bool isUsable(const ClientSession &session,
-                  const ClientSession &prevSession,
-                  bool &updateSession,
-                  PolicyResult &result)
-    {
-        updateSession = false;
-
-        switch (result.policyType()) {
-        case SupportedTypes::Client::ALLOW_PER_SESSION:
-        case SupportedTypes::Client::DENY_PER_SESSION:
-            if (session == prevSession) {
-                return true;
-            }
-            LOGD("Previous session <" << prevSession << "> does not match current session <"
-                    << session << ">");
-            return false;
-        default:
-            return false;
-        }
-    }
-
-    void invalidate() {}
-
-    virtual int toResult(const ClientSession &session UNUSED, PolicyResult &result) {
-        switch (result.policyType()) {
-            case SupportedTypes::Client::ALLOW_ONCE:
-            case SupportedTypes::Client::ALLOW_PER_SESSION:
-                return CYNARA_API_ACCESS_ALLOWED;
-            default:
-                return CYNARA_API_ACCESS_DENIED;
-        }
-    }
-};
-
-} // namespace AskUser
-
-extern "C" {
-ExternalPluginInterface *create(void) {
-    return new AskUser::ClientPlugin();
-}
-
-void destroy(ExternalPluginInterface *ptr) {
-    delete ptr;
-}
-} // extern "C"
diff --git a/src/plugin/client/PrivacyPlugin.cpp b/src/plugin/client/PrivacyPlugin.cpp
deleted file mode 100644 (file)
index f1722e7..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *  Copyright (c) 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.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License
- */
-/**
- * @file        PrivacyPlugin.cpp
- * @author
- * @brief       Implementation of cynara client side PrivacyDenied plugin.
- */
-
-#include <vector>
-#include <cynara-client-plugin.h>
-#include <cynara-error.h>
-
-#include <attributes/attributes.h>
-#include <PrivacyConfig.h>
-
-using namespace Cynara;
-
-namespace PrivacyDeniedPlugin {
-const std::vector<PolicyDescription> clientDescriptions = {
-    { Config::ASK_USER_LEGACY, "ASK_USER_LEGACY" },
-    { Config::PRIVACY_DENY, "PRIVACY_DENY" }
-};
-
-class ClientPlugin : public ClientPluginInterface {
-public:
-    const std::vector<PolicyDescription> &getSupportedPolicyDescr() {
-        return clientDescriptions;
-    }
-
-    bool isCacheable(const ClientSession &session UNUSED, const PolicyResult &result UNUSED) {
-        return true;
-    }
-
-    bool isUsable(const ClientSession &session,
-                  const ClientSession &prevSession,
-                  bool &updateSession,
-                  PolicyResult &result UNUSED)
-    {
-        updateSession = false;
-        return (session.compare(prevSession) == 0);
-    }
-
-    void invalidate() {}
-
-    int toResult(const ClientSession &session UNUSED, PolicyResult &result UNUSED) {
-        return CYNARA_API_ACCESS_DENIED;
-    }
-};
-
-} // namespace PrivacyDeniedPlugin
-
-extern "C" {
-
-ExternalPluginInterface *create(void) {
-    return new PrivacyDeniedPlugin::ClientPlugin();
-}
-
-void destroy(ExternalPluginInterface *ptr) {
-    delete ptr;
-}
-
-} // extern "C"
diff --git a/src/plugin/service/PrivacyPlugin.cpp b/src/plugin/service/PrivacyPlugin.cpp
deleted file mode 100644 (file)
index 2478814..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *  Copyright (c) 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.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License
- */
-/**
- * @file        PrivacyPlugin.cpp
- * @author
- * @brief       Implementation of cynara service side PrivacyDenied plugin.
- */
-
-#include <memory>
-#include <string>
-#include <vector>
-#include <cynara-plugin.h>
-
-#include <app-runtime.h>
-#include <attributes/attributes.h>
-#include <PrivacyConfig.h>
-#include <askuser-notification/ask-user-client.h>
-
-using namespace Cynara;
-
-namespace PrivacyDeniedPlugin {
-
-const std::vector<PolicyDescription> serviceDescriptions = {
-    { Config::ASK_USER_LEGACY, "ASK_USER_LEGACY" },
-    { Config::PRIVACY_DENY, "PRIVACY_DENY" }
-};
-
-class ServicePlugin : public ServicePluginInterface {
-public:
-    ServicePlugin() {}
-
-    const std::vector<PolicyDescription> &getSupportedPolicyDescr() {
-        return serviceDescriptions;
-    }
-
-    PluginStatus check(const std::string &client,
-                       const std::string &user,
-                       const std::string &privilege,
-                       PolicyResult &result UNUSED,
-                       AgentType &requiredAgent UNUSED,
-                       PluginData &pluginData UNUSED) noexcept
-    {
-        toast(client, user, privilege);
-        return PluginStatus::ANSWER_READY;
-    }
-
-    PluginStatus update(const std::string &client UNUSED,
-                        const std::string &user UNUSED,
-                        const std::string &privilege UNUSED,
-                        const PluginData &agentData UNUSED,
-                        PolicyResult &result UNUSED) noexcept
-    {
-        // This function should be never called
-        return PluginStatus::ERROR;
-    }
-
-    void invalidate() {}
-
-private:
-    void toast(const std::string &client, const std::string &user, const std::string &privilege) {
-        char *pkgName = nullptr, *appName = nullptr;
-        int ret = security_manager_identify_app_from_cynara_client(client.c_str(), &pkgName, &appName);
-        if (ret != SECURITY_MANAGER_SUCCESS || pkgName == nullptr)
-            return;
-
-        std::unique_ptr<char, decltype(free)*> pkgNamePtr(pkgName, free);
-        std::unique_ptr<char, decltype(free)*> appNamePtr(appName, free);
-        AskUser::Protocol::toast_deny(pkgName, (appName ? appName : ""), std::stoi(user), privilege);
-    }
-};
-
-} // namespace PrivacyDeniedPlugin
-
-extern "C" {
-ExternalPluginInterface *create(void) {
-    return new PrivacyDeniedPlugin::ServicePlugin();
-}
-
-void destroy(ExternalPluginInterface *ptr) {
-    delete ptr;
-}
-} // extern "C"