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.

103 lines
2.7 KiB

  1. Sub DeleteAFile(filespec)
  2. Dim fso
  3. Set fso = CreateObject("Scripting.FileSystemObject")
  4. fso.DeleteFile(filespec)
  5. End Sub
  6. DeleteAFile("abc.xml")
  7. Dim pAdminManager
  8. Set pAdminManager=CreateObject("AzRoles.AzAdminManager")
  9. pAdminManager.Initialize 1, "msxml://abc.xml"
  10. pAdminManager.Submit
  11. Dim AppHandle1
  12. Set AppHandle1=pAdminManager.CreateApplication("MyApp", 0)
  13. AppHandle1.Submit
  14. Dim OpHandle1
  15. Set OpHandle1=AppHandle1.CreateOperation("Op1", 0)
  16. OpHandle1.Submit
  17. OpHandle1.OperationId = 61
  18. OpHandle1.Submit
  19. Dim GroupHandleA
  20. Set GroupHandleA=AppHandle1.CreateApplicationGroup("GroupWorld", 0)
  21. GroupHandleA.Type = 2
  22. GroupHandleA.AddMember "s-1-1-0"
  23. GroupHandleA.Submit
  24. Dim TaskHandle1
  25. Set TaskHandle1=AppHandle1.CreateTask("TaskOp1", 0)
  26. TaskHandle1.AddOperation "Op1"
  27. TaskHandle1.BizRuleLanguage = "VBScript"
  28. TaskHandle1.Submit
  29. Set ScopeHandle1=AppHandle1.CreateScope("MyScopeQ1", 0)
  30. ScopeHandle1.Submit
  31. Set RoleHandleA=ScopeHandle1.CreateRole("RoleLdapCanOp1", 0)
  32. RoleHandleA.AddAppMember "GroupWorld"
  33. RoleHandleA.AddTask "TaskOp1"
  34. Dim Results
  35. Dim Names(5)
  36. Dim Values(5)
  37. Dim Scopes(5)
  38. Dim Operations(10)
  39. Names(0) = "Amount"
  40. Values(0) = 50
  41. Names(1) = "Name"
  42. Values(1) = "Bob"
  43. Scopes(0) = "MyScopeQ1"
  44. Operations(0) = 61
  45. Dim IntNames(5)
  46. Dim IntFlags(5)
  47. Dim Interfaces(5)
  48. Dim pAdminManager2
  49. IntNames(0) = "Fred"
  50. IntFlags(0) = 0
  51. Set Interfaces(0)=CreateObject("AzRoles.AzAdminManager")
  52. TaskHandle1.BizRule = "Fred.Initialize 1, " & Chr(34) & "msxml://bob.xml" & Chr(34) & vbCr & "AccessCheck.BusinessRuleResult = TRUE"
  53. Dim CCHandle
  54. Set CCHandle=AppHandle1.InitializeClientContextFromToken(0, 0)
  55. Results=CCHandle.AccessCheck("MyObject", Scopes, Operations, Names, Values, IntNames, IntFlags, Interfaces )
  56. If Results(0) = 5 Then
  57. MsgBox("Broken 1")
  58. End if
  59. TaskHandle1.BizRule = "Fred.Submit" & vbCr & "AccessCheck.BusinessRuleResult = TRUE"
  60. Results=CCHandle.AccessCheck("MyObject", Scopes, Operations, Names, Values, IntNames, IntFlags, Interfaces )
  61. If Results(0) = 5 Then
  62. MsgBox("Broken 2")
  63. End if
  64. IntNames(1) = "Bob"
  65. IntFlags(1) = 0
  66. Set Interfaces(1)=AppHandle1
  67. TaskHandle1.BizRule = "if Bob.Name = " & Chr(34) & "MyApp" & Chr(34) & "then AccessCheck.BusinessRuleResult = TRUE"
  68. Results=CCHandle.AccessCheck("MyObject", Scopes, Operations, Names, Values, IntNames, IntFlags, Interfaces )
  69. If Results(0) = 5 Then
  70. MsgBox("Broken 3")
  71. End if
  72. TaskHandle1.BizRule = "if Bob.Name = " & Chr(34) & "MdyApp" & Chr(34) & "then AccessCheck.BusinessRuleResult = TRUE"
  73. Results=CCHandle.AccessCheck("MyObject", Scopes, Operations, Names, Values, IntNames, IntFlags, Interfaces )
  74. If Results(0) <> 5 Then
  75. MsgBox("Broken 4")
  76. End if
  77. DeleteAFile("bob.xml")