<def-group>
  <definition class="compliance" id="dconf_gnome_screensaver_idle_delay" version="1">
    <metadata>
      <title>Configure the GNOME3 GUI Screen locking</title>
      <affected family="unix">
        <platform>Red Hat Enterprise Linux 7</platform>
        <platform>multi_platform_fedora</platform>
      </affected>
      <description>The allowed period of inactivity before the screensaver is activated.</description>
      <reference source="galford" ref_id="20140824" ref_url="test_attestation" />
    </metadata>
    <criteria operator="OR">
      <extend_definition comment="dconf installed" definition_ref="package_dconf_installed" negate="true" />
      <criteria comment="check screensaver idle delay and prevent user from changing it" operator="AND">
        <extend_definition comment="dconf user profile exists" definition_ref="enable_dconf_user_profile" />
        <criterion comment="idle delay has been configured" test_ref="test_screensaver_idle_delay" />
        <criterion comment="prevent user from changing idle delay" test_ref="test_prevent_user_change_idle_delay" />
        <criterion comment="idle delay is set correctly" test_ref="test_screensaver_idle_delay_setting" />
      </criteria>
    </criteria>
  </definition>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="screensaver idle delay is configured"
  id="test_screensaver_idle_delay" version="1">
    <ind:object object_ref="obj_screensaver_idle_delay" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_screensaver_idle_delay"
  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/desktop/session]([^\n]*\n+)+?idle-delay=[0-9]*$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
  comment="user cannot change screensaver idle delay"
  id="test_prevent_user_change_idle_delay" version="1">
    <ind:object object_ref="obj_prevent_user_change_idle_delay" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_prevent_user_change_idle_delay"
  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/desktop/session/idle-delay$</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_test check="all" check_existence="all_exist"
           comment="screensaver idle delay setting is correct"
  id="test_screensaver_idle_delay_setting" version="1">
    <ind:object object_ref="obj_screensaver_idle_delay_setting" />
    <ind:state state_ref="state_screensaver_idle_delay_setting" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_screensaver_idle_delay_setting"
  version="1"> 
    <ind:path>/etc/dconf/db/local.d/</ind:path>
    <ind:filename operation="pattern match">^.*$</ind:filename>
    <ind:pattern operation="pattern match">^idle-delay[\s=]*([^=\s]*)</ind:pattern>
    <ind:instance datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>

  <ind:textfilecontent54_state id="state_screensaver_idle_delay_setting" version="1">
    <ind:subexpression operation="equals" var_check="all" var_ref="inactivity_timeout_value" />
  </ind:textfilecontent54_state>

  <external_variable comment="inactivity timeout variable" datatype="string"
  id="inactivity_timeout_value" version="1" />
</def-group>
