为用户获取所有ApplicationGroups(NetSqlAzman)

时间:2011-02-16 11:53:32

标签: c# authorization netsqlazman

是否可以通过C#?

为Netsqlazman中的用户找到所有应用程序组

2 个答案:

答案 0 :(得分:0)

你可以在帖子中找到你的答案,在以下链接中。 一切顺利。

http://www.csharpcorner.com/uploadfile/a.ferendeles/netsqlazman12122006123316pm/netsqlazman.aspx

答案 1 :(得分:0)

Public Function GetGroupsForUser(ByVal UserName As String) As DataTable
        Dim dt As New DataTable
        dt.Columns.Add("ID")
        dt.Columns.Add("Name")
        dt.Columns.Add("Descrp")
        dt.Columns.Add("SID")
        Dim dr As DataRow
        Dim groups As New List(Of String)
        Dim groups2 As New List(Of String)
        'Get All Groups
        For Each item In Storage.Stores(StoreName).Applications(ApplicationName).GetApplicationGroups()
            groups.Add(item.Name)
        Next
        For Each item In groups
            Dim IsInGroup As Boolean = False
            'IsInGroup = Storage.Stores(StoreName).Applications(ApplicationName).ApplicationGroups(item).IsInGroup(Storage.GetDBUser(UserName))
            IsInGroup = Me.IsUserInRole(UserName, item)
            If IsInGroup Then
                dr = dt.NewRow
                dr(1) = item
                groups2.Add(item)
                dt.Rows.Add(dr)
            End If
        Next
        Return dt
    End Function