tizen 2.3.1 release
[framework/web/wearable/wrt-security.git] / ace / include / ace-dao-rw / AceDAO.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  *
18  *
19  * @file       AceDAO.h
20  * @author     Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
21  * @version    0.1
22  * @brief
23  */
24
25 #ifndef ACEDAO_H_
26 #define ACEDAO_H_
27
28 #include <list>
29 #include <map>
30 #include <string>
31
32 #include <dpl/optional_typedefs.h>
33 #include <dpl/string.h>
34 #include <ace-dao-ro/AceDAOReadOnly.h>
35 #include <ace-dao-ro/ValidityTypes.h>
36 #include <ace-dao-ro/AppTypes.h>
37
38 namespace AceDB {
39 /*
40  *
41  */
42 class AceDAO : public AceDAOReadOnly
43 {
44   public:
45
46     AceDAO() {}
47
48     // Policy Decisions
49     static void setPolicyResult(
50             const BaseAttributeSet &attributes,
51             const ExtendedPolicyResult &policyResult);
52
53     static void removePolicyResult(
54             const BaseAttributeSet &attributes);
55
56     // PromptDecision
57     static void setPromptDecision(
58             WidgetHandle widgetHandle,
59             int ruleId,
60             const boost::optional<DPL::String> &session,
61             PromptDecision decision);
62
63     static void clearPromptDecisions(void);
64
65     // reseting database
66     static void clearWidgetDevCapSettings(void);
67     static void clearDevCapSettings(void);
68     static void clearAllSettings(void);
69     static void resetDatabase(void);
70     // clears all databse information relevant to policy cache
71     static void clearPolicyCache(void);
72
73     // resource settings
74     static void setDevCapSetting(const std::string &resource,
75             PreferenceTypes preference);
76     static void removeDevCapSetting(const std::string &resource);
77
78     // user settings
79     static void setWidgetDevCapSetting(
80             const std::string &resource,
81             WidgetHandle handler,
82             PreferenceTypes);
83     static void removeWidgetDevCapSetting(
84             const std::string &resource,
85             WidgetHandle handler);
86
87     // resource and subject management
88     static int addResource(const std::string &request);
89
90     // utilities
91     static void addAttributes(const BaseAttributeSet &attributes);
92
93     // Setter for device capabilities that are requested in widgets config.
94     //
95     // Additional boolean flag means whether widget will always get
96     // (at launch) the SMACK permissions needed to use the device cap).
97     //
98     // 'permissions' is the map of device cap names and smack status for
99     // given widget handle.
100     static void setRequestedDevCaps(
101         WidgetHandle widgetHandle,
102         const RequestedDevCapsMap &permissions);
103
104     static void removeRequestedDevCaps(
105         WidgetHandle widgetHandle);
106
107     static void setAcceptedFeature(
108         WidgetHandle widgetHandle,
109         const FeatureNameVector &vector);
110
111     static void removeAcceptedFeature(WidgetHandle widgetHandle);
112
113     static void registerWidgetInfo(WidgetHandle handle,
114                                    const WidgetRegisterInfo& info,
115                                    const WidgetCertificateDataList& dataList);
116     static void unregisterWidgetInfo(WidgetHandle handle);
117
118 };
119 }
120 #endif /* ACEDAO_H_ */