2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FSec_PrivilegeManager.h
19 * @brief This is the header file for the _PrivilegeManager.
20 * This header file contains the declarations of the _PrivilegeManager.
23 #ifndef _FSEC_INTERNAL_PRIVILEGE_MANAGER_H_
24 #define _FSEC_INTERNAL_PRIVILEGE_MANAGER_H_
26 #include <FOspConfig.h>
27 #include <FAppPkgIPackageInstallationEventListener.h>
29 #include "FSec_AccessControlTypes.h"
31 namespace Tizen { namespace Base { namespace Collection
36 namespace Tizen { namespace Base
41 namespace Tizen { namespace Security
44 class _PrivilegeCache;
48 * @class _PrivilegeManager
49 * @brief This class provides a way to manage the privilege information.
52 * This class provides a way to manage the privilege information.
56 class _OSP_EXPORT_ _PrivilegeManager
57 : public Tizen::Base::Object
58 , public Tizen::App::Package::IPackageInstallationEventListener
64 * Gets the list of privilege string.
67 * @return A list of privilege string
68 * @param[in] appId The application ID.
69 * @exception E_SUCCESS The method is successful.
70 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
71 * @exception E_SYSTEM An unexpected system error occurred.
72 * @remarks The specific error code can be accessed using the GetLastResult() method.
74 static Tizen::Base::Collection::IList* GetPrivilegeListN(const Tizen::App::AppId& appId);
76 virtual void OnPackageInstallationCompleted(const Tizen::App::PackageId& packageId, Tizen::App::Package::PackageInstallationResult installationResult);
77 virtual void OnPackageInstallationInProgress(const Tizen::App::PackageId& packageId, int progress) {}
78 virtual void OnPackageUninstallationCompleted(const Tizen::App::PackageId& packageId, bool uninstallationResult) {}
83 _PrivilegeManager(void);
84 virtual ~_PrivilegeManager(void);
86 result Construct(void);
87 static _PrivilegeManager* GetInstance(void);
89 static result RetrieveCipherPrivilegeN(const Tizen::App::AppId& appId, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum, Tizen::Base::Collection::ArrayList*& pPrivilegeList);
90 static result RetrieveCipherPrivilegeExN(const Tizen::App::AppId& appId, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum, Tizen::Base::Collection::ArrayList*& pPrivilegeList);
91 _PrivilegeInfo* RetrievePrivilegeInfoN(const Tizen::App::AppId& appId) const;
93 static Tizen::Base::Collection::IList* UnpackPrivilegeN(const byte* pBitwisePrivilege);
95 _PrivilegeManager(const _PrivilegeManager& rhs);
96 _PrivilegeManager& operator =(const _PrivilegeManager& rhs);
98 static void InitInstance(void);
102 _PrivilegeCache* __pPrivilegeCache;
103 static _PrivilegeManager* __pPrivilegeManagerInstance;
105 friend class _PrivilegeManagerServer;
106 friend class _AccessController;
107 friend class AccessController;
109 }; // _PrivilegeManager
111 }} // Tizen::Security
113 #endif // _FSEC_INTERNAL_PRIVILEGE_MANAGER_H_