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 * @file popup_response_dispatcher.cpp
18 * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
23 #include "popup_response_dbus_interface.h"
26 #include <dpl/dbus/dbus_server_deserialization.h>
27 #include <dpl/dbus/dbus_server_serialization.h>
28 #include <ace/Request.h>
29 #include <ace-dao-ro/PromptModel.h>
30 #include "popup_ace_data_types.h"
31 //#include "access-control/engine/PromptModel.h"
32 #include "attribute_facade.h"
33 //#include "Request.h"
34 #include "security_controller.h"
39 void PopupResponseDBusInterface::onMethodCall(const gchar* methodName,
41 GDBusMethodInvocation* invocation)
43 using namespace WrtSecurity;
45 if (0 == g_strcmp0(methodName,
46 PopupServerApi::VALIDATION_METHOD().c_str()))
50 int serializedValidity = 0;
55 if (!DPL::DBus::ServerDeserialization::deserialize(
63 &(acedata.paramValues),
64 &(acedata.sessionId)))
66 g_dbus_method_invocation_return_dbus_error(
68 "org.tizen.PopupResponse.UnknownError",
69 "Error in deserializing input parameters");
73 if (acedata.paramKeys.size() != acedata.paramValues.size()) {
74 g_dbus_method_invocation_return_dbus_error(
76 "org.tizen.PopupResponse.UnknownError",
77 "Varying sizes of parameter names and parameter values");
81 FunctionParamImpl params;
82 for (size_t i = 0; i < acedata.paramKeys.size(); ++i) {
83 params.addAttribute(acedata.paramKeys[i], acedata.paramValues[i]);
85 Request request(acedata.handle,
86 WidgetExecutionPhase_Invoke,
88 request.addDeviceCapability(acedata.resource);
90 Prompt::Validity validity = static_cast<Prompt::Validity>(serializedValidity);
92 bool response = false;
93 SecurityControllerEvents::ValidatePopupResponseEvent ev(
99 CONTROLLER_POST_SYNC_EVENT(SecurityController, ev);
101 g_dbus_method_invocation_return_value(
103 DPL::DBus::ServerSerialization::serialize(response));