Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
3.5 KiB

  1. <job id="myTest">
  2. <reference object="AzRoles.AzAdminManager"/>
  3. <script src="topen.inc" language="VBScript">
  4. 'global
  5. Dim xmlFile, testN, storeFlag
  6. xmlFile=""
  7. testN=1
  8. storeFlag=0 'default is open
  9. Sub PrintUsage
  10. WScript.Echo "Usage: tacl XMLFileName [#]"
  11. WScript.Echo " optional # is test number, 1 or 2. default is 1"
  12. WScript.Echo " test1 - open a store and add/delete admins/readers"
  13. WScript.Echo " test2 - create a new store and apply default acl"
  14. End Sub
  15. Function GetCommandArg
  16. If 1 <> WScript.Arguments.Count And 2 <> WScript.Arguments.Count Then
  17. PrintUsage
  18. GetCommandArg=False
  19. Else
  20. xmlFile=WScript.Arguments.Item(0)
  21. If 2 = WScript.Arguments.Count Then
  22. testN = WScript.Arguments.Item(1)
  23. If 2 = testN Then
  24. storeFlag = AZ_ADMIN_FLAG_CREATE
  25. End If
  26. End If
  27. GetCommandArg=True
  28. End If
  29. End Function
  30. Sub Test1()
  31. Dim Admin
  32. Set Admin=CreateObject("AzRoles.AzAdminManager")
  33. WScript.Echo ""
  34. WScript.Echo "Open..." & xmlFile
  35. Admin.Initialize storeFlag, xmlFile
  36. WScript.Echo ""
  37. WScript.Echo "Original Admin ACL List"
  38. AzPrintPolicy Admin
  39. WScript.Echo ""
  40. WScript.Echo "Test1 - Add three Admin SIDs"
  41. Admin.AddPolicyAdministrator "S-1-1000-1"
  42. Admin.AddPolicyAdministrator "S-1-1000-2"
  43. Admin.AddPolicyAdministrator "S-1-1000-3"
  44. AzPrintPolicy Admin
  45. WScript.Echo ""
  46. WScript.Echo "Test1 - Delete one Admin SID"
  47. Admin.DeletePolicyAdministrator "S-1-1000-2"
  48. AzPrintPolicy Admin
  49. WScript.Echo ""
  50. WScript.Echo "Test1 - Add three Reader SIDs"
  51. Admin.AddPolicyReader "S-1-1000-4"
  52. Admin.AddPolicyReader "S-1-1000-5"
  53. Admin.AddPolicyReader "S-1-1000-6"
  54. AzPrintPolicy Admin
  55. WScript.Echo ""
  56. WScript.Echo "Test1 - Delete one Reader SID"
  57. Admin.DeletePolicyReader "S-1-1000-5"
  58. AzPrintPolicy Admin
  59. WScript.Echo ""
  60. WScript.Echo "Submit Test1 changes"
  61. Admin.Submit
  62. WScript.Echo ""
  63. WScript.Echo "Close..." & xmlFile & " and release Admin"
  64. Set Admin=Nothing
  65. WScript.Echo ""
  66. WScript.Echo "Re-open..." & xmlFile
  67. Set Admin=CreateObject("AzRoles.AzAdminManager")
  68. Admin.Initialize 0, xmlFile
  69. WScript.Echo ""
  70. WScript.Echo "Dump the current ACL List"
  71. AzPrintPolicy Admin
  72. Set Admin=Nothing
  73. End Sub
  74. Sub Test2()
  75. Dim Admin
  76. Set Admin=CreateObject("AzRoles.AzAdminManager")
  77. WScript.Echo ""
  78. WScript.Echo "Create..." & xmlFile
  79. Admin.Initialize storeFlag, xmlFile
  80. Admin.Submit
  81. WScript.Echo ""
  82. WScript.Echo "The current Admin ACL List"
  83. AzPrintPolicy Admin
  84. WScript.Echo "add S-1-1000-8 as policy admin..."
  85. Admin.AddPolicyAdministrator "S-1-1000-8"
  86. WScript.Echo ""
  87. WScript.Echo "Submit Admin"
  88. Admin.Description="make it dirty"
  89. Admin.Submit
  90. WScript.Echo ""
  91. WScript.Echo "Close..." & xmlFile & " and release Admin"
  92. Set Admin=Nothing
  93. WScript.Echo ""
  94. WScript.Echo "Re-open..." & xmlFile
  95. Set Admin=CreateObject("AzRoles.AzAdminManager")
  96. Admin.Initialize 0, xmlFile
  97. WScript.Echo ""
  98. WScript.Echo "Dump the current ACL List"
  99. AzPrintPolicy Admin
  100. Set Admin=Nothing
  101. End Sub
  102. 'main starts
  103. If True = GetCommandArg Then
  104. If 1 = testN Then
  105. Test1
  106. Else
  107. Test2
  108. End If
  109. End If 'GetCommandArg
  110. </script>
  111. </job>