Add security_manager_groups_get() API
[platform/core/security/security-manager.git] / src / server / service / service.cpp
index 45cdcf3..9409ec8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *  Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
  *
  *  Contact: Rafal Krypa <r.krypa@samsung.com>
  *
@@ -157,6 +157,9 @@ bool Service::processOne(const ConnectionID &conn, MessageBuffer &buffer,
                 case SecurityModuleCall::GET_PRIVILEGES_MAPPING:
                     processPrivilegesMappings(buffer, send);
                     break;
+                case SecurityModuleCall::GROUPS_GET:
+                    processGroupsGet(send);
+                    break;
                 default:
                     LogError("Invalid call: " << call_type_int);
                     Throw(ServiceException::InvalidAction);
@@ -353,4 +356,15 @@ void Service::processPrivilegesMappings(MessageBuffer &recv, MessageBuffer &send
     Serialization::Serialize(send, mappings);
 }
 
+void Service::processGroupsGet(MessageBuffer &send)
+{
+    std::vector<std::string> groups;
+    int ret = ServiceImpl::policyGetGroups(groups);
+
+    Serialization::Serialize(send, ret);
+    if (ret == SECURITY_MANAGER_API_SUCCESS) {
+        Serialization::Serialize(send, groups);
+    }
+}
+
 } // namespace SecurityManager