Implement serialization of privilege mapping API
[platform/core/security/security-manager.git] / src / server / service / include / service.h
index 3cc07c1..371d5fd 100644 (file)
@@ -40,10 +40,12 @@ class Service :
     public SecurityManager::BaseService
 {
 public:
-    Service();
+    Service(const bool isSlave);
     ServiceDescriptionVector GetServiceDescription();
 
 private:
+    const bool m_isSlave;
+
     /**
      * Handle request from a client
      *
@@ -94,7 +96,6 @@ private:
 
     void processUserDelete(MessageBuffer &buffer, MessageBuffer &send, uid_t uid);
 
-
     /**
      * Process policy update request
      *
@@ -105,6 +106,50 @@ private:
      * @param  smackLabel smack label of requesting app
      */
     void processPolicyUpdate(MessageBuffer &buffer, MessageBuffer &send, uid_t uid, pid_t pid, const std::string &smackLabel);
+
+    /**
+     * List all privileges for specific user, placed in Cynara's PRIVACY_MANAGER
+     * or ADMIN's bucket - choice based on forAdmin parameter
+     *
+     * @param  buffer Raw received data buffer
+     * @param  send   Raw data buffer to be sent
+     * @param  uid    Identifier of the user who sent the request
+     * @param  pid    PID of the process which sent the request
+     * @param  smackLabel smack label of requesting app
+     * @param  forAdmin determines internal type of request
+     */
+    void processGetConfiguredPolicy(MessageBuffer &buffer, MessageBuffer &send, uid_t uid, pid_t pid, const std::string &smackLabel, bool forAdmin);
+
+    /**
+     * Get whole policy for specific user. Whole policy is a list of all apps,
+     * and their permissions (based on what they've stated in their manifests).
+     * If uid is unprivileged, then only privileges for the caller uid will be
+     * listed. If uid is privileged, then apps for all the users will be listed.
+     *
+     * @param  buffer Raw received data buffer
+     * @param  send     Raw data buffer to be sent
+     * @param  uid      Identifier of the user who sent the request
+     * @param  pid      PID of the process which sent the request
+     * @param  smackLabel smack label of requesting app
+     */
+    void processGetPolicy(MessageBuffer &buffer, MessageBuffer &send, uid_t uid, pid_t pid, const std::string &smackLabel);
+
+    /**
+     * Process getting policies descriptions as strings from Cynara
+     *
+     * @param  recv   Raw received data buffer
+     * @param  send   Raw data buffer to be sent
+     */
+    void processPolicyGetDesc(MessageBuffer &send);
+
+    /**
+     * Process getting privileges mapping. This retrieves and sends to clinet vector of privileges
+     * which are mapped to given privileges between two given privilege versions.
+     *
+     * @oaran  send   Raw data buffer to be sent
+     */
+    void processPrivilegesMappings(MessageBuffer &recv, MessageBuffer &send);
+
 };
 
 } // namespace SecurityManager