Apply reviewed doxygen header
[platform/framework/native/appfw.git] / inc / FSecAccessController.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file        FSecAccessController.h
19  * @brief       This is the header file for the %AccessController class.
20  *
21  * This header file contains the declarations of the %AccessController class.
22  */
23
24 #ifndef _FSEC_ACCESS_CONTROLLER_H_
25 #define _FSEC_ACCESS_CONTROLLER_H_
26
27 #include <FOspConfig.h>
28 #include <FAppTypes.h>
29
30 namespace Tizen { namespace Security
31 {
32
33 class _PrivilegeManager;
34
35 /**
36  * @class       AccessController
37  * @brief       This class provides methods to check the privilege of privileged API.
38  * @since       2.0
39  *
40  * The %AccessController class provides methods to check the privilege of privileged API.
41  */
42 class _OSP_EXPORT_ AccessController
43 {
44
45 public:
46
47         /**
48          * Checks whether the application has a privilege to invoke the privileged API.
49          *
50          * @since 2.0
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.
59          */
60         static result CheckPrivilege(int privilege);
61
62     /**
63     * Checks whether the application has a privilege to invoke the privileged API.
64     *
65     * @since 2.1
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.
74     */
75     static result CheckPrivilege(const Tizen::Base::String& privilege);
76
77
78     /**
79     * Checks whether the client application with the specified @c packageId has a privilege to invoke the privileged API.
80     *
81     * @since 2.1
82     * @privlevel   partner
83     * @privilege   %http://tizen.org/privilege/privilegemanager.read
84     *
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.
94     */
95     static result CheckPrivilege(const Tizen::App::PackageId& packageId, const Tizen::Base::String& privilege);
96
97 private:
98
99     /**
100      * This default constructor is intentionally declared as private because this class cannot be constructed.
101      */
102         AccessController(void);
103
104     /**
105      * This destructor is intentionally declared as private because this class cannot be constructed.
106      */
107         ~AccessController(void);
108
109     /**
110      * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
111      */
112         AccessController(const AccessController& rhs);
113
114     /**
115      * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
116      */
117         AccessController& operator =(const AccessController& rhs);
118
119         static void InitIpcClient(void);
120         static void Initialize(void);
121
122 private:
123         static _PrivilegeManager* __pPrivilegeManager;
124
125 };  // AccessController
126
127 }} // Tizen::Security
128
129 #endif // _FSEC_ACCESS_CONTROLLER_H_