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.
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.
22 * @file security_controller.h
23 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
24 * @author Ming Jin(ming79.jin@samsung.com)
26 * @brief Header file for security controller
28 #ifndef SECURITY_CONTROLLER_H
29 #define SECURITY_CONTROLLER_H
31 #include <dpl/singleton.h>
32 #include <dpl/event/controller.h>
33 #include <dpl/generic_event.h>
34 #include <dpl/scoped_ptr.h>
35 #include <dpl/type_list.h>
37 #include <ace_settings_logic.h>
38 #include <dpl/ace-dao-ro/PreferenceTypes.h>
39 #include <dpl/ace/AbstractPolicyEnforcementPoint.h>
42 #include <dpl/event/inter_context_delegate.h>
44 #include <dpl/ace-dao-ro/wrt_db_types.h>
50 namespace SecurityControllerEvents {
51 DECLARE_GENERIC_EVENT_0(InitializeSyncEvent)
52 DECLARE_GENERIC_EVENT_0(TerminateSyncEvent)
54 DECLARE_GENERIC_EVENT_2(AuthorizeWidgetInstallEvent,
56 AbstractPolicyEnforcementPoint::ResponseReceiver)
58 DECLARE_GENERIC_EVENT_2(CheckFunctionCallSyncEvent,
62 DECLARE_GENERIC_EVENT_3(SetWidgetPreferenceEvent,
63 std::string, // resource,
64 WidgetHandle, // subject
65 AceDB::PreferenceTypes) // preference
67 DECLARE_GENERIC_EVENT_2(SetResourcePreferenceEvent,
68 std::string, // resource,
69 AceDB::PreferenceTypes) // preference
71 DECLARE_GENERIC_EVENT_1(GetWidgetsPreferencesSyncEvent,
72 AceSettings::WidgetsPreferences *)
74 DECLARE_GENERIC_EVENT_1(GetResourcesPreferencesSyncEvent,
75 AceSettings::ResourcesPreferences *)
77 DECLARE_GENERIC_EVENT_0(ResetWidgetsPreferencesEvent)
78 DECLARE_GENERIC_EVENT_0(ResetResourcesPreferencesEvent)
79 } // namespace SecurityControllerEvents
81 typedef DPL::TypeListDecl<
82 SecurityControllerEvents::InitializeSyncEvent,
83 SecurityControllerEvents::TerminateSyncEvent,
84 SecurityControllerEvents::AuthorizeWidgetInstallEvent,
85 SecurityControllerEvents::CheckFunctionCallSyncEvent,
86 SecurityControllerEvents::SetWidgetPreferenceEvent,
87 SecurityControllerEvents::SetResourcePreferenceEvent,
88 SecurityControllerEvents::GetWidgetsPreferencesSyncEvent,
89 SecurityControllerEvents::GetResourcesPreferencesSyncEvent,
90 SecurityControllerEvents::ResetWidgetsPreferencesEvent,
91 SecurityControllerEvents::ResetResourcesPreferencesEvent>::Type
92 SecurityControllerEventsTypeList;
94 class SecurityController :
95 public DPL::Event::Controller<SecurityControllerEventsTypeList>
98 virtual void OnEventReceived(
99 const SecurityControllerEvents::InitializeSyncEvent &event);
100 virtual void OnEventReceived(
101 const SecurityControllerEvents::TerminateSyncEvent &event);
102 virtual void OnEventReceived(
103 const SecurityControllerEvents::AuthorizeWidgetInstallEvent &event);
104 virtual void OnEventReceived(
105 const SecurityControllerEvents::CheckFunctionCallSyncEvent &e);
106 virtual void OnEventReceived(
107 const SecurityControllerEvents::SetWidgetPreferenceEvent &event);
108 virtual void OnEventReceived(
109 const SecurityControllerEvents::SetResourcePreferenceEvent &event);
110 virtual void OnEventReceived(
111 const SecurityControllerEvents::GetWidgetsPreferencesSyncEvent &
113 virtual void OnEventReceived(
114 const SecurityControllerEvents::GetResourcesPreferencesSyncEvent &
116 virtual void OnEventReceived(
117 const SecurityControllerEvents::ResetWidgetsPreferencesEvent &evt);
118 virtual void OnEventReceived(
119 const SecurityControllerEvents::ResetResourcesPreferencesEvent &
124 DPL::ScopedPtr<Impl> m_impl;
126 SecurityController();
127 //This desctructor must be in implementation file (cannot be autogenerated)
128 ~SecurityController();
130 friend class DPL::Singleton<SecurityController>;
133 typedef DPL::Singleton<SecurityController> SecurityControllerSingleton;
135 #endif // SECURITY_CONTROLLER_H