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 namespace Tizen { namespace Security
45 class _PrivilegeCache;
49 * @class _PrivilegeManager
50 * @brief This class provides a way to manage the privilege information.
53 * This class provides a way to manage the privilege information.
57 class _OSP_EXPORT_ _PrivilegeManager
58 : public Tizen::Base::Object
59 , public Tizen::App::Package::IPackageInstallationEventListener
65 * Gets the list of privilege string.
68 * @return A list of privilege string
69 * @param[in] appId The application ID.
70 * @exception E_SUCCESS The method is successful.
71 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
72 * @exception E_SYSTEM An unexpected system error occurred.
73 * @remarks The specific error code can be accessed using the GetLastResult() method.
75 static Tizen::Base::Collection::IList* GetPrivilegeListN(const Tizen::App::AppId& appId);
77 virtual void OnPackageInstallationCompleted(const Tizen::App::PackageId& packageId, Tizen::App::Package::PackageInstallationResult installationResult);
78 virtual void OnPackageInstallationInProgress(const Tizen::App::PackageId& packageId, int progress) {}
79 virtual void OnPackageUninstallationCompleted(const Tizen::App::PackageId& packageId, bool uninstallationResult) {}
84 _PrivilegeManager(void);
85 virtual ~_PrivilegeManager(void);
87 result Construct(void);
88 static _PrivilegeManager* GetInstance(void);
90 static result RetrieveCipherPrivilegeN(const Tizen::App::AppId& appId, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum, Tizen::Base::Collection::ArrayList*& pPrivilegeList);
91 static result RetrieveCipherPrivilegeExN(const Tizen::App::AppId& appId, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum, Tizen::Base::Collection::ArrayList*& pPrivilegeList);
92 _PrivilegeInfo* RetrievePrivilegeInfoN(const Tizen::App::AppId& appId) const;
94 static Tizen::Base::Collection::IList* UnpackPrivilegeN(const byte* pBitwisePrivilege);
96 _PrivilegeManager(const _PrivilegeManager& rhs);
97 _PrivilegeManager& operator =(const _PrivilegeManager& rhs);
99 static void InitInstance(void);
103 _PrivilegeCache* __pPrivilegeCache;
104 static _PrivilegeManager* __pPrivilegeManagerInstance;
106 friend class _PrivilegeManagerServer;
107 friend class _AccessController;
108 friend class AccessController;
110 }; // _PrivilegeManager
112 }} // Tizen::Security
114 #endif // _FSEC_INTERNAL_PRIVILEGE_MANAGER_H_