chippyash/Zend-Acl-Xml-Builder

View on GitHub
src/Chippyash/Zend/Acl/Xml/xsd/zendacl.xsd

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
    xmlns="http://schema.zf4.biz/schema/zendacl"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://schema.zf4.biz/schema/zendacl"
    elementFormDefault="qualified"
    >
    <xs:annotation>
        <xs:documentation>
            <![CDATA[
      Zend ACL XML Services Schema, version 1.0
      Authors: Ashley Kitson

      This defines a way to describe Zend\Permissions\ACLs.
    ]]></xs:documentation>
    </xs:annotation>
    <xs:element name="acl">
        <xs:annotation>
            <xs:documentation>
                Root element of definition
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="imports" type="importsType" minOccurs="0" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Containing element for importing other definitions
                        </xs:documentation>
                    </xs:annotation>
                </xs:element>
                <xs:element name="roles" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Containing element for roles
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="role" type="roleType" minOccurs="1"
                                maxOccurs="unbounded"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="resources" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Containing element for resources
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="resource" type="resourceType" minOccurs="1"
                                maxOccurs="unbounded"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="rules" maxOccurs="1">
                    <xs:annotation>
                        <xs:documentation>
                            Containing element for rules
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="rule" type="ruleType" minOccurs="1"
                                maxOccurs="unbounded"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="roleType">
        <xs:annotation>
            <xs:documentation>
                Definition of a role
            </xs:documentation>
        </xs:annotation>
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="type" type="xs:string" default="GenericRole" use="optional"/>
                <xs:attribute name="parents" type="xs:string" use="optional"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="resourceType">
        <xs:annotation>
            <xs:documentation>
                Definition of a resource
            </xs:documentation>
        </xs:annotation>
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="type" type="xs:string" default="GenericResource" use="optional"/>
                <xs:attribute name="parent" type="xs:string" use="optional"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="ruleType">
        <xs:annotation>
            <xs:documentation>
                Definition of a rule
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="privilege" type="xs:string" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        A role may contain zero or more privileges
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="type" use="required" type="accessType"/>
        <xs:attribute name="roles" type="xs:string" use="optional" default="*"/>
        <xs:attribute name="resources" type="xs:string" use="optional" default="*"/>
        <xs:attribute name="assertion" type="xs:string" use="optional"/>
    </xs:complexType>

    <xs:simpleType name="accessType">
        <xs:annotation>
            <xs:documentation>
                Role access type enumeration
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:token">
            <xs:enumeration value="ALLOW"/>
            <xs:enumeration value="DENY"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="importsType">
        <xs:annotation>
            <xs:documentation>
                Sub acl definition imports container type
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="import" type="xs:anyURI" minOccurs="0" maxOccurs="unbounded" >
                <xs:annotation>
                    <xs:documentation>
                        ACL XML file to import.  If no path given, then expect
                        file to be in same directory as parent file. If path
                        begins .., then expect file to be in directory relative
                        to parent file. If path supplied, then expect file to
                        be in that directory.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    
</xs:schema>