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 FSecAccessController.h
20 * @brief This is the header file for the %AccessController class.
22 * This header file contains the declarations of the %AccessController class.
25 #ifndef _FSEC_ACCESS_CONTROLLER_H_
26 #define _FSEC_ACCESS_CONTROLLER_H_
28 #include <FOspConfig.h>
29 #include <FAppTypes.h>
31 namespace Tizen { namespace Security
34 class _PrivilegeManager;
37 * @class AccessController
38 * @brief This class provides a way to check the privilege of privileged API.
41 * The %AccessController class provides a way to check the privilege of privileged API.
43 class _OSP_EXPORT_ AccessController
49 * Checks whether the application has a privilege to invoke the privileged API.
52 * @return An error code
53 * @param[in] privilege A value of enumerator of the specified @c privilege
54 * @exception E_SUCCESS The method is successful and the request is granted.
55 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
56 * @exception E_OUT_OF_MEMORY The memory is insufficient.
57 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
58 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling the method.
59 * @exception E_SYSTEM An unexpected system error has occurred.
61 static result CheckPrivilege(int privilege);
64 * Checks whether the application has a privilege to invoke the privileged API.
67 * @return An error code
68 * @param[in] privilege A string of the specified privilege
69 * @exception E_SUCCESS The method is successful and the request is granted.
70 * @exception E_INVALID_ARG The specified @c privilege is invalid privilege string.
71 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
72 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call the method.
73 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling the method.
74 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
76 static result CheckPrivilege(const Tizen::Base::String& privilege);
80 * Checks whether the client application which has @c appId has a privilege to invoke the privileged API.
83 * @return An error code
84 * @param[in] packageId The package ID
85 * @param[in] privilege A string of the specified privilege
86 * @exception E_SUCCESS The method is successful and the request is granted.
87 * @exception E_INVALID_ARG The specified @c privilege is invalid privilege string.
88 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
89 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call the method.
90 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling the method.
91 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
93 static result CheckPrivilege(const Tizen::App::PackageId& packageId, const Tizen::Base::String& privilege);
98 * This default constructor is intentionally declared as private because this class cannot be constructed.
100 AccessController(void);
103 * This destructor is intentionally declared as private because this class cannot be constructed.
105 ~AccessController(void);
108 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
110 AccessController(const AccessController& rhs);
113 * The implementation of this copy assignment operator is intentionally blank and delcared as private to prohibit copying of objects.
115 AccessController& operator =(const AccessController& rhs);
117 static void Initialize(void);
120 static _PrivilegeManager* __pPrivilegeManager;
122 }; // AccessController
124 }} // Tizen::Security
126 #endif // _FSEC_ACCESS_CONTROLLER_H_