Sub SetAccessList()
Const IRAuthenticationTicket As String = "sid-xxxxxxxxxxxxxxx"
Const IR_Path As String = "/public"
Dim xmlResponse As System.Xml.XmlElement
Dim IR_Obj As InfoRouter.srv
Dim xmldoc As System.Xml.XmlDocument
Try
xmldoc = New System.Xml.XmlDocument
xmldoc.LoadXml("<AccessList/>")
Dim xmlSecElem As System.Xml.XmlElement
'Set DomainMembers Access
xmlSecElem = xmldoc.CreateElement("DomainMembers")
xmlSecElem.SetAttribute("Right", "4") 'Add and Read
xmldoc.DocumentElement.AppendChild(xmlSecElem)
'Set Change right to the usergroup (Authors@public)
xmlSecElem = xmldoc.CreateElement("UserGroup")
xmlSecElem.SetAttribute("DomainName", "Public")
xmlSecElem.SetAttribute("GroupName", "Authors")
xmlSecElem.SetAttribute("Right", "5") 'Change
xmldoc.DocumentElement.AppendChild(xmlSecElem)
'Set Full Control Right to the User (JaneC)
xmlSecElem = xmldoc.CreateElement("User")
xmlSecElem.SetAttribute("DomainName", "")
xmlSecElem.SetAttribute("UserName", "JaneC")
xmlSecElem.SetAttribute("Right", "6") 'Full Control
xmldoc.DocumentElement.AppendChild(xmlSecElem)
IR_Obj = New InfoRouter.srv
xmlResponse = IR_Obj.SetAccessList(IRAuthenticationTicket, _
IR_Path, _
xmldoc.DocumentElement.OuterXml, _
False)
If xmlResponse.GetAttribute("success") = "true" Then
Console.WriteLine("The AccesList has been applied successfully.")
Else
Console.WriteLine("The AccesList cannot be applied:" & _
xmlResponse.GetAttribute("error"))
End If
Catch ex As Exception
Console.WriteLine("error:" & ex.Message)
Finally
xmlResponse = Nothing
xmldoc = Nothing
IR_Obj = Nothing
End Try
End Sub
|