2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FSec_PrivilegeManager.h
20 * @brief This is the header file for the _PrivilegeManager.
21 * This header file contains the declarations of the _PrivilegeManager.
24 #ifndef _FSEC_INTERNAL_PRIVILEGE_MANAGER_H_
25 #define _FSEC_INTERNAL_PRIVILEGE_MANAGER_H_
27 #include <FOspConfig.h>
28 #include <FAppPkgIPackageInstallationEventListener.h>
30 #include "FSec_AccessControlTypes.h"
32 namespace Tizen { namespace Base { namespace Collection
37 namespace Tizen { namespace Base
42 class PrivilegeService;
44 namespace Tizen { namespace Security
47 class _PrivilegeCache;
51 * @class _PrivilegeManager
52 * @brief This class provides a way to manage the privilege information.
55 * This class provides a way to manage the privilege information.
59 class _OSP_EXPORT_ _PrivilegeManager
60 : public Tizen::Base::Object
61 , public Tizen::App::Package::IPackageInstallationEventListener
67 * Gets the list of privilege string.
70 * @return A list of privilege string
71 * @param[in] appId The application ID.
72 * @exception E_SUCCESS The method is successful.
73 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
74 * @exception E_SYSTEM An unexpected system error occurred.
75 * @remarks The specific error code can be accessed using the GetLastResult() method.
77 static Tizen::Base::Collection::IList* GetPrivilegeListN(const Tizen::App::AppId& appId);
79 virtual void OnPackageInstallationCompleted(const Tizen::App::PackageId& packageId, Tizen::App::Package::PackageInstallationResult installationResult);
80 virtual void OnPackageInstallationInProgress(const Tizen::App::PackageId& packageId, int progress) {}
81 virtual void OnPackageUninstallationCompleted(const Tizen::App::PackageId& packageId, bool uninstallationResult) {}
86 _PrivilegeManager(void);
87 virtual ~_PrivilegeManager(void);
89 result Construct(void);
90 static _PrivilegeManager* GetInstance(void);
92 static result RetrieveCipherPrivilegeN(const Tizen::App::AppId& appId, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum, Tizen::Base::Collection::ArrayList*& pPrivilegeList);
93 static result RetrieveCipherPrivilegeExN(const Tizen::App::AppId& appId, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum, Tizen::Base::Collection::ArrayList*& pPrivilegeList);
94 _PrivilegeInfo* RetrievePrivilegeInfoN(const Tizen::App::AppId& appId) const;
96 static Tizen::Base::Collection::IList* UnpackPrivilegeN(const byte* pBitwisePrivilege);
98 _PrivilegeManager(const _PrivilegeManager& rhs);
99 _PrivilegeManager& operator =(const _PrivilegeManager& rhs);
101 static void InitInstance(void);
105 _PrivilegeCache* __pPrivilegeCache;
106 static _PrivilegeManager* __pPrivilegeManagerInstance;
108 friend class ::PrivilegeService;
109 friend class _AccessController;
110 friend class AccessController;
112 }; // _PrivilegeManager
114 }} // Tizen::Security
116 #endif // _FSEC_INTERNAL_PRIVILEGE_MANAGER_H_