#ifndef COMMON_SECURITY_REGISTRATION_H_
#define COMMON_SECURITY_REGISTRATION_H_
-#include <boost/filesystem/path.hpp>
-
#include <sys/types.h>
+#include <filesystem>
#include <string>
+#include <vector>
#include "common/installer_context.h"
* Adapter interface for external Security module.
*
* Adapter interface for external Security module used for registering
- * application to security context
+ * package to security context
*
- * \param pkg_id pkdid of given package
- * \param path path of installed package
- * \param manifest pointer to manifest structure
+ * \param context installer context contains necessary information
+ * \param error_message extra/detailed error message
*
* \return true if success
*/
-bool RegisterSecurityContextForApps(const std::string& pkg_id,
- const boost::filesystem::path& path, manifest_x* manifest);
+bool RegisterSecurityContextForManifest(
+ const common_installer::InstallerContext* context,
+ std::string* error_message);
/**
* Adapter interface for external Security module.
*
* Adapter interface for external Security module used for unregistering
- * application from security context
+ * package from security context
*
- * \param pkg_id pkdid of given package
+ * \param pkg_id pkgid of given package
+ * \param pkg_type type of given package*
+ * \param uid uid
* \param manifest pointer to manifest structure
+ * \param error_message extra/detailed error message
+ *
+ * \return true if success
+ */
+bool UnregisterSecurityContextForManifest(const std::string& pkg_id,
+ const std::string& pkg_type, uid_t uid, manifest_x* manifest,
+ std::string* error_message);
+
+/**
+ * Adapter interface for external Security module.
+ *
+ * Adapter interface for external Security module used for unregistering
+ * package from security context
+ *
+ * \param pkg_id pkgid of given package
+ * \param pkg_type type of given package
+ * \param uid uid
+ * \param error_message extra/detailed error message
+ * \param ignore_data_absence optional, default set to false, indicate if
+ * failure of querying appids for pkgid should return
+ * false or true
+ *
+ * \return true if success
+ */
+bool UnregisterSecurityContextForPkgId(const std::string& pkg_id,
+ const std::string& pkg_type, uid_t uid, std::string* error_message,
+ bool ignore_data_absence = false);
+
+/**
+ * Adapter interface for external Security module.
+ *
+ * Adapter interface for external Security module used for registering
+ * package path to security context
+ *
+ * \param pkg_id pkgid of given package
+ * \param pkg_type pkg type of given package
+ * \param path path for registering
+ * \param uid uid
+ * \param is_readonly_pkg RO package flag
+ * \param error_message extra/detailed error message
*
* \return true if success
*/
-bool UnregisterSecurityContextForApps(const std::string& pkg_id,
- manifest_x* manifest);
+bool RegisterSecurityContextForPath(const std::string &pkg_id,
+ const std::string& pkg_type, const std::filesystem::path& path,
+ uid_t uid, bool is_readonly_pkg, std::string* error_message);
+
+/**
+ * Adapter interface for external Security module.
+ *
+ * Adapter interface for external Security module used for registering
+ * package external paths to security context
+ *
+ * \param pkg_id pkgid of given package
+ * \param pkg_type pkg type of given package
+ * \param path path for registering
+ * \param uid uid
+ * \param error_message extra/detailed error message
+ *
+ * \return true if success
+ */
+bool RegisterSecurityContextForPathExternalOnly(const std::string &pkg_id,
+ const std::string &pkg_type, const std::filesystem::path& path,
+ uid_t uid, std::string* error_message);
+
+bool HasOwnerRwOtherRoPaths(const std::filesystem::path& path);
} // namespace common_installer