0

是否可以通过 C# 在 Netsqlazman 中找到用户的所有应用程序组?

4

2 回答 2

0

您可能会在以下链接中的帖子中找到您的答案。一切顺利。

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

于 2011-02-16T12:08:19.357 回答
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
于 2011-02-24T05:29:58.483 回答