Inline the `woltlab_environment` type in XSDs
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 30 Aug 2023 08:41:49 +0000 (10:41 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 30 Aug 2023 08:41:49 +0000 (10:41 +0200)
Not all PIPs support the “all” environment, notably the templateListener PIP.
Thus the legal list of environments is now inlined to make it explicit and also
improve the readability of the XSDs.

Supporting the “all” environment for the templateListener PIP is not really
useful, as template names are rarely shared between frontend and ACP. It's
simple enough to register an explicit listener for each environment in the rare
case all of (templateName, eventName, templateCode) match up.

Fixes #5619

XSD/eventListener.xsd
XSD/templateListener.xsd
XSD/types.xsd

index 91021414c654169b09f8faf6c86e4b1e9388f811..1fa58016713b45ae4d0534a5fc667ee0a9fb2f07 100644 (file)
                                </xs:simpleType>
                        </xs:element>
                        <xs:element name="inherit" type="woltlab_boolean" minOccurs="0" />
-                       <xs:element name="environment" type="woltlab_environment" minOccurs="0" />
+                       <xs:element name="environment" minOccurs="0">
+                               <xs:simpleType>
+                                       <xs:restriction base="xs:string">
+                                               <xs:enumeration value="user" />
+                                               <xs:enumeration value="admin" />
+                                               <xs:enumeration value="all" />
+                                       </xs:restriction>
+                               </xs:simpleType>
+                       </xs:element>
                        <xs:element name="nice" minOccurs="0">
                                <xs:simpleType>
                                        <xs:restriction base="xs:integer">
index dca6f13e86263b594f66b7ad244f8aed0a50df04..97a701153b3c494338946e2ef2f4de947817c64e 100644 (file)
        <!-- deleted template listeners -->
        <xs:complexType name="templatelistener_delete">
                <xs:all>
-                       <xs:element name="environment" type="woltlab_environment" />
+                       <xs:element name="environment">
+                               <xs:simpleType>
+                                       <xs:restriction base="xs:string">
+                                               <xs:enumeration value="user" />
+                                               <xs:enumeration value="admin" />
+                                       </xs:restriction>
+                               </xs:simpleType>
+                       </xs:element>
                        <xs:element name="templatename" type="xs:string" />
                        <xs:element name="eventname" type="xs:string" />
                </xs:all>
        <!-- imported/updated template listeners -->
        <xs:complexType name="templatelistener_import">
                <xs:all>
-                       <xs:element name="environment" type="woltlab_environment" />
+                       <xs:element name="environment">
+                               <xs:simpleType>
+                                       <xs:restriction base="xs:string">
+                                               <xs:enumeration value="user" />
+                                               <xs:enumeration value="admin" />
+                                       </xs:restriction>
+                               </xs:simpleType>
+                       </xs:element>
                        <xs:element name="templatename" type="xs:string" />
                        <xs:element name="eventname" type="xs:string" />
                        <xs:element name="templatecode" type="xs:string" />
index 15dcc772d56ffabad657e6c7a4678b6771b278cf..fbaf29890c94cd6c5fcadc08203e34f7321c798c 100644 (file)
                        <xs:maxInclusive value="1" />
                </xs:restriction>
        </xs:simpleType>
-       
-       <!-- user/admin environment type which only accepts 'user' or 'admin' -->
-       <xs:simpleType name="woltlab_environment">
-               <xs:restriction base="xs:string">
-                       <xs:enumeration value="user" />
-                       <xs:enumeration value="admin" />
-                       <xs:enumeration value="all" />
-               </xs:restriction>
-       </xs:simpleType>
-</xs:schema>
\ No newline at end of file
+</xs:schema>