837f5641ca3ec7e0da5e42fb6c64bcc95c39f0a5
[platform/core/appfw/wgt-backend.git] / src / wgt / step / security / step_check_extension_privileges.h
1 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by a apache 2.0 license that can be
3 // found in the LICENSE file.
4 // Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
5 // Use of this source code is governed by a apache 2.0 license that can be
6 // found in the LICENSE file.
7
8 #ifndef WGT_STEP_SECURITY_STEP_CHECK_EXTENSION_PRIVILEGES_H_
9 #define WGT_STEP_SECURITY_STEP_CHECK_EXTENSION_PRIVILEGES_H_
10
11 #include <common/app_installer.h>
12 #include <common/installer_context.h>
13 #include <common/step/step.h>
14 #include <manifest_parser/utils/logging.h>
15 #include <manifest_parser/values.h>
16
17 #include <vector>
18 #include <string>
19 #include <set>
20
21 namespace wgt {
22 namespace security {
23
24 /**
25  * \brief Step that add user extension privileges during installation
26  */
27 class StepCheckExtensionPrivileges : public common_installer::Step {
28  public:
29   using Step::Step;
30
31   /**
32    * \Adds extra package privileges defined by extension manifest.
33    *
34    * \return Status::OK
35    */
36   Status process() override;
37   Status clean() override { return Status::OK; }
38   Status undo() override { return Status::OK; }
39   /**
40    * \brief Check requirements for this step
41    *
42    * \return Status::ERROR when rmanifest data are missing,
43    *         Status::OK otherwise
44    */
45   Status precheck() override;
46  private:
47   std::string GetExtensionPath();
48   bool CheckPrivilegeLevel(std::set<std::string> priv_set);
49   STEP_NAME(CheckExtensionPrivileges)
50 };
51
52 }  // namespace security
53 }  // namespace wgt
54
55 #endif  // WGT_STEP_SECURITY_STEP_CHECK_EXTENSION_PRIVILEGES_H_