DPL::TaskDecl<TaskAceCheck>(this),
m_context(context)
{
+ AddStep(&TaskAceCheck::StartStep);
AddStep(&TaskAceCheck::StepPrepareForAce);
AddStep(&TaskAceCheck::StepAceCheck);
AddStep(&TaskAceCheck::StepProcessAceResponse);
AddStep(&TaskAceCheck::StepCheckAceResponse);
+ AddStep(&TaskAceCheck::EndStep);
}
void TaskAceCheck::StepPrepareForAce()
void TaskAceCheck::StepAceCheck()
{
WrtDB::WidgetDAO dao(m_context.widgetConfig.tzAppid);
- LogInfo("StepAceCheck!");
+ LogDebug("StepAceCheck!");
// This widget does not use any device cap
if (m_context.featureLogic->isDone()) {
return;
}
- LogInfo("StepAceCheck!");
+ LogDebug("StepAceCheck!");
DPL::String deviceCap = m_context.featureLogic->getDevice();
- LogInfo("StepAceCheck!");
- LogInfo("DevCap is : " << deviceCap);
+ LogDebug("StepAceCheck!");
+ LogDebug("DevCap is : " << deviceCap);
std::string devCapStr = DPL::ToUTF8String(deviceCap);
ace_policy_result_t policyResult = ACE_DENY;
//TODO: remove dao.getHandle()
- ace_return_t ret = ace_get_policy_result(
- const_cast<const ace_resource_t>(devCapStr.c_str()),
- dao.getHandle(),
- &policyResult);
- if (ACE_OK != ret) {
- ThrowMsg(Exceptions::AceCheckFailed, "Instalation failure. "
- "ACE check failure");
+ if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD) {
+ LogDebug("This widget is prealoaded. So ace check will be skiped");
+ policyResult = ACE_PERMIT;
+ } else {
+ ace_return_t ret = ace_get_policy_result(
+ const_cast<const ace_resource_t>(devCapStr.c_str()),
+ dao.getHandle(),
+ &policyResult);
+ if (ACE_OK != ret) {
+ ThrowMsg(Exceptions::AceCheckFailed, "Instalation failure. "
+ "ACE check failure");
+ }
}
- LogInfo("PolicyResult is : " << static_cast<int>(policyResult));
+ LogDebug("PolicyResult is : " << static_cast<int>(policyResult));
m_context.staticPermittedDevCaps.insert(std::make_pair(deviceCap,
policyResult ==
ACE_PERMIT));
return;
}
- LogInfo("StepProcessAceResponse");
+ LogDebug("StepProcessAceResponse");
m_context.featureLogic->next();
// No device caps left to process
if (m_context.featureLogic->isDone()) {
- LogInfo("All responses has been received from ACE.");
+ LogDebug("All responses has been received from ACE.");
// Data to convert to C API
std::vector<std::string> devCaps;
std::vector<bool> devCapsSmack;
// Saving static dev cap permissions
FOREACH(cap, m_context.staticPermittedDevCaps) {
- LogInfo("staticPermittedDevCaps : " << cap->first
+ LogDebug("staticPermittedDevCaps : " << cap->first
<< " smack: " << cap->second);
std::string devCapStr = DPL::ToUTF8String(cap->first);
devCaps.push_back(devCapStr);
return;
}
- LogInfo("Next device cap.");
+ LogDebug("Next device cap.");
// Process next device cap
SwitchToStep(&TaskAceCheck::StepAceCheck);
}
void TaskAceCheck::StepCheckAceResponse()
{
- LogInfo("Checking ACE response");
+ LogDebug("Checking ACE response");
if (m_context.featureLogic->isRejected()) {
LogError("Installation failure. Some devCap was not accepted by ACE.");
ThrowMsg(
- Exceptions::AceCheckFailed,
+ Exceptions::PrivilegeLevelViolation,
"Instalation failure. "
"Some deviceCap was not accepted by ACE.");
}
- LogInfo("Updating \"feature reject status\" in database!");
+ LogDebug("Updating \"feature reject status\" in database!");
auto it = m_context.featureLogic->resultBegin();
auto end = m_context.featureLogic->resultEnd();
for (; it != end; ++it) {
- LogInfo(
+ LogDebug(
" |- Feature: " << it->name << " has reject status: " <<
it->rejected);
if (it->rejected) {
dao.updateFeatureRejectStatus(*it);
}
}
- LogInfo("Installation continues...");
+ LogDebug("Installation continues...");
+}
+void TaskAceCheck::StartStep()
+{
+ LogDebug("--------- <TaskAceCheck> : START ----------");
+}
+
+void TaskAceCheck::EndStep()
+{
m_context.job->UpdateProgress(
InstallerContext::INSTALL_ACE_CHECK,
"Widget Access Control Check Finished");
+
+ LogDebug("--------- <TaskAceCheck> : END ----------");
}
} //namespace WidgetInstall
} //namespace Jobs