<?xml version="1.0"?>
<?xml-stylesheet href="docbook.xsl" type="text/xsl" ?>
<book xmlns="http://docbook.org/ns/docbook" version="5.0">
  <info>
    <title>Access Rules Service Specification</title>
    <titleabbrev>AccessRules</titleabbrev>
    <releaseinfo>19.06</releaseinfo>
    <author>
      <orgname>ONVIF™</orgname>
      <uri>www.onvif.org</uri>
    </author>
    <pubdate>June 2019</pubdate>
    <mediaobject>
      <imageobject>
        <imagedata fileref="media/logo.png" contentwidth="60mm"/>
      </imageobject>
    </mediaobject>
    <copyright>
      <year>2008-2020</year>
      <holder>ONVIF™ All rights reserved.</holder>
    </copyright>
    <legalnotice>
      <para>Recipients of this document may copy, distribute, publish, or display this document so long as this copyright notice, license and disclaimer are retained with all copies of the document. No license is granted to modify this document.</para>
      <para>THIS DOCUMENT IS PROVIDED "AS IS," AND THE CORPORATION AND ITS MEMBERS AND THEIR AFFILIATES, MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THIS DOCUMENT ARE SUITABLE FOR ANY PURPOSE; OR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</para>
      <para>IN NO EVENT WILL THE CORPORATION OR ITS MEMBERS OR THEIR AFFILIATES BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THIS DOCUMENT, WHETHER OR NOT (1) THE CORPORATION, MEMBERS OR THEIR AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR (2) SUCH DAMAGES WERE REASONABLY FORESEEABLE, AND ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THIS DOCUMENT.  THE FOREGOING DISCLAIMER AND LIMITATION ON LIABILITY DO NOT APPLY TO, INVALIDATE, OR LIMIT REPRESENTATIONS AND WARRANTIES MADE BY THE MEMBERS AND THEIR RESPECTIVE AFFILIATES TO THE CORPORATION AND OTHER MEMBERS IN CERTAIN WRITTEN POLICIES OF THE CORPORATION.</para>
    </legalnotice>
    <revhistory>
      <revision>
        <revnumber>1.0</revnumber>
        <date>Jun-2015</date>
        <author>
          <personname>PACS WG</personname>
        </author>
        <revremark>First release</revremark>
      </revision>
      <revision>
        <revnumber>18.06</revnumber>
        <date>Jun-2018</date>
        <author>
          <personname>Patrik Björling Rygert</personname>
        </author>
        <revremark>Added support for client-supplied tokens</revremark>
      </revision>
      <revision>
        <revnumber>19.06</revnumber>
        <date>Jun-2019</date>
        <author>
          <personname>Patrik Björling Rygert</personname>
        </author>
        <revremark>Change Request 2482</revremark>
      </revision>
    </revhistory>
  </info>
  <preface>
    <title>Contributors</title>
    <informaltable>
      <tgroup cols="2">
        <colspec colname="c1" colwidth="54*"/>
        <colspec colname="c2" colwidth="46*"/>
        <tbody valign="top">
          <row>
            <entry valign="bottom">
              <para>ASSA ABLOY</para>
            </entry>
            <entry valign="bottom">
              <para>Patrik Björling Rygert</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>ASSA ABLOY</para>
            </entry>
            <entry valign="bottom">
              <para>Mattias Rengstedt</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Axis Communications AB </para>
            </entry>
            <entry valign="bottom">
              <para>Marcus Johansson</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Axis Communications AB </para>
            </entry>
            <entry valign="bottom">
              <para>Robert Rosengren</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Axis Communications AB</para>
            </entry>
            <entry valign="bottom">
              <para>Derek Wang</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Axis Communications AB</para>
            </entry>
            <entry valign="bottom">
              <para>Emil Selinder</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Bosch</para>
            </entry>
            <entry valign="bottom">
              <para>Mohane Caliaperoumal</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Bosch</para>
            </entry>
            <entry valign="bottom">
              <para>Dirk Schreiber</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Honeywell</para>
            </entry>
            <entry valign="bottom">
              <para>Uvaraj Thangarajan</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Honeywell</para>
            </entry>
            <entry valign="bottom">
              <para>Neelendra Bhandari</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Honeywell</para>
            </entry>
            <entry valign="bottom">
              <para>Mayur Salgar</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Honeywell</para>
            </entry>
            <entry valign="bottom">
              <para>Vinay Ghule</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>PACOM</para>
            </entry>
            <entry valign="bottom">
              <para>Eugene Scully</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Siemens AG</para>
            </entry>
            <entry valign="bottom">
              <para>Lokeshwar K</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Siemens AG</para>
            </entry>
            <entry valign="bottom">
              <para>Suresh Raman</para>
            </entry>
          </row>
          <row>
            <entry valign="bottom">
              <para>Siemens AG</para>
            </entry>
            <entry valign="bottom">
              <para>Suresh Krishnamurthy</para>
            </entry>
          </row>
        </tbody>
      </tgroup>
    </informaltable>
  </preface>
  <chapter>
    <title>Scope</title>
    <section>
      <title>General</title>
      <para>This specification defines the web service interface for integration with physical access control systems. This includes discovering components and support of the configuration of the access rules components.</para>
      <para>The access rules service specification, which constitutes the access profiles and policies. The access rules service provides the access authorization for a credential.</para>
      <para>Supplementary dedicated services such as credential services and schedule services will be defined in separate documents.</para>
      <para>Web service usage and common ONVIF functionality are outside the scope of this document. Please refer to [Core Specification] for more information.</para>
    </section>
    <section>
      <title>Conventions</title>
      <para>The key words “shall”, “shall not”, “should”, “should not”, “may”, “need not”, “can”, “cannot” in this specification are to be interpreted as described in Annex H of [ISO/IEC Directives].</para>
    </section>
    <section>
      <title>Namespaces</title>
      <para>This document references the following namespaces:</para>
      <table>
        <title>– Referenced namespaces (with prefix)</title>
        <tgroup cols="2">
          <colspec colname="c1" colwidth="13*"/>
          <colspec colname="c2" colwidth="87*"/>
          <thead>
            <row>
              <entry>
                <para>Prefix</para>
              </entry>
              <entry>
                <para>Namespace URI</para>
              </entry>
            </row>
          </thead>
          <tbody valign="top">
            <row>
              <entry>
                <para>env</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.w3.org/2003/05/soap-envelope">http://www.w3.org/2003/05/soap-envelope</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>ter</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/ver10/error">http://www.onvif.org/ver10/error</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>xs </para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>tt</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/ver10/schema">http://www.onvif.org/ver10/schema</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>pt</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/ver10/pacs">http://www.onvif.org/ver10/pacs</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>tns1</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/ver10/topics">http://www.onvif.org/ver10/topics</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>tac</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/ver10/accesscontrol/wsdl">http://www.onvif.org/ver10/accesscontrol/wsdl</link>
                </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>tar</para>
              </entry>
              <entry>
                <para>
                  <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/ver10/accessrules/wsdl">http://www.onvif.org/ver10/accessrules/wsdl</link>
                </para>
              </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
    </section>
  </chapter>
  <chapter>
    <title>Normative references</title>
    <para>The following documents, in whole or in part, are normatively referenced in this document and are indispensable for its application. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</para>
    <para role="reference">ONVIF Core Specification </para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/specs/core/ONVIF-Core-Specification.pdf"/>&gt;</para>
    <para role="reference">ONVIF PACS Architecture and Design Considerations</para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.onvif.org/specs/wp/ONVIF-PACS-Architecture-and-Design-Considerations.pdf"/>&gt;</para>
    <para role="reference">ONVIF Access Control Service Specification</para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/specs/srv/access/ONVIF-AccessControl-Service-Spec.pdf"/>&gt;</para>
    <para role="reference">ONVIF Schedule Service Specification</para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.onvif.org/specs/srv/sched/ONVIF-Scheduler-Service-Spec.pdf"/>&gt;</para>
    <para role="reference">ISO/IEC Directives, ISO/IEC Directives Part 2, Principles and
        rules for the structure and drafting of ISO and IEC documents, Edition 7.0, May
        2016
    </para>
    <para role="reference">&lt;<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.iec.ch/members_experts/refdocs/iec/isoiecdir-2%7Bed7.0%7Den.pdf"/>&gt;</para>
  </chapter>
  <chapter>
    <title>Terms, definitions and abbreviations</title>
    <section>
      <title>Terms and definitions</title>
      <para>For the purposes of this document, the following terms and definitions apply.</para>
      <informaltable>
        <tgroup cols="2">
          <colspec colname="c1" colwidth="22*"/>
          <colspec colname="c2" colwidth="78*"/>
          <tbody valign="top">
            <row>
              <entry>
                <para>
                  <emphasis role="bold">Access Policy</emphasis>
                </para>
              </entry>
              <entry>
                <para>An association of an access point and a schedule. An access policy defines when an access point can be accessed using an access profile which contains this access policy.</para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="bold">Access Profile</emphasis>
                </para>
              </entry>
              <entry>
                <para>A collection of access policies, used to define role based access.</para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="bold">Access Point</emphasis>
                </para>
              </entry>
              <entry>
                <para>A logical composition of a physical door, reader(s) and/or a request-to-exit device controlling access in one direction.</para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="bold">Credential</emphasis>
                </para>
              </entry>
              <entry>
                <para>A logical object holding related credential identifiers for a credential holder. E.g. if a PIN is associated with a specific credential number, then both of these identifiers are stored in one credential. Note that the PIN is normally not stored in the physical credential.</para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="bold">Validity Period</emphasis>
                </para>
              </entry>
              <entry>
                <para>From a certain point in time, to a later point in time. </para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="bold">Schedule</emphasis>
                </para>
              </entry>
              <entry>
                <para>A set of time periods, e.g. working hours (weekdays from 8 AM to 6 PM). It may also include one or more special days schedules.</para>
              </entry>
            </row>
            <row>
              <entry>
                <para>
                  <emphasis role="bold">Special Days</emphasis>
                </para>
              </entry>
              <entry>
                <para>A set of dates that require the regular Schedule to be overridden, e.g. holidays, half-days or working Sundays.</para>
              </entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>
    </section>
    <section>
      <title>Abbreviations</title>
      <informaltable>
        <tgroup cols="2">
          <colspec colname="c1" colwidth="22*"/>
          <colspec colname="c2" colwidth="78*"/>
          <tbody valign="top">
            <row>
              <entry>
                <para>
                  <emphasis role="bold">PACS</emphasis>
                </para>
              </entry>
              <entry valign="middle">
                <para>Physical Access Control System</para>
              </entry>
            </row>
          </tbody>
        </tgroup>
      </informaltable>
    </section>
  </chapter>
  <chapter>
    <title>Overview</title>
    <para>The access rules service defines the access profile and its access policies. The credentials are associated to an access profiles for access authorization to a facility.</para>
    <para>The access rules service defines WHEN and WHERE credentials have access. Each credential is associated with access profiles, where each access profile defines the access for a group of people. For example, employees will have access to office doors during office hours. Another example is access to an apartment by one family during all hours. Each access profile consists of a number of access policies, where each access policy defines when access is possible to an access point.</para>
    <para>The service is flexible in such a way that it is possible to give access to something else than an access point (by setting EntityType to a QName other than AccessPointInfo). </para>
    <para>The following picture shows the main data structures involved in the access rules service:</para>
    <figure>
      <title>Main data structures in the access rules service</title>
      <mediaobject>
        <imageobject>
          <imagedata fileref="media/AccessRules/image2.svg" contentwidth="105.24mm" contentdepth="71.13mm"/>
        </imageobject>
      </mediaobject>
    </figure>
  </chapter>
  <chapter>
    <title>Access rules</title>
    <section>
      <title>General</title>
      <para>The access rules service specification provides functionality for managing access authorization for an individual or a group of individuals. The service offers commands to manage the access rules and also determine WHEN and WHERE access is granted or denied. </para>
    </section>
    <section>
      <title>Service capabilities</title>
      <section>
        <title>General</title>
        <para>An ONVIF compliant device shall provide service capabilities in two ways:</para>
        <orderedlist>
          <listitem>
            <para>With the GetServices method of Device service when IncludeCapability is true. Please refer to the ONVIF Core Specification for more details.</para>
          </listitem>
          <listitem>
            <para>With the GetServiceCapabilities method.</para>
          </listitem>
        </orderedlist>
      </section>
      <section>
        <title>Data structures</title>
        <section>
          <title>ServiceCapabilities</title>
          <para>The service capabilities reflect optional functionality of a service. The information is static and does not change during device operation. The following capabilities are available:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">MaxLimit</emphasis>
              </para>
              <para>The maximum number of entries returned <phrase>by a single Get&lt;Entity&gt;List or Get&lt;Entity&gt; request</phrase>. The device shall never return more than this number of entities in a single response.</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="bold">MaxAccessProfiles</emphasis>
              </para>
              <para>Indicates the maximum number of access profiles supported by the device.</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="bold">MaxAccessPoliciesPerAccessProfile</emphasis>
              </para>
              <para>Indicates the maximum number of access policies per access profile supported by the device.</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="bold">MultipleSchedulesPerAccessPointSupported</emphasis>
              </para>
              <para>Indicates whether or not several access policies can refer to the same access point in an access profile.</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="bold">ClientSuppliedTokenSupported</emphasis>
              </para>
              <para>Indicates that the client is allowed to supply the token when creating access profiles. To enable the use of the command SetAccessProfile, the value must be set to true.</para>
            </listitem>
          </itemizedlist>
        </section>
      </section>
      <section>
        <title>GetServiceCapabilities command</title>
        <para>This operation returns the capabilities of the access rules service.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="text">This is an empty message.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">
                <phrase>Capabilities [</phrase>tar<phrase>:</phrase>ServiceCapabilities<phrase>]</phrase></para>
              <para role="text">List of capabilities as defined above.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="text">None</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">PRE_AUTH</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
    </section>
    <section>
      <title>Access Profile Information</title>
      <section>
        <title>General</title>
        <para>Access profiles define who can access what and when.</para>
      </section>
      <section>
        <title>Data Structures</title>
        <section>
          <title>AccessProfileInfo</title>
          <para>The AccessProfileInfo structure contains basic information about an access profile. The device shall provide the following fields for each access profile instance.</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">token</emphasis>
              </para>
              <para>A service unique identifier of the access profile.</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="bold">Name</emphasis>
              </para>
              <para>A user readable name. It shall be up to 64 characters.</para>
            </listitem>
          </itemizedlist>
          <para>To provide more information, the device may include the following optional fields:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">Description</emphasis>
              </para>
              <para>User readable description for the access profile. It shall be up to 1024 characters.</para>
            </listitem>
          </itemizedlist>
        </section>
        <section>
          <title>AccessProfile</title>
          <para>The AccessProfile structure contains information about the collection of access policies. The device shall include all properties of the AccessProfileInfo structure and also a list of access policies.</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">AccessPolicy</emphasis>
              </para>
              <para>A list of access policy structures, where each access policy defines during which schedule an access point can be accessed.</para>
            </listitem>
          </itemizedlist>
        </section>
        <section>
          <title>AccessPolicy</title>
          <para>The access policy is an association of an access point and a schedule. It defines when an access point can be accessed using an access profile which contains this access policy. If an access profile contains several access policies specifying different schedules for the same access point will result in a union of the schedules.</para>
          <para>The device shall provide the following fields for each access policy instance.</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">ScheduleToken</emphasis>
              </para>
              <para>Reference to the schedule used by the access policy. Schedules are defined in [ONVIF Schedule Service Specification].</para>
            </listitem>
            <listitem>
              <para>
                <emphasis role="bold">Entity</emphasis>
              </para>
              <para>Reference to the entity used by the rule engine, the entity type may be specified by the optional EntityType field explained below but is typically an access point.</para>
            </listitem>
          </itemizedlist>
          <para>To provide more information, the device may include the following optional field:</para>
          <itemizedlist>
            <listitem>
              <para>
                <emphasis role="bold">EntityType</emphasis>
              </para>
              <para>Optional entity type; if missing, an access point type as defined in [ONVIF Access Control Service Specification] should be assumed. This can also be represented by the QName value “tac:AccessPoint” where tac is the namespace of [ONVIF Access Control Service Specification]. This field is provided for future extensions; it will allow an access policy being extended to cover entity types other than access points as well.</para>
            </listitem>
          </itemizedlist>
        </section>
      </section>
      <section>
        <title>GetAccessProfileInfo command</title>
        <para>This operation requests a list of AccessProfileInfo items matching the given tokens.</para>
        <para>The device shall ignore tokens it cannot resolve and shall return an empty list if there are no items matching the specified tokens. The device shall not return a fault in this case.</para>
        <para>If the number of requested items is greater than MaxLimit, a TooManyItems fault shall be returned.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Token<phrase> – unbounded [</phrase>pt:ReferenceToken<phrase>]</phrase></para>
              <para role="text">Tokens of AccessProfileInfo items to get.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">AccessProfileInfo<phrase> – optional, unbounded [</phrase>tar:AccessProfileInfo<phrase>]</phrase></para>
              <para role="text">List of AccessProfileInfo items.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">
                <phrase>env:</phrase>Sender<phrase> – ter:</phrase>InvalidArgs<phrase> – ter:</phrase>TooManyItems</para>
              <para role="text">Too many items were requested, see MaxLimit capability.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>GetAccessProfileInfoList command</title>
        <para>This operation requests a list of all AccessProfileInfo items provided by the device.</para>
        <para>A call to this method shall return a StartReference when not all data is returned and more data is available. The reference shall be valid for retrieving the next set of data. Please refer to section 4.8.3 in [ONVIF PACS Architecture and Design Considerations] for more details.</para>
        <para>The number of items returned shall not be greater than the Limit parameter.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Limit<phrase> – optional [</phrase>xs:int<phrase>]</phrase></para>
              <para role="text">Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device.</para>
              <para role="param">StartReference <phrase>– optional [</phrase>xs:string<phrase>]</phrase></para>
              <para role="text">Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">NextStartReference <phrase>– optional [</phrase>xs:string<phrase>]</phrase></para>
              <para role="text">StartReference to use in next call to get the following items. If absent, no more items to get.</para>
              <para role="param">AccessProfileInfo <phrase>– optional, unbounded [</phrase>tar:AccessProfileInfo<phrase>]</phrase></para>
              <para role="text">List of AccessProfileInfo items.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender – ter:InvalidArgVal – ter:InvalidStartReference</para>
              <para role="text">StartReference is invalid or has timed out. Client needs to start fetching from the beginning.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>GetAccessProfiles command</title>
        <para>This operation <phrase>requests a list of </phrase>AccessProfile items matching the given tokens. </para>
        <para>The device shall ignore tokens it cannot resolve and shall return an empty list if there are no items matching the specified tokens. The device shall not return a fault in this case.</para>
        <para>If the number of requested items is greater than MaxLimit, a TooManyItems fault shall be returned.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Token<phrase> – unbounded [</phrase>pt:ReferenceToken<phrase>]</phrase></para>
              <para role="text">Tokens of AccessProfile items to get.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">AccessProfile <phrase>– optional, unbounded [</phrase>tar:AccessProfile<phrase>]</phrase></para>
              <para role="text">List of AccessProfile items.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">
                <phrase>env:</phrase>Sender<phrase> – ter:</phrase>InvalidArgs<phrase> – ter:</phrase>TooManyItems</para>
              <para role="text">Too many items were requested, see MaxLimit capability.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>GetAccessProfileList command</title>
        <para>This operation requests a list of all AccessProfile items provided by the device. </para>
        <para>A call to this method shall return a StartReference when not all data is returned and more data is available. The reference shall be valid for retrieving the next set of data. Please refer to section 4.8.3 in [ONVIF PACS Architecture and Design Considerations] for more details.</para>
        <para>The number of items returned shall not be greater than the Limit parameter.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Limit<phrase> – optional [</phrase>xs:int<phrase>]</phrase></para>
              <para role="text">Maximum number of entries to return. If not specified, less than one or higher than what the device supports, the number of items is determined by the device.</para>
              <para role="param">StartReference <phrase>– optional [</phrase>xs:string<phrase>]</phrase></para>
              <para role="text">Start returning entries from this start reference. If not specified, entries shall start from the beginning of the dataset.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">NextStartReference <phrase>– optional [</phrase>xs:string<phrase>]</phrase></para>
              <para role="text">StartReference to use in next call to get the following items. If absent, no more items to get.</para>
              <para role="param">AccessProfile <phrase>– optional, unbounded [</phrase>tar:AccessProfile<phrase>]</phrase></para>
              <para role="text">List of AccessProfile items.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender – ter:InvalidArgVal – ter:InvalidStartReference</para>
              <para role="text">StartReference is invalid or has timed out. Client needs to start fetching from the beginning.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">READ_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>CreateAccessProfile command</title>
        <para>This operation creates the specified access profile in the device. </para>
        <para>The token field of the AccessProfile structure shall be empty and the device shall allocate a token for the access profile. The allocated token shall be returned in the response. </para>
        <para>If the client sends any value in the token field, the device shall return InvalidArgVal as a generic fault code.</para>
        <para>If several access policies in one access profile are specifying different schedules for the same access point, then it will result in a union of the schedules. </para>
        <para><xref linkend="_Ref410131520"/> shows an example of several schedules used at one access point.
          Each row in the table below corresponds to one access policy. The first and second line
          are two access policies using different schedules for the same access point.</para>
        <table xml:id="_Ref410131520">
          <title>Multiple schedules per access point</title>
          <tgroup cols="7">
            <colspec colname="c1" colwidth="1*" align="center"/>
            <colspec colname="c2" colwidth="1*" align="center"/>
            <colspec colname="c3" colwidth="1*" align="center"/>
            <colspec colname="c4" colwidth="1*" align="center"/>
            <colspec colname="c5" colwidth="1*" align="center"/>
            <colspec colname="c6" colwidth="1.7*" align="center"/>
            <colspec colname="c7" colwidth="1.38*" align="center"/>
            <thead>
              <row>
                <entry namest="c1" nameend="c5">
                  <para>Time periods of the individual schedule</para>
                </entry>
                <entry namest="c6" nameend="c7" align="center">
                  <para>Access Policies</para>
                </entry>
              </row>
            </thead>
            <tbody valign="top">
              <row>
                <entry>
                  <para>08:00-09:00</para>
                </entry>
                <entry>
                  <para>09:00-10:00</para>
                </entry>
                <entry>
                  <para>10:00-11:00</para>
                </entry>
                <entry>
                  <para>11:00-12:00</para>
                </entry>
                <entry>
                  <para>12:00-13:00</para>
                </entry>
                <entry>
                  <para>
                    <emphasis role="bold">Schedule</emphasis>
                  </para>
                </entry>
                <entry>
                  <para>
                    <emphasis role="bold">Access Point</emphasis>
                  </para>
                </entry>
              </row>
              <row>
                <entry/>
                <entry/>
                <entry/>
                <entry/>
                <entry/>
                <entry>
                  <para>Schedule 1</para>
                </entry>
                <entry>
                  <para>Room A Entry</para>
                </entry>
              </row>
              <row>
                <entry/>
                <entry/>
                <entry/>
                <entry/>
                <entry/>
                <entry>
                  <para>Schedule 2</para>
                </entry>
                <entry>
                  <para>Room A Entry</para>
                </entry>
              </row>
              <row>
                <entry/>
                <entry/>
                <entry/>
                <entry/>
                <entry/>
                <entry>
                  <para>Schedule 1</para>
                </entry>
                <entry>
                  <para>Room B Entry</para>
                </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <para>Since both Schedule 1 and Schedule 2 define when Room A Entry can be accessed, a
          credential holder will experience a union of Schedule 1 and Schedule 2, as seen in the
          first row of <xref linkend="_Ref409688635"/>. </para>
        <table xml:id="_Ref409688635">
          <title>Result of schedule union</title>
          <tgroup cols="7">
            <colspec colname="c1" colwidth="1*" align="center"/>
            <colspec colname="c2" colwidth="1*" align="center"/>
            <colspec colname="c3" colwidth="1*" align="center"/>
            <colspec colname="c4" colwidth="1*" align="center"/>
            <colspec colname="c5" colwidth="1*" align="center"/>
            <colspec colname="c6" colwidth="1.7*" align="center"/>
            <colspec colname="c7" colwidth="1.38*" align="center"/>
            <thead>
              <row>
                <entry namest="c1" nameend="c5">
                  <para>Time periods of the schedule union</para>
                </entry>
                <entry namest="c6" nameend="c7" align="center">
                  <para>Access Policies</para>
                </entry>
              </row>
            </thead>
            <tbody valign="top">
              <row>
                <entry>
                  <para>08:00-09:00</para>
                </entry>
                <entry>
                  <para>09:00-10:00</para>
                </entry>
                <entry>
                  <para>10:00-11:00</para>
                </entry>
                <entry>
                  <para>11:00-12:00</para>
                </entry>
                <entry>
                  <para>12:00-13:00</para>
                </entry>
                <entry>
                  <para>
                    <emphasis role="bold">Schedule</emphasis>
                  </para>
                </entry>
                <entry>
                  <para>
                    <emphasis role="bold">Access Point</emphasis>
                  </para>
                </entry>
              </row>
              <row>
                <entry/>
                <entry/>
                <entry/>
                <entry/>
                <entry/>
                <entry>
                  <para>Schedule 1 union Schedule 2</para>
                </entry>
                <entry>
                  <para>Room A Entry</para>
                </entry>
              </row>
              <row>
                <entry/>
                <entry/>
                <entry/>
                <entry/>
                <entry/>
                <entry>
                  <para>Schedule 1</para>
                </entry>
                <entry>
                  <para>Room B Entry</para>
                </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">AccessProfile <phrase>[</phrase>tar:AccessProfile<phrase>]</phrase></para>
              <para role="text">The AccessProfile to create.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="param">Token <phrase>[</phrase>pt:ReferenceToken<phrase>]</phrase></para>
              <para role="text">The Token of created AccessProfile.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">
                <phrase>env:</phrase>Receiver <phrase>– ter:</phrase>CapabilityViolated <phrase>– ter:</phrase>MaxAccessProfiles</para>
              <para role="text">There is not enough space to add new AccessProfile, see the MaxAccessProfiles capability.</para>
              <para role="param">
                <phrase>env:Sender – ter:</phrase>CapabilityViolated <phrase>– ter:</phrase>MaxAccessPoliciesPerAccessProfile</para>
              <para role="text">There are too many AccessPolicies in an AccessProfile, see MaxAccessPoliciesPerAccessProfile capability.</para>
              <para role="param">
                <phrase>env:Sender – ter:</phrase>CapabilityViolated <phrase>– ter:</phrase>MultipleSchedulesPerAccessPointSupported</para>
              <para role="text">Multiple AccessPoints are not supported for the same schedule, see MultipleSchedulesPerAccessPointSupported capability.</para>
              <para role="param">env:Sender – ter:InvalidArgVal – ter:<phrase>ReferenceNotFound</phrase></para>
              <para role="text">A referred entity token is not found (some devices may not validate referred entities).</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">WRITE_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>SetAccessProfile command</title>
        <para>This method is used to synchronize an access profile in a client with the device.</para>
        <para>If an access profile with the specified token does not exist in the device, the access profile is created. If an access profile with the specified token exists, then the access profile is modified.</para>
        <para>A call to this method takes an access profile structure as input parameter. The token field of the access profile must not be empty.</para>
        <para>A device that signals support for the ClientSuppliedTokenSupported capability shall implement this command. </para>
        <para>If no token was specified in the request, the device shall return InvalidArgs as a generic fault code.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">AccessProfile <phrase>[</phrase>tar:AccessProfile<phrase>]</phrase></para>
              <para role="text">The AccessProfile item to create or modify.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="text">This is an empty message.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">
                <phrase>env:</phrase>Receiver<phrase> – ter:</phrase>CapabilityViolated<phrase> – ter:</phrase>ClientSuppliedTokenSupported</para>
              <para role="text">The device does not support that the client supplies the token.</para>
              <para role="param">
                <phrase>env:</phrase>Receiver<phrase> – ter:</phrase>CapabilityViolated<phrase> – ter:</phrase>MaxAccessProfiles</para>
              <para role="text">There is not enough space to add new AccessProfile, see the MaxAccessProfiles capability.</para>
              <para role="param">
                <phrase>env:Sender – ter:</phrase>CapabilityViolated<phrase> – ter:</phrase>MaxAccessPoliciesPerAccessProfile</para>
              <para role="text">There are too many AccessPolicies in an AccessProfile, see MaxAccessPoliciesPerAccessProfile capability.</para>
              <para role="param">
                <phrase>env:Sender – ter:</phrase>CapabilityViolated<phrase> – ter:</phrase>MultipleSchedulesPerAccessPointSupported</para>
              <para role="text">Multiple AccessPoints are not supported for the same schedule, see MultipleSchedulesPerAccessPointSupported capability.</para>
              <para role="param">env:Sender – ter:InvalidArgVal – ter:<phrase>ReferenceNotFound</phrase></para>
              <para role="text">A referred entity token is not found (some devices may not validate referred entities).</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">WRITE_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>ModifyAccessProfile command</title>
        <para>This operation modifies the specified access profile. </para>
        <para>The token of the access profile to modify is specified in the token field of the AccessProfile structure and shall not be empty. All other fields in the structure shall overwrite the fields in the specified access profile.</para>
        <para>If several access policies specifying different schedules for the same access point will result in a union of the schedules. See <xref linkend="_Ref410131520"/> and <xref linkend="_Ref409688635"/> above.</para>
        <para>If no token was specified in the request, the device shall return InvalidArgs as a generic fault code.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">AccessProfile <phrase>[</phrase>tar:AccessProfile<phrase>]</phrase></para>
              <para role="text">The AccessProfile to modify.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="text">This is an empty message.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender – ter:InvalidArgVal – ter:NotFound</para>
              <para role="text">Access profile token is not found.</para>
              <para role="param">
                <phrase>env:Sender – ter:</phrase>CapabilityViolated<phrase> – ter:</phrase>MaxAccessPoliciesPerAccessProfile</para>
              <para role="text">There are too many AccessPolicies in an AccessProfile, see MaxAccessPoliciesPerAccessProfile capability.</para>
              <para role="param">
                <phrase>env:Sender – ter:</phrase>CapabilityViolated<phrase> – ter:</phrase>MultipleSchedulesPerAccessPointSupported</para>
              <para role="text">Multiple AccessPoints are not supported for the same schedule, see MultipleSchedulesPerAccessPointSupported capability.</para>
              <para role="param">env:Sender – ter:InvalidArgVal – ter:<phrase>ReferenceNotFound</phrase></para>
              <para role="text">A referred entity token is not found (some devices may not validate referred entities).</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">WRITE_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
      <section>
        <title>DeleteAccessProfile command</title>
        <para>This operation will delete the specified access profile. </para>
        <para>If the access profile is deleted, all access policies associated with the access profile will also be deleted.</para>
        <para>If it is associated with one or more entities some devices may not be able to delete the access profile, and consequently a ReferenceInUse fault shall be generated.</para>
        <para>If no token was specified in the request, the device shall return InvalidArgs as a generic fault code.</para>
        <variablelist role="op">
          <varlistentry>
            <term>request</term>
            <listitem>
              <para role="param">Token <phrase>[</phrase>pt:ReferenceToken<phrase>]</phrase></para>
              <para role="text">The token of the access profile to delete.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>response</term>
            <listitem>
              <para role="text">This is an empty message.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>faults</term>
            <listitem>
              <para role="param">env:Sender – ter:InvalidArgVal – ter:NotFound</para>
              <para role="text">Access profile token is not found.</para>
              <para role="param">env:Sender – ter:InvalidArgVal – ter:<phrase>ReferenceInUse</phrase></para>
              <para role="text">Failed to delete, Access profile token is in use.</para>
            </listitem>
          </varlistentry>
          <varlistentry>
            <term>access class</term>
            <listitem>
              <para role="access">WRITE_SYSTEM</para>
            </listitem>
          </varlistentry>
        </variablelist>
      </section>
    </section>
  </chapter>
  <chapter>
    <title>Notification topics</title>
    <section>
      <title>General</title>
      <para>This section defines notification topics specific to the access rules service.</para>
    </section>
    <section>
      <title>Event overview (informative)</title>
      <para>The access rules service specifies events when access profiles are changed.</para>
      <para>The main topics for configuration change notifications are:</para>
      <itemizedlist>
        <listitem>
          <para>tns1:Configuration/AccessProfile/Changed</para>
        </listitem>
        <listitem>
          <para>tns1:Configuration/AccessProfile/Removed</para>
        </listitem>
      </itemizedlist>
    </section>
    <section>
      <title>Configuration changes</title>
      <section>
        <title>General</title>
        <para>Whenever configuration data has been changed, added or been removed, the device shall provide these events to inform subscribed clients.</para>
      </section>
      <section>
        <title>Access profile</title>
        <para>Whenever configuration data for an access profile is changed or an access profile is added, the device shall provide the following event:</para>
        <programlisting><![CDATA[Topic: tns1:Configuration/AccessProfile/Changed
<tt:MessageDescription IsProperty="false">
  <tt:Source>
    <tt:SimpleItemDescription Name="AccessProfileToken"
      Type="pt:ReferenceToken"/>
  </tt:Source>
</tt:MessageDescription>
]]></programlisting>
        <para>Whenever an access profile is removed, the device shall provide the following event:</para>
        <programlisting><![CDATA[Topic: tns1:Configuration/AccessProfile/Removed
<tt:MessageDescription IsProperty="false">
  <tt:Source>
    <tt:SimpleItemDescription Name="AccessProfileToken"
      Type="pt:ReferenceToken"/>
  </tt:Source>
</tt:MessageDescription>
]]></programlisting>
      </section>
    </section>
  </chapter>
  <appendix role="revhistory">
    <title>Revision History</title>
    <para/>
  </appendix>
</book>
