<def-group>
  <definition class="compliance" id="dconf_gnome_banner_enabled" version="1">
    {{{ oval_metadata("Enable the GNOME3 Login warning banner.") }}}
    <criteria operator="OR">
      <extend_definition comment="dconf installed" definition_ref="package_dconf_installed" negate="true" />
      <criteria comment="Enable GUI banner and prevent user from changing it" operator="AND">
        <extend_definition comment="dconf user profile exists" definition_ref="enable_dconf_user_profile" />
        <criterion comment="Enable GUI banner" test_ref="test_banner_gui_enabled" />
        <criterion comment="Prevent user from disabling banner" test_ref="test_prevent_user_banner_gui_enabled_change" />
      </criteria>
      {{%- if 'ubuntu' in product %}}
      <criterion comment="Enable GUI banner in /etc/gdm3/greeter.dconf-defaults" test_ref="test_banner_gui_enabled_dconf_defaults" />
      {{%- endif %}}
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="GUI banner is enabled"
  id="test_banner_gui_enabled" version="1">
    <ind:object object_ref="obj_banner_gui_enabled" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_banner_gui_enabled"
  version="1">
    <ind:path>/etc/dconf/db/{{{ dconf_gdm_dir }}}/</ind:path>
    <ind:filename operation="pattern match">^.*$</ind:filename>
    <ind:pattern operation="pattern match">^\[org/gnome/login-screen\]([^\n]*\n+)+?banner-message-enable=true$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="GUI banner cannot be changed by user"
  id="test_prevent_user_banner_gui_enabled_change" version="1">
    <ind:object object_ref="obj_prevent_user_banner_gui_enabled_change" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_prevent_user_banner_gui_enabled_change"
  version="1">
    <ind:path>/etc/dconf/db/{{{ dconf_gdm_dir }}}/locks/</ind:path>
    <ind:filename operation="pattern match">^.*$</ind:filename>
    <ind:pattern operation="pattern match">^/org/gnome/login-screen/banner-message-enable$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
      comment="GUI banner is enabled in /etc/gdm3/greeter.dconf-defaults"
  id="test_banner_gui_enabled_dconf_defaults" version="1">
    <ind:object object_ref="obj_banner_gui_enabled_dconf_defaults" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_banner_gui_enabled_dconf_defaults"
  version="1">
    <ind:filepath>/etc/gdm3/greeter.dconf-defaults</ind:filepath>
    <ind:pattern operation="pattern match">^\[org/gnome/login-screen\]([^\n]*\n+)+?banner-message-enable=true$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

</def-group>
