Show popup only for "Ask user" policy 32/139832/1
authorZofia Abramowska <z.abramowska@samsung.com>
Thu, 20 Jul 2017 14:30:15 +0000 (16:30 +0200)
committerZofia Abramowska <z.abramowska@samsung.com>
Thu, 20 Jul 2017 14:30:20 +0000 (16:30 +0200)
Change-Id: Id0e2b9fb13f8b06ad39668e623d35034ee89c52e

src/notification-daemon/Logic.cpp

index f22dc10..9e6d1c0 100644 (file)
@@ -154,19 +154,28 @@ void Logic::popup(Protocol::ConnectionFd fd, Protocol::RequestId id, const std::
     }
 
     if (policies.size() > 1) {
-        ALOGE("Something strange happened, more than one policy for (" << it->second.appId << ", " << it->second.user << ", " << privilege << ") exists");
+        ALOGE("Something strange happened, more than one policy for (" << it->second.appId << ", "
+              << it->second.user << ", " << privilege << ") exists");
         m_serverChannel->popupResponse(fd, id, ASKUSER_DENY_ONCE);
         return;
     }
 
-    if (policies.front().getLevel() == "Allow") {
+    std::string policyLevel = policies.front().getLevel();
+
+    if (policyLevel == "Allow") {
         m_serverChannel->popupResponse(fd, id, ASKUSER_ALLOW_FOREVER);
         return;
     }
-    if (policies.front().getLevel() == "Deny") {
+    if (policyLevel == "Deny") {
         m_serverChannel->popupResponse(fd, id, ASKUSER_DENY_FOREVER);
         return;
     }
+    if (policyLevel != "Ask user") {
+        ALOGE("Unknown policy set : " << policyLevel << " for (" << it->second.appId << ", " << it->second.user
+              << ", " << privilege << ")" );
+        m_serverChannel->popupResponse(fd, id, ASKUSER_DENY_ONCE);
+        return;
+    }
 
     auto &pkgId = it->second.pkgLabel;
     addEvent({fd, id}, new EventPopupCheck(&m_popupper, pkgId, privilege));