Click here to Skip to main content
15,897,187 members
Articles / Programming Languages / Visual Basic

RestrictedUI: A .NET Library for restricting a user interface based on a security policy

Rate me:
Please Sign up or sign in to vote.
4.30/5 (17 votes)
26 May 2010MPL21 min read 26.8K   1.3K   69  
How to control the user interface using a policy established in a declaratively way, based on user roles and application status.
<configuration>
  <dduetools>
    <platform version="2.0" path="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\" />
    <resolver type="Microsoft.Ddue.Tools.Reflection.AssemblyResolver" assembly="%DXROOT%\ProductionTools\MRefBuilder.exe" use-gac="false" />
    <!--
    <namer type="Microsoft.Ddue.Tools.Reflection.OrcasNamer" assembly="Microsoft.Ddue.Tools.Reflection.dll" />
    <addins>
      <addin type="Microsoft.Ddue.Tools.XamlAttachedMembersAddIn" assembly="MRefBuilder.exe" />
    </addins>
    <apiFilter expose="true">
      <namespace name="System" expose="true">
        <type name="Object" expose="false">
          <member name="ToString" expose="true" />
        </type>
      </namespace>
    </apiFilter>
    -->
    <attributeFilter expose="true">
      <!-- Most attributes in System.ComponentModel control designer behavior. Don't show them. -->
      <!-- The expections are attributes relating to data binding. Do show them. -->
      <namespace name="System.ComponentModel" expose="false">
        <type name="BindableAttribute" expose="true"/>
        <type name="ComplexBindingPropertiesAttribute" expose="true"/>
        <type name="DataObjectAttribute" expose="true"/>
        <type name="DefaultBindingPropertyAttribute" expose="true"/>
        <type name="ListBindableAttribute" expose="true"/>
        <type name="LookupBindingPropertiesAttribute" expose="true"/>
        <type name="SettingsBindableAttribute" expose="true"/>
        <type name="TypeConverterAttribute" expose="true"/>
      </namespace>
      <namespace name="System.ComponentModel.Design" expose="false" />
      <!-- Most attributes in System.Diagnostics control debugger behavior. Don't show them. -->
      <namespace name="System.Diagnostics" expose="false">
        <type name="ConditionalAttribute" expose="true"/>
        <type name="EventLogPermissionAttribute" expose="true"/>
        <type name="PerformanceCounterPermissionAttribute" expose="true"/>
      </namespace>
      <!-- Attributes in System.Diagnostics.CodeAnalysis control interaction with FxCop. Don't show them. -->
      <namespace name="System.Diagnostics.CodeAnalysis" expose="false" />
      <!-- Attributes in System.EnterpriseServices control obscure details of COM+ interop. Don't show them. -->
      <namespace name="System.EnterpriseServices" expose="false" />
      <!-- The DefaultMember attribute is usually compiler-generated. Users will see it from the member syntax. -->
      <namespace name="System.Reflection" expose="true">
        <type name="DefaultMemberAttribute" expose="false" />
      </namespace>
      <!-- Attributes in System.Runtime.CompilerServices control obscure details of compilation. Don't show them. -->
      <namespace name="System.Runtime.CompilerServices" expose="false" />
      <!-- Attributes in System.Runtime.ConstrinedExecution control obscure details of compilation. Don't show them. -->
      <namespace name="System.Runtime.ConstrainedExecution" expose="false" />
      <!-- Most atributes in System.Runtime.InteropServices control obscure details of COM interop. Don't show them. -->
      <namespace name="System.Runtime.InteropServices" expose="false">
        <type name="ComVisibleAttribute" expose="true"/>
        <type name="GuidAttribute" expose="true"/>
        <type name="ClassInterfaceAttribute" expose="true"/>
        <type name="InterfaceTypeAttribute" expose="true"/>
      </namespace>
      <!-- Attributes in System.Runtime.Versioning control details of resource loading. Don't show them. -->
      <namespace name="System.Runtime.Versioning" expose="false" />
      <!-- Attributes in System.Security might hint as security implementation details. Don't show them. -->
      <namespace name="System.Security" expose="false">
        <type name="AllowPartiallyTrustedCallersAttribute" expose="true" />
      </namespace>
      <!-- Attributes in System.Web.Compilation control interaction with the Expression designer. Don't show them. -->
      <namespace name="System.Web.Compilation" expose="false" />
      <!-- The ASP.NET team only wants these attributes exposed from their namespace. Their logic ecscapes me, but here it is. -->
      <namespace name="System.Web.UI" expose="false">
        <type name="ControlValuePropertyAttribute" expose="true"/>
        <type name="ValidationPropertyAttribute" expose="true"/>
        <type name="WebResourceAttribute" expose="true"/>
        <type name="TemplateContainerAttribute" expose="true"/>
        <type name="ThemeableAttribute" expose="true"/>
        <type name="TemplateInstanceAttribute" expose="true"/>
      </namespace>
      <!-- Don't show attributes related to XAML serialization details. -->
      <namespace name="System.Windows.Markup" expose="true">
        <type name="ConstructorArgumentAttribute" expose="false" />
        <type name="DependsOnAttribute" expose="false" />
        <type name="DesignerSerializationOptionsAttribute" expose="false" />
        <type name="ValueSerializerAttribute" expose="false" />
        <type name="XmlnsCompatibleWithAttribute" expose="false" />
        <type name="XmlnsDefinitionAttribute" expose="false" />
        <type name="XmlnsPrefixAttribute" expose="false" />
      </namespace>
      <!-- Attributes in System.Xml.Serialization control obscure details of XML serialization. Don't show them.-->
      <namespace name="System.Xml.Serialization" expose="false" />
    </attributeFilter>
  </dduetools>
</configuration>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Mozilla Public License 1.1 (MPL 1.1)


Written By
Spain Spain
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions