Enable or Disable Gatekeeper config which controls the Allow apps downloaded from setting.
Manually access System Preferences > Security & Privacy > General Tab
Commands
sudo spctl --master-enable
sudo spctl --master-disable
Screenshot with –master-disable