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