<def-group>
  <definition class="compliance" id="dconf_gnome_disable_geolocation" version="1">
    {{{ oval_metadata("Disable GNOME3 Geolocation for the clock and system.", rule_title=rule_title) }}}
    <criteria operator="OR">
      <extend_definition comment="dconf installed" definition_ref="package_dconf_installed" negate="true" />
      <criteria operator="AND">
        <extend_definition comment="dconf user profile exists" definition_ref="enable_dconf_user_profile" />
        <criterion comment="Disable system geolocation" test_ref="test_disable_sys_geolocation" />
        <criterion comment="Prevent user from changing" test_ref="test_prevent_user_sys_geolocation" />
        <criterion comment="Disable clock geolocation" test_ref="test_disable_clock_geolocation" />
        <criterion comment="Prevent user from changing" test_ref="test_prevent_user_clock_geolocation" />
      </criteria>
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="Disable system geolocation"
  id="test_disable_sys_geolocation" version="1">
    <ind:object object_ref="obj_disable_sys_geolocation" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_disable_sys_geolocation"
  version="1">
    <ind:path>/etc/dconf/db/local.d/</ind:path>
    <ind:filename operation="pattern match">^.*$</ind:filename>
    <ind:pattern operation="pattern match">^\[org/gnome/system/location\]([^\n]*\n+)+?enabled=false$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="Prevent enabling of system geolocation"
  id="test_prevent_user_sys_geolocation" version="1">
    <ind:object object_ref="obj_prevent_user_sys_geolocation" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_prevent_user_sys_geolocation"
  version="1">
    <ind:path>/etc/dconf/db/local.d/locks/</ind:path>
    <ind:filename operation="pattern match">^.*$</ind:filename>
    <ind:pattern operation="pattern match">^/org/gnome/system/location/enabled$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="Disable clock geolocation"
  id="test_disable_clock_geolocation" version="1">
    <ind:object object_ref="obj_disable_clock_geolocation" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_disable_clock_geolocation"
  version="1">
    <ind:path>/etc/dconf/db/local.d/</ind:path>
    <ind:filename operation="pattern match">^.*$</ind:filename>
    <ind:pattern operation="pattern match">^\[org/gnome/clocks\]([^\n]*\n+)+?geolocation=false$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="Prevent enabling of clock geolocation"
  id="test_prevent_user_clock_geolocation" version="1">
    <ind:object object_ref="obj_prevent_user_clock_geolocation" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_prevent_user_clock_geolocation"
  version="1">
    <ind:path>/etc/dconf/db/local.d/locks/</ind:path>
    <ind:filename operation="pattern match">^.*$</ind:filename>
    <ind:pattern operation="pattern match">^/org/gnome/clocks/geolocation$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
</def-group>
