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 a way to check the privilege of privileged API.
40 * The %AccessController class provides a way 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 blocks an application from calling the 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 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 the method.
72 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling the 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 which has @c appId has a privilege to invoke the privileged API.
82 * @return An error code
83 * @param[in] packageId The package ID
84 * @param[in] privilege A string of the specified privilege
85 * @exception E_SUCCESS The method is successful and the request is granted.
86 * @exception E_INVALID_ARG The specified @c privilege is invalid privilege string.
87 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
88 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call the method.
89 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling the method.
90 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
92 static result CheckPrivilege(const Tizen::App::PackageId& packageId, const Tizen::Base::String& privilege);
97 * This default constructor is intentionally declared as private because this class cannot be constructed.
99 AccessController(void);
102 * This destructor is intentionally declared as private because this class cannot be constructed.
104 ~AccessController(void);
107 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
109 AccessController(const AccessController& rhs);
112 * The implementation of this copy assignment operator is intentionally blank and delcared as private to prohibit copying of objects.
114 AccessController& operator =(const AccessController& rhs);
116 static void Initialize(void);
119 static _PrivilegeManager* __pPrivilegeManager;
121 }; // AccessController
123 }} // Tizen::Security
125 #endif // _FSEC_ACCESS_CONTROLLER_H_