President Trump’s firings of dozens of government officials have raised questions about whether those moves are legal.