2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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.
19 * @file AceDAOReadOnly.h
20 * @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
21 * @author Grzegorz Krawczyk (g.krawczyk@samsung.com)
26 #ifndef ACE_DAO_READ_ONLY_H_
27 #define ACE_DAO_READ_ONLY_H_
29 #include <openssl/md5.h>
30 #include <dpl/string.h>
31 #include <dpl/exception.h>
32 #include <dpl/ace-dao-ro/PreferenceTypes.h>
33 #include <dpl/ace-dao-ro/BaseAttribute.h>
34 #include <dpl/ace-dao-ro/BasePermission.h>
35 #include <dpl/ace-dao-ro/IRequest.h>
36 #include <dpl/ace/PolicyEffect.h>
37 #include <dpl/ace/PolicyResult.h>
38 #include <dpl/ace/PromptDecision.h>
39 #include <dpl/ace-dao-ro/wrt_db_types.h>
49 DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
50 DECLARE_EXCEPTION_TYPE(Base, DatabaseError)
55 static void attachToThread();
56 static void detachFromThread();
58 // policy effect/decision
59 static OptionalPolicyResult getPolicyResult(
60 const BaseAttributeSet &attributes);
62 static OptionalPolicyResult getPolicyResult(
63 const DPL::String &attrHash);
66 static OptionalCachedPromptDecision getPromptDecision(
67 const DPL::String &hash,
68 const std::string &userParam);
69 static OptionalCachedPromptDecision getPromptDecision(
70 const BaseAttributeSet &attribites,
71 const std::string &userParam);
74 static PreferenceTypes getDevCapSetting(const std::string &resource);
75 static void getDevCapSettings(PreferenceTypesMap *preferences);
78 static void getWidgetDevCapSettings(BasePermissionList *permissions);
79 static PreferenceTypes getWidgetDevCapSetting(
80 const std::string &resource,
81 WidgetHandle handler);
83 static void getAttributes(BaseAttributeSet *attributes);
85 // static dev cap permissions
87 // (For a given widget handle, a set of device caps is
88 // granted "statically", i.e. it is determined at installation
89 // time that the widget will always get (at launch) the SMACK
90 // permissions needed to use those device caps).
92 // 'permissions' is an output parameter - it must point to
93 // an existing set and the function will clear it and fill
94 // with the device cap names as described.
95 static void getStaticDevCapPermissions(
97 std::set<DPL::String> *permissions);
100 static int promptDecisionToInt(PromptDecision decision);
101 static PromptDecision intToPromptDecision(int decision);