Add StepRecoverPrivilegeCompatibility 23/167423/2
authorSangyoon Jang <jeremy.jang@samsung.com>
Wed, 17 Jan 2018 11:48:39 +0000 (20:48 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Wed, 17 Jan 2018 12:41:31 +0000 (12:41 +0000)
Change-Id: Iaa05857f2e92867202e3ffc371316edf655c0a4b
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/step/security/step_recover_privilege_compatibility.cc [new file with mode: 0644]
src/common/step/security/step_recover_privilege_compatibility.h [new file with mode: 0644]

diff --git a/src/common/step/security/step_recover_privilege_compatibility.cc b/src/common/step/security/step_recover_privilege_compatibility.cc
new file mode 100644 (file)
index 0000000..02add3e
--- /dev/null
@@ -0,0 +1,21 @@
+// Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#include "common/step/security/step_recover_privilege_compatibility.h"
+
+#include "common/step/security/step_privilege_compatibility.h"
+
+namespace common_installer {
+namespace security {
+
+Step::Status StepRecoverPrivilegeCompatibility::RecoveryUpdate() {
+  StepPrivilegeCompatibility step(context_, internal_priv_type_);
+  Status status = step.precheck();
+  if (status != Status::OK)
+    return status;
+  return step.process();
+}
+
+}  // namespace security
+}  // namespace common_installer
diff --git a/src/common/step/security/step_recover_privilege_compatibility.h b/src/common/step/security/step_recover_privilege_compatibility.h
new file mode 100644 (file)
index 0000000..650018e
--- /dev/null
@@ -0,0 +1,45 @@
+// Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+// Use of this source code is governed by an apache-2.0 license that can be
+// found in the LICENSE file.
+
+#ifndef COMMON_STEP_SECURITY_RECOVER_STEP_PRIVILEGE_COMPATIBILITY_H_
+#define COMMON_STEP_SECURITY_RECOVER_STEP_PRIVILEGE_COMPATIBILITY_H_
+
+#include <manifest_parser/utils/logging.h>
+
+#include "common/installer_context.h"
+#include "common/step/recovery/step_recovery.h"
+#include "common/step/security/step_privilege_compatibility.h"
+
+namespace common_installer {
+namespace security {
+
+/**
+ * @brief Recovers privilege compatibility
+ *
+ * This is the part of Recovery Mode that is responsible for converting
+ * privilieges declared in package manifest to the privileges for current
+ * platform version
+ */
+class StepRecoverPrivilegeCompatibility : public recovery::StepRecovery {
+ public:
+  using StepRecovery::StepRecovery;
+
+  StepRecoverPrivilegeCompatibility(InstallerContext* context,
+      StepPrivilegeCompatibility::InternalPrivType internal_priv_type)
+      : StepRecovery(context),
+       internal_priv_type_(internal_priv_type) {}
+
+  Status RecoveryNew() override { return Status::OK; }
+  Status RecoveryUpdate() override;
+
+ private:
+  StepPrivilegeCompatibility::InternalPrivType internal_priv_type_;
+
+  STEP_NAME(RecoverPrivilegeCompatibility)
+};
+
+}  // namespace security
+}  // namespace common_installer
+
+#endif  // COMMON_STEP_SECURITY_STEP_RECOVER_PRIVILEGE_COMPATIBILITY_H_