Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,12 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
bool CommandRequestImpl::CheckAllowedParameters() {
LOG4CXX_AUTO_TRACE(logger_);

// RegisterAppInterface should always be allowed
if (mobile_apis::FunctionID::RegisterAppInterfaceID ==
static_cast<mobile_apis::FunctionID::eType>(function_id())) {
// RegisterAppInterface and UnregisterAppInterface should always be allowed
using namespace helpers;
if (Compare<mobile_apis::FunctionID::eType, EQ, ONE>(
static_cast<mobile_apis::FunctionID::eType>(function_id()),
mobile_apis::FunctionID::RegisterAppInterfaceID,
mobile_apis::FunctionID::UnregisterAppInterfaceID)) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,26 @@ TEST_F(CommandRequestImplTest,
(*result)[strings::msg_params][strings::info].asString().empty());
}

TEST_F(CommandRequestImplTest, CheckPermissions_UnregisterAppInterface_True) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::function_id] =
mobile_apis::FunctionID::UnregisterAppInterfaceID;

CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);

EXPECT_TRUE(command->CheckPermissions());
}

TEST_F(CommandRequestImplTest, CheckPermissions_RegisterAppInterface_True) {
MessageSharedPtr msg = CreateMessage();
(*msg)[strings::params][strings::function_id] =
mobile_apis::FunctionID::RegisterAppInterfaceID;

CommandPtr command = CreateCommand<UCommandRequestImpl>(msg);

EXPECT_TRUE(command->CheckPermissions());
}

} // namespace command_request_impl
} // namespace commands_test
} // namespace components
Expand Down