Update SmackManager for enablepermissions()
[platform/framework/native/installer.git] / src / Manager / SmackManager.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file        SmackManager.h
19  * @brief       This is the header file for the %SmackManager class.
20  *
21  * This header file contains the declarations of the %SmackManager class.
22  */
23 #ifndef _SMACK_MANAGER_H_
24 #define _SMACK_MANAGER_H_
25
26 #include <FAppTypes.h>
27
28 #include "InstallationContext.h"
29
30 class SmackManager
31 {
32 public:
33         SmackManager(void);
34         virtual ~SmackManager(void);
35         bool Construct(InstallationContext* pContext);
36
37         bool Install(const Tizen::App::PackageId& packageId);
38         bool Uninstall(const Tizen::App::PackageId& packageId);
39
40         bool AddLabelDir(const Tizen::Base::String& label, const Tizen::Base::String& dirPath, bool rootDirectory = false);
41         bool AddLabelSharedDir(const Tizen::App::PackageId& packageId, const Tizen::Base::String& dirPath);
42         bool AddSharedDirReaders(const Tizen::Base::String& label);
43         bool AddFriend(const Tizen::App::PackageId& packageId1, const Tizen::App::PackageId& packageId2);
44
45         bool EnablePermissions(const Tizen::App::PackageId& packageId);
46         //bool AddPermissions(const Tizen::App::PackageId& packageId);
47         bool RevokePermissions(const Tizen::App::PackageId& packageId);
48
49 private:
50         bool IsSmackEnable();
51
52         int Install(const char* pPackageId);
53         int Uninstall(const char* pPackageId);
54
55         int AddLabelDir(const char* pLabel, const char* pDirPath);
56         int AddLabelSharedDir(const char* pLabel, const char* pSharedLabel, const char* pDirPath);
57         int AddSharedDirReaders(const char* pSharedLabel, const char** ppAppList);
58         int AddFriend(const char* pPackageId1, const char* pPackageId2);
59
60         int EnablePermissions(const char* pPackageId, int appType, const char** ppPermissions, bool persistent);
61         int RevokePermissions(const char* pPackageId);
62
63         // deprecated
64         //int AddPermissions(const char* pPackageId, const char** ppPermissions);
65
66 private:
67         InstallationContext* __pContext;
68         bool __isSmackEnable;
69
70
71 }; // SmackManager
72
73 #endif // _SMACK_MANAGER_H_