Click here to Skip to main content
15,884,177 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.
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!-- 
    Microsoft ResX Schema 
    
    Versión 2.0
    
    El objetivo principal de este formato es permitir un formato XML sencillo 
    que sea sobre todo lenguaje natural. La generación y el análisis de los 
    distintos tipos de datos se realizan mediante las clases TypeConverter 
    asociadas a los tipos de datos.
    
    Ejemplo:
    
    ... ado.net/Encabezados XML y esquema...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
                
    Hay un número cualquiera de filas "resheader" que contienen pares 
    nombre/valor simples.
    
    Cada fila de datos contiene un nombre y un valor. La fila también contiene un 
    tipo o tipo mime. El tipo corresponde a una clase .NET que admite 
    la conversión texto/valor mediante la arquitectura TypeConverter. 
    Las clases que no lo admiten, se serializan y almacenan con el 
    tipo mime establecido.
    
    El tipo mime se utiliza para objetos serializados e indica a 
    ResXResourceReader cómo anular el almacenamiento del objeto. Actualmente no es 
    extensible. Para un tipo mime determinado el valor debe establecerse en consecuencia:
    
    Nota - application/x-microsoft.net.object.binary.base64 es el formato 
    que generará ResXResourceWriter; sin embargo, el lector puede 
    leer cualquiera de los formatos enumerados a continuación.
    
    tipo mime: application/x-microsoft.net.object.binary.base64
    valor   : el objeto debe serializarse con 
            : System.Serialization.Formatters.Binary.BinaryFormatter
            : y codificarse, a continuación, con codificación base64.
    
    tipo mime: application/x-microsoft.net.object.soap.base64
    valor   : el objeto debe serializarse con 
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : y codificarse, a continuación, con codificación base64.

    tipo mime: application/x-microsoft.net.object.bytearray.base64
    valor   : el objeto debe serializarse en una matriz de bytes 
            : utilizando System.ComponentModel.TypeConverter
            : y codificarse, a continuación, con codificación base64.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
</root>

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