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 FSecurity_PrivilegeCache.h
20 * @brief This is the header file for the _PrivilegeCache.
22 * This header file contains the declarations of the _PrivilegeCache.
25 #ifndef _FSEC_INTERNAL_PRIVILEGE_CACHE_H_
26 #define _FSEC_INTERNAL_PRIVILEGE_CACHE_H_
28 #include <unique_ptr.h>
29 #include <FOspConfig.h>
30 #include "FSec_AccessControlTypes.h"
32 namespace Tizen { namespace Base { namespace Runtime
37 namespace Tizen { namespace Security
43 * @class _PrivilegeCache
44 * @brief This class provides a way to access the privilege cache.
47 * This class provides a way to access the privilege cache.
51 : public Tizen::Base::Object
56 _PrivilegeCache(void);
57 virtual ~_PrivilegeCache(void);
59 result Construct(void);
62 * Adds the specified privilege information to the privilege cache.
65 * @return An error code
66 * @param[in] privilegeInfo An instance of _PrivilegeInfo.
67 * @exception E_SUCCESS The method is successful.
68 * @exception E_INVALID_ARG A specified input parameter is invalid.
69 * @exception E_SYSTEM An unexpected system error occurred.
71 result AddPrivilegeInfo(const _PrivilegeInfo& privilegeInfo);
74 * Removes the specified information in the privilege cache.
77 * @return An error code
78 * @param[in] appId The application ID.
79 * @exception E_SUCCESS The method is successful.
80 * @exception E_SYSTEM An unexpected system error occurred.
82 result RemovePrivilegeInfo(const Tizen::App::AppId& appId);
85 * Gets the privilege information of the specified application.
88 * @return A _PrivilegeInfo instance
89 * @param[in] appId The application ID.
90 * @param[out] privilegeInfo An instance of _PrivilegeInfo.
91 * @exception E_SUCCESS The method is successful.
92 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
93 * @exception E_SYSTEM An unexpected system error occurred.
95 _PrivilegeInfo* GetPrivilegeInfoN(const Tizen::App::AppId& appId) const;
98 _PrivilegeCache(const _PrivilegeCache& rhs);
99 _PrivilegeCache& operator =(const _PrivilegeCache& rhs);
102 std::unique_ptr<Tizen::Base::Collection::HashMap> __pPrivilegeList;
103 static std::unique_ptr<Tizen::Base::Runtime::Mutex> __pMutex;
105 }; // _PrivilegeCache
107 }} // Tizen::Security
109 #endif // _FSEC_INTERNAL_PRIVILEGE_CACHE_H_