CKMI: Implementation of ckm-policy.
[platform/core/test/security-tests.git] / src / ckm-integration / ckm-policy.h
1 /*
2  *  Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License
15  */
16 /*
17  * @file       ckm-policy.h
18  * @author     Bartlomiej Grzelewski (b.grzelewski@samsung.com)
19  * @version    1.0
20  */
21 #pragma once
22
23 #include <process-settings/policy.h>
24 #include <process-settings/executor.h>
25 #include <process-settings/change-uid.h>
26 #include <process-settings/change-smack.h>
27 #include <process-settings/install-app.h>
28 #include <process-settings/create-user.h>
29
30 class CKMPolicy : public ProcessSettings::Policy {
31 public:
32     CKMPolicy(
33         std::string pkgId,
34         std::string userName,
35         ProcessSettings::PrivilegeVector priv);
36     virtual std::string GetUserName() const;
37     virtual void SetUserName(std::string);
38     virtual gid_t GetGid() const;
39     virtual void SetGid(gid_t);
40     virtual uid_t GetUid() const;
41     virtual void SetUid(uid_t);
42     virtual std::string GetSmackLabel() const;
43     virtual void SetSmackLabel(std::string);
44     virtual std::string GetAppId() const;
45     virtual void SetAppId(std::string);
46     virtual std::string GetPkgId() const;
47     virtual void SetPkgId(std::string);
48     virtual ProcessSettings::PrivilegeVector GetPrivileges() const;
49     virtual void SetPrivileges(ProcessSettings::PrivilegeVector);
50     virtual ~CKMPolicy() {}
51 private:
52     uid_t m_uid;
53     gid_t m_gid;
54     std::string m_userName;
55     std::string m_smackLabel;
56     std::string m_pkgId;
57     std::string m_appId;
58     ProcessSettings::PrivilegeVector m_privileges;
59 };
60
61 extern const ProcessSettings::PrivilegeVector PrivNone;
62 extern const ProcessSettings::PrivilegeVector PrivCKMBoth;
63 extern const ProcessSettings::PrivilegeVector PrivCKMControl;
64 extern const ProcessSettings::PrivilegeVector PrivCKMStore;
65