Get All ApplicationGroups For a user (NetSqlAzman)
is it possible to find All Appl开发者_如何学Cication Groups For a user in Netsqlazman via C# ?
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
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
精彩评论