Tizen 2.1 base
[framework/security/security-server.git] / src / services / ace / logic / security_logic.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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  * This class simply redirects the access requests to access control engine.
18  * The aim is to hide access control engine specific details from WRT modules.
19  * It also implements WRT_INTERFACE.h interfaces, so that ACE could access
20  * WRT specific and other information during the decision making.
21  *
22  * @file    security_controller.h
23  * @author  Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
24  * @author  Ming Jin(ming79.jin@samsung.com)
25  * @author  Piotr Kozbial (p.kozbial@samsung.com)
26  * @version 1.0
27  * @brief   Header file for security logic
28  */
29 #ifndef SECURITY_LOGIC_H
30 #define SECURITY_LOGIC_H
31
32 #include <ace/Request.h>
33 #include <ace/PolicyResult.h>
34 #include <ace/AbstractPolicyEnforcementPoint.h>
35 #include <ace/Preference.h>
36 #include <ace/PolicyEnforcementPoint.h>
37 #include <ace-dao-ro/PromptModel.h>
38
39 /* SecurityLogic
40  * May only be created and used by SecurityController.
41  * There may be only one instance.
42  */
43 class SecurityLogic {
44   public:
45     SecurityLogic() {}
46     ~SecurityLogic() {}
47     // initialize/terminate
48     /** */
49     void initialize();
50     /** */
51     void terminate();
52
53     /** */
54     PolicyResult checkFunctionCall(Request*);
55     PolicyResult checkFunctionCall(Request*, const std::string &session);
56
57     void validatePopupResponse(Request* request,
58                                bool allowed,
59                                Prompt::Validity validity,
60                                const std::string& sessionId,
61                                bool* retValue);
62
63     /**
64      * Updates policy and clears policy cache
65      */
66     void updatePolicy();
67
68   private:
69     PolicyEnforcementPoint m_policyEnforcementPoint;
70
71     Prompt::Validity clampPromptValidity(Prompt::Validity validity,
72                                          PolicyEffect effect);
73     void grantPlatformAccess(const Request& request);
74 };
75
76 #endif // SECURITY_CONTROLLER_H