Get All ApplicationGroups For a user (NetSqlAzman)

1.1k views Asked by At

is it possible to find All Application Groups For a user in Netsqlazman via C# ?

2

There are 2 answers

0
Shahin On BEST ANSWER
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
0
Kings On

You could probably find your answer in the post, in the following link. All the best.

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