Click here to Skip to main content
15,881,600 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.
Public Class Entity
    Private _a As String
    Public Property a() As String
        Get
            Return _a
        End Get
        Set(ByVal value As String)
            _a = value
        End Set
    End Property

    Private _b As Integer
    Public Property b() As Integer
        Get
            Return _b
        End Get
        Set(ByVal value As Integer)
            _b = value
        End Set
    End Property

    Public Function getDatos() As DataSet
        Dim ds As New DataSet
        Dim t As DataTable
        t = New DataTable("Controles")
        t.Columns.Add("Rol", GetType(Int32))
        t.Columns.Add("ID", GetType(String))
        t.Columns.Add("IDPadre", GetType(String))
        t.Columns.Add("IDControl", GetType(String))
        t.Columns.Add("Nombre", GetType(String))
        t.Columns.Add("Visible", GetType(Boolean))
        t.Columns.Add("Enabled", GetType(Boolean))
        t.Columns.Add("Estados_", GetType(String))
        t.Columns.Add("Estados", GetType(String))
        t.Columns.Add("Numero", GetType(String))

        Dim r As DataRow = t.NewRow
        r("Rol") = 0
        r("ID") = "ID"
        r("IDControl") = "IDControl"
        r("Nombre") = "Nombre"
        t.Rows.Add(r)

        ds.Tables.Add(t)
        Return ds
    End Function

End Class

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