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 FSecurity_PrivilegeCache.h
19 * @brief This is the header file for the _PrivilegeCache.
21 * This header file contains the declarations of the _PrivilegeCache.
24 #ifndef _FSEC_INTERNAL_PRIVILEGE_CACHE_H_
25 #define _FSEC_INTERNAL_PRIVILEGE_CACHE_H_
27 #include <unique_ptr.h>
28 #include <FOspConfig.h>
29 #include "FSec_AccessControlTypes.h"
31 namespace Tizen { namespace Base { namespace Runtime
36 namespace Tizen { namespace Security
42 * @class _PrivilegeCache
43 * @brief This class provides a way to access the privilege cache.
46 * This class provides a way to access the privilege cache.
50 : public Tizen::Base::Object
55 _PrivilegeCache(void);
56 virtual ~_PrivilegeCache(void);
58 result Construct(void);
61 * Adds the specified privilege information to the privilege cache.
64 * @return An error code
65 * @param[in] privilegeInfo An instance of _PrivilegeInfo.
66 * @exception E_SUCCESS The method is successful.
67 * @exception E_INVALID_ARG A specified input parameter is invalid.
68 * @exception E_SYSTEM An unexpected system error occurred.
70 result AddPrivilegeInfo(const _PrivilegeInfo& privilegeInfo);
73 * Removes the specified information in the privilege cache.
76 * @return An error code
77 * @param[in] appId The application ID.
78 * @exception E_SUCCESS The method is successful.
79 * @exception E_SYSTEM An unexpected system error occurred.
81 result RemovePrivilegeInfo(const Tizen::App::AppId& appId);
84 * Gets the privilege information of the specified application.
87 * @return A _PrivilegeInfo instance
88 * @param[in] appId The application ID.
89 * @param[out] privilegeInfo An instance of _PrivilegeInfo.
90 * @exception E_SUCCESS The method is successful.
91 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
92 * @exception E_SYSTEM An unexpected system error occurred.
94 _PrivilegeInfo* GetPrivilegeInfoN(const Tizen::App::AppId& appId) const;
97 _PrivilegeCache(const _PrivilegeCache& rhs);
98 _PrivilegeCache& operator =(const _PrivilegeCache& rhs);
101 std::unique_ptr<Tizen::Base::Collection::HashMap> __pPrivilegeList;
102 static std::unique_ptr<Tizen::Base::Runtime::Mutex> __pMutex;
104 }; // _PrivilegeCache
106 }} // Tizen::Security
108 #endif // _FSEC_INTERNAL_PRIVILEGE_CACHE_H_