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.

93 lines
1.9 KiB

  1. #include "pch.h"
  2. //
  3. // Personal expenditures
  4. //
  5. #define ACCESS_FUND_PERSONAL 0x00000001
  6. //
  7. // Company spending
  8. //
  9. #define ACCESS_FUND_CORPORATE 0x00000002
  10. //
  11. // Transfer to other funds
  12. //
  13. #define ACCESS_FUND_TRANSFER 0x00000004
  14. /*++
  15. Class Description
  16. This class handles the access control for a fund, using AuthZ and
  17. internal logic to determine whether certain users should be permitted
  18. certain types of actions on the fund.
  19. --*/
  20. class FundsRM {
  21. private:
  22. //
  23. // The amount of money available in the fund
  24. //
  25. DWORD _dwFundsAvailable;
  26. //
  27. // The resource manager, initialized with the callback functions
  28. //
  29. AUTHZ_RESOURCE_MANAGER_HANDLE _hRM;
  30. //
  31. // The security descriptor for the fund, containing a callback ACE
  32. // which causes the resource manager callbacks to be used
  33. //
  34. SECURITY_DESCRIPTOR _SD;
  35. public:
  36. //
  37. // Constructor for the resource manager
  38. // dwFundsAvailable is the initial funds deposited
  39. //
  40. FundsRM(DWORD dwFundsAvailable);
  41. //
  42. // Destructor
  43. //
  44. ~FundsRM();
  45. //
  46. // This function is called by a user who needs approval of a given amount
  47. // of spending in a given spending type. If the spending is approved, it
  48. // is deducted from the fund's total. If the spending is approved, TRUE
  49. // is returned. Otherwise FALSE is returned.
  50. //
  51. // LPTSTR szwUsername - The name of the user, currently limited to
  52. // Bob, Martha, or Joe
  53. //
  54. // DWORD dwRequestAmount - The amount of spending requested, in cents
  55. //
  56. // DWORD dwSpendingType - The type of spending, ACCESS_FUND_PERSONAL,
  57. // ACCESS_FUND_TRANSFER, or ACCESS_FUND_CORPORATE
  58. //
  59. BOOL Authorize(LPTSTR szwUsername, DWORD RequestAmount, DWORD SpendingType);
  60. //
  61. // Returns the amount of funds still available
  62. //
  63. DWORD FundsAvailable();
  64. };