Aby skonfigurowaµ role dla pakietu i sk│adnika oraz przydzieliµ u┐ytkownikowi uprawnienia administracyjne:
Dim catalog As Object Dim packages As Object Dim pack As Object Dim comp As Object Dim newUser As Object Dim newRole As Object Dim componentsInPack As Object Dim RolesInPackage As Object Dim usersInRole As Object Dim rolesForComponent As Object Dim util As Object
On Error GoTo failed
Set catalog = CreateObject("MTSAdmin.Catalog.1") Set packages = catalog.GetCollection("Packages") packages.Populate
If pack.Name = "My Package" Then Set rolesInPack = packages.GetCollection("RolesInPackage", pack.Key) Set newRole = rolesInPack.Add newRole.Value("Name") = "R1" rolesInPack.savechanges
Set usersInRole = RolesInPackage.GetCollection("UsersInRole", newRole.Key) Set newUser = usersInRole.Add newUser.Value("User") = "administrator" usersInRole.savechanges
Set componentsInPack = packages.GetCollection("ComponentsInPackage", pack.Key) componentsInPack.Populate For Each comp In componentsInPack If comp.Name = "Bank.Account" Then Set rolesForComponent = componentsInPack.GetCollection("RolesForPackageComponent", comp.Key) Set util = rolesForComponent.GetUtilInterface util.associateRole (newRole.Key) Exit For End If Next Exit For End If Next Exit Sub
failed: MsgBox "Failure code " + Str$(Err.Number) End Sub
Zobacz te┐
Obiekty administracyjne programu MTS, Typy kolekcji programu MTS, Metody obiekt≤w administracyjnych programu MTS, Automatyzacja czynno£ci administracyjnych programu MTS za pomoc╣ programu Visual Basic