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 FSecAccessController.h
19 * @brief This is the header file for the %AccessController class.
21 * This header file contains the declarations of the %AccessController class.
24 #ifndef _FSEC_ACCESS_CONTROLLER_H_
25 #define _FSEC_ACCESS_CONTROLLER_H_
27 #include <FOspConfig.h>
28 #include <FAppTypes.h>
30 namespace Tizen { namespace Security
33 class _PrivilegeManager;
36 * @class AccessController
37 * @brief This class provides methods to check the privilege of privileged API.
40 * The %AccessController class provides methods to check the privilege of privileged API.
42 class _OSP_EXPORT_ AccessController
48 * Checks whether the application has a privilege to invoke the privileged API.
51 * @return An error code
52 * @param[in] privilege A value of enumerator of the specified @c privilege
53 * @exception E_SUCCESS The method is successful and the request is granted.
54 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
55 * @exception E_OUT_OF_MEMORY The memory is insufficient.
56 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
57 * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
58 * @exception E_SYSTEM An unexpected system error has occurred.
60 static result CheckPrivilege(int privilege);
63 * Checks whether the application has a privilege to invoke the privileged API.
66 * @return An error code
67 * @param[in] privilege A string of the specified privilege
68 * @exception E_SUCCESS The method is successful and the request is granted.
69 * @exception E_INVALID_ARG The specified @c privilege is an invalid privilege string.
70 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
71 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
72 * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
73 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
75 static result CheckPrivilege(const Tizen::Base::String& privilege);
79 * Checks whether the client application with the specified @c packageId has a privilege to invoke the privileged API.
83 * @privilege %http://tizen.org/privilege/privilegemanager.read
85 * @return An error code
86 * @param[in] packageId The package ID
87 * @param[in] privilege A string of the specified privilege
88 * @exception E_SUCCESS The method is successful and the request is granted.
89 * @exception E_INVALID_ARG The specified @c privilege is an invalid privilege string.
90 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
91 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
92 * @exception E_USER_NOT_CONSENTED The user has blocked the application from calling this method.
93 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
95 static result CheckPrivilege(const Tizen::App::PackageId& packageId, const Tizen::Base::String& privilege);
100 * This default constructor is intentionally declared as private because this class cannot be constructed.
102 AccessController(void);
105 * This destructor is intentionally declared as private because this class cannot be constructed.
107 ~AccessController(void);
110 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
112 AccessController(const AccessController& rhs);
115 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
117 AccessController& operator =(const AccessController& rhs);
119 static void InitIpcClient(void);
120 static void Initialize(void);
123 static _PrivilegeManager* __pPrivilegeManager;
125 }; // AccessController
127 }} // Tizen::Security
129 #endif // _FSEC_ACCESS_CONTROLLER_H_