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 FSec_AccessController.h
20 * @brief This is the header file for the _AccessController.
21 * This header file contains the declarations of the _AccessController.
24 #ifndef _FSEC_INTERNAL_ACCESS_CONTROLLER_H_
25 #define _FSEC_INTERNAL_ACCESS_CONTROLLER_H_
27 #include <FOspConfig.h>
29 #include "FSec_AccessControlTypes.h"
31 namespace Tizen { namespace Security
34 class _PrivilegeManager;
37 * @class _AccessController
38 * @brief This class provides a way to check the privilege and visibility.
41 * This class provides a way to check the privilege and visibility.
43 class _OSP_EXPORT_ _AccessController
48 * Checks whether the application has a privilege and a visibility to invoke the API.
51 * @return An error code
52 * @param[in] packageId The package ID.
53 * @param[in] privilege A value of enumerator of the specified privilege.
54 * @exception E_SUCCESS The method is successful and 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.
58 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling the method.
59 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
61 static result CheckSystemPrivilege(const Tizen::App::PackageId& packageId, _Privilege privilege);
64 * Checks whether the application has either a privilege1 or a privilege2 and a visibility to invoke the API.
67 * @return An error code
68 * @param[in] packageId The package ID.
69 * @param[in] privilege1 A value of enumerator of the specified privilege.
70 * @param[in] privilege2 A value of enumerator of the specified privilege.
71 * @exception E_SUCCESS The method is successful and request is granted.
72 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
73 * @exception E_OUT_OF_MEMORY The memory is insufficient.
74 * @exception E_PRIVILEGE_DENIED The application does not have the privilege.
75 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling the method.
76 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
78 static result CheckSystemPrivilege(const Tizen::App::PackageId& packageId, _Privilege privilege1, _Privilege privilege2);
81 * Checks whether the application has a privilege to invoke the API.
84 * @return An error code
85 * @param[in] packageId The package ID.
86 * @param[in] privilege A string of the specified privilege.
87 * @exception E_SUCCESS The method is successful and request is granted.
88 * @exception E_INVALID_ARG The specified @c privilege is invalid privilege string.
89 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
90 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call the method.
91 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling the method.
92 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
94 static result CheckPrivilege(const Tizen::App::PackageId& packageId, const Tizen::Base::String& privilege);
98 * Checks whether the application has a privilege and a visibility to invoke the API.
101 * @return An error code
102 * @param[in] privilege A value of enumerator of the specified privilege.
103 * @exception E_SUCCESS The method is successful and request is granted.
104 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
105 * @exception E_OUT_OF_MEMORY The memory is insufficient.
106 * @exception E_PRIVILEGE_DENIED The application does not have the privilege.
107 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling the method.
108 * @exception E_SYSTEM An unexpected system error occurred.
110 static result CheckUserPrivilege(_Privilege privilege);
113 * Checks whether the application has either a privilege1 or a privilege2 and a visibility to invoke the API.
116 * @return An error code
117 * @param[in] privilege1 A value of enumerator of the specified privilege.
118 * @param[in] privilege2 A value of enumerator of the specified privilege.
119 * @exception E_SUCCESS The method is successful and request is granted.
120 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
121 * @exception E_OUT_OF_MEMORY The memory is insufficient.
122 * @exception E_PRIVILEGE_DENIED The application does not have the privilege.
123 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling the method.
124 * @exception E_SYSTEM An unexpected system error occurred.
126 static result CheckUserPrivilege(_Privilege privilege1, _Privilege privilege2);
129 * Checks whether the application has a privilege to invoke the API.
132 * @return An error code
133 * @param[in] privilege A string of the specified privilege.
134 * @exception E_SUCCESS The method is successful and request is granted.
135 * @exception E_INVALID_ARG The specified @c privilege is invalid privilege string.
136 * @exception E_DATA_NOT_FOUND The privilege information does not exist.
137 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call the method.
138 * @exception E_USER_NOT_CONSENTED The user blocks an application from calling the method.
139 * @exception E_SYSTEM The method cannot proceed due to a severe system error.
141 static result CheckPrivilege(const Tizen::Base::String& privilege);
146 _AccessController(void);
147 ~_AccessController(void);
149 _AccessController(const _AccessController& rhs);
150 _AccessController& operator =(const _AccessController& rhs);
152 static result CheckPrivacy(const Tizen::App::PackageId& packageId, _Privilege privilege);
153 static result CheckPrivacy(const Tizen::App::PackageId& packageId, const Tizen::Base::String& privilege);
155 static void Initialize(void);
157 static _PrivilegeManager* __pPrivilegeManager;
159 }; // _AccessController
161 }} // Tizen::Security
163 #endif // _FSEC_INTERNAL_ACCESS_CONTROLLER_H_