Skip to content
73 changes: 73 additions & 0 deletions transforms/csdl/preprocess_csdl.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,58 @@
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template name="ManagedDeviceFilterRestrictionsTemplate">
<xsl:element name="Annotation">
<xsl:attribute name="Term">Org.OData.Capabilities.V1.FilterRestrictions</xsl:attribute>
<xsl:element name="Record" namespace="{namespace-uri()}">
<xsl:element name="PropertyValue">
<xsl:attribute name="Property">Filterable</xsl:attribute>
<xsl:attribute name="Bool">true</xsl:attribute>
</xsl:element>
<xsl:element name="PropertyValue">
<xsl:attribute name="Property">NonFilterableProperties</xsl:attribute>
<xsl:element name="Collection">
<xsl:element name="PropertyPath">activationLockBypassCode</xsl:element>
<xsl:element name="PropertyPath">androidSecurityPatchLevel</xsl:element>
<xsl:element name="PropertyPath">azureADRegistered</xsl:element>
<xsl:element name="PropertyPath">configurationManagerClientEnabledFeatures</xsl:element>
<xsl:element name="PropertyPath">deviceActionResults</xsl:element>
<xsl:element name="PropertyPath">deviceEnrollmentType</xsl:element>
<xsl:element name="PropertyPath">deviceHealthAttestationState</xsl:element>
<xsl:element name="PropertyPath">deviceRegistrationState</xsl:element>
<xsl:element name="PropertyPath">easActivated</xsl:element>
<xsl:element name="PropertyPath">easActivationDateTime</xsl:element>
<xsl:element name="PropertyPath">easDeviceId</xsl:element>
<xsl:element name="PropertyPath">enrollmentProfileName</xsl:element>
<xsl:element name="PropertyPath">ethernetMacAddress</xsl:element>
<xsl:element name="PropertyPath">exchangeAccessStateReason</xsl:element>
<xsl:element name="PropertyPath">exchangeLastSuccessfulSyncDateTime</xsl:element>
<xsl:element name="PropertyPath">freeStorageSpaceInBytes</xsl:element>
<xsl:element name="PropertyPath">iccid</xsl:element>
<xsl:element name="PropertyPath">id</xsl:element>
<xsl:element name="PropertyPath">isEncrypted</xsl:element>
<xsl:element name="PropertyPath">isSupervised</xsl:element>
<xsl:element name="PropertyPath">managedDeviceName</xsl:element>
<xsl:element name="PropertyPath">managedDeviceOwnerType</xsl:element>
<xsl:element name="PropertyPath">managementCertificateExpirationDate</xsl:element>
<xsl:element name="PropertyPath">meid</xsl:element>
<xsl:element name="PropertyPath">notes</xsl:element>
<xsl:element name="PropertyPath">partnerReportedThreatState</xsl:element>
<xsl:element name="PropertyPath">physicalMemoryInBytes</xsl:element>
<xsl:element name="PropertyPath">remoteAssistanceSessionErrorDetails</xsl:element>
<xsl:element name="PropertyPath">remoteAssistanceSessionUrl</xsl:element>
<xsl:element name="PropertyPath">requireUserEnrollmentApproval</xsl:element>
<xsl:element name="PropertyPath">subscriberCarrier</xsl:element>
<xsl:element name="PropertyPath">totalStorageSpaceInBytes</xsl:element>
<xsl:element name="PropertyPath">udid</xsl:element>
<xsl:element name="PropertyPath">userDisplayName</xsl:element>
<xsl:element name="PropertyPath">userId</xsl:element>
<xsl:element name="PropertyPath">wiFiMacAddress</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template name="ExpandRestrictionsTemplate">
<xsl:param name = "expandable" />
<xsl:attribute name="Term">Org.OData.Capabilities.V1.ExpandRestrictions</xsl:attribute>
Expand Down Expand Up @@ -1792,6 +1844,16 @@
</xsl:when>
</xsl:choose>

<!-- Add FilterRestrictions to managedDevice entity type -->
<xsl:choose>
<xsl:when test="not(edm:Annotations[@Target='microsoft.graph.managedDevice'])">
<xsl:element name="Annotations">
<xsl:attribute name="Target">microsoft.graph.managedDevice</xsl:attribute>
<xsl:call-template name="ManagedDeviceFilterRestrictionsTemplate"/>
</xsl:element>
</xsl:when>
</xsl:choose>

<!-- Remove Updatability for organization/certificateBasedAuthConfiguration containment navigation property -->
<xsl:choose>
<xsl:when test="not(edm:Annotations[@Target='microsoft.graph.organization/certificateBasedAuthConfiguration'])">
Expand Down Expand Up @@ -2185,6 +2247,17 @@
</xsl:copy>
</xsl:template>

<!-- Add FilterRestrictions to managedDevice entity type -->
<!-- Skip if the annotation is already present, so upstream metadata gaining it does not produce a duplicate -->
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:Annotations[@Target='microsoft.graph.managedDevice']">
<xsl:copy>
<xsl:copy-of select="@*|node()"/>
<xsl:if test="not(edm:Annotation[@Term='Org.OData.Capabilities.V1.FilterRestrictions'])">
<xsl:call-template name="ManagedDeviceFilterRestrictionsTemplate"/>
</xsl:if>
</xsl:copy>
</xsl:template>

<!-- Add ExpandRestrictions to events,mailfolders and messages entity type -->
<xsl:template match="edm:Schema[@Namespace='microsoft.graph']/edm:Annotations[@Target='microsoft.graph.user/events']/edm:Annotation[@Term='Org.OData.Capabilities.V1.ExpandRestrictions']|
edm:Schema[@Namespace='microsoft.graph']/edm:Annotations[@Target='microsoft.graph.group/events']/edm:Annotation[@Term='Org.OData.Capabilities.V1.ExpandRestrictions']|
Expand Down
3 changes: 3 additions & 0 deletions transforms/csdl/preprocess_csdl_test_input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@
</Record>
</Annotation>
</Annotations>
<Annotations Target="microsoft.graph.managedDevice">
<Annotation Term="Org.OData.Core.V1.Description" String="Devices that are managed or pre-enrolled through Intune. Limited support for $filter: Only properties whose descriptions mention support for $filter may be used, and combinations of those filtered properties must use 'and', not 'or'." />
</Annotations>
<Annotations Target="microsoft.graph.managedDevice/users">
<Annotation Term="Org.OData.Capabilities.V1.ChangeTracking">
<Record>
Expand Down
48 changes: 48 additions & 0 deletions transforms/csdl/preprocess_csdl_test_output.xml
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,54 @@
</Record>
</Annotation>
</Annotations>
<Annotations Target="microsoft.graph.managedDevice">
<Annotation Term="Org.OData.Core.V1.Description" String="Devices that are managed or pre-enrolled through Intune. Limited support for $filter: Only properties whose descriptions mention support for $filter may be used, and combinations of those filtered properties must use 'and', not 'or'." />
<Annotation Term="Org.OData.Capabilities.V1.FilterRestrictions">
<Record>
<PropertyValue Property="Filterable" Bool="true" />
<PropertyValue Property="NonFilterableProperties">
<Collection>
<PropertyPath>activationLockBypassCode</PropertyPath>
<PropertyPath>androidSecurityPatchLevel</PropertyPath>
<PropertyPath>azureADRegistered</PropertyPath>
<PropertyPath>configurationManagerClientEnabledFeatures</PropertyPath>
<PropertyPath>deviceActionResults</PropertyPath>
<PropertyPath>deviceEnrollmentType</PropertyPath>
<PropertyPath>deviceHealthAttestationState</PropertyPath>
<PropertyPath>deviceRegistrationState</PropertyPath>
<PropertyPath>easActivated</PropertyPath>
<PropertyPath>easActivationDateTime</PropertyPath>
<PropertyPath>easDeviceId</PropertyPath>
<PropertyPath>enrollmentProfileName</PropertyPath>
<PropertyPath>ethernetMacAddress</PropertyPath>
<PropertyPath>exchangeAccessStateReason</PropertyPath>
<PropertyPath>exchangeLastSuccessfulSyncDateTime</PropertyPath>
<PropertyPath>freeStorageSpaceInBytes</PropertyPath>
<PropertyPath>iccid</PropertyPath>
<PropertyPath>id</PropertyPath>
<PropertyPath>isEncrypted</PropertyPath>
<PropertyPath>isSupervised</PropertyPath>
<PropertyPath>managedDeviceName</PropertyPath>
<PropertyPath>managedDeviceOwnerType</PropertyPath>
<PropertyPath>managementCertificateExpirationDate</PropertyPath>
<PropertyPath>meid</PropertyPath>
<PropertyPath>notes</PropertyPath>
<PropertyPath>partnerReportedThreatState</PropertyPath>
<PropertyPath>physicalMemoryInBytes</PropertyPath>
<PropertyPath>remoteAssistanceSessionErrorDetails</PropertyPath>
<PropertyPath>remoteAssistanceSessionUrl</PropertyPath>
<PropertyPath>requireUserEnrollmentApproval</PropertyPath>
<PropertyPath>subscriberCarrier</PropertyPath>
<PropertyPath>totalStorageSpaceInBytes</PropertyPath>
<PropertyPath>udid</PropertyPath>
<PropertyPath>userDisplayName</PropertyPath>
<PropertyPath>userId</PropertyPath>
<PropertyPath>wiFiMacAddress</PropertyPath>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
<Annotations Target="microsoft.graph.managedDevice/users">
<Annotation Term="Org.OData.Capabilities.V1.ChangeTracking">
<Record>
Expand Down